mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Solves mutex issues, and other issues with the existing teststand software. And simplifies the unit test structure.
127 lines
4.7 KiB
Groovy
127 lines
4.7 KiB
Groovy
import org.gradle.language.base.internal.ProjectLayout
|
|
|
|
if (!project.hasProperty('skipAthena')) {
|
|
apply plugin: 'cpp'
|
|
apply plugin: 'visual-studio'
|
|
apply plugin: 'edu.wpi.first.NativeUtils'
|
|
|
|
apply from: '../config.gradle'
|
|
|
|
model {
|
|
dependencyConfigs {
|
|
wpiutil(DependencyConfig) {
|
|
groupId = 'edu.wpi.first.wpiutil'
|
|
artifactId = 'wpiutil-cpp'
|
|
headerClassifier = 'headers'
|
|
ext = 'zip'
|
|
version = '3.+'
|
|
sharedConfigs = [ wpilibcIntegrationTests: [] ]
|
|
}
|
|
ntcore(DependencyConfig) {
|
|
groupId = 'edu.wpi.first.ntcore'
|
|
artifactId = 'ntcore-cpp'
|
|
headerClassifier = 'headers'
|
|
ext = 'zip'
|
|
version = '4.+'
|
|
sharedConfigs = [ wpilibcIntegrationTests: [] ]
|
|
}
|
|
opencv(DependencyConfig) {
|
|
groupId = 'org.opencv'
|
|
artifactId = 'opencv-cpp'
|
|
headerClassifier = 'headers'
|
|
ext = 'zip'
|
|
version = '3.2.0'
|
|
sharedConfigs = [ wpilibcIntegrationTests: [] ]
|
|
}
|
|
cscore(DependencyConfig) {
|
|
groupId = 'edu.wpi.first.cscore'
|
|
artifactId = 'cscore-cpp'
|
|
headerClassifier = 'headers'
|
|
ext = 'zip'
|
|
version = '1.+'
|
|
sharedConfigs = [ wpilibcIntegrationTests: [] ]
|
|
}
|
|
}
|
|
}
|
|
|
|
model {
|
|
components {
|
|
wpilibcIntegrationTests(NativeExecutableSpec) {
|
|
baseName = 'FRCUserProgram'
|
|
sources {
|
|
cpp {
|
|
source {
|
|
srcDirs = ["${rootDir}/gmock/gtest/src", 'src/FRCUserProgram/cpp']
|
|
includes = ['*-all.cc', '*_main.cc', '**/*.cpp']
|
|
}
|
|
exportedHeaders {
|
|
srcDirs = ["${rootDir}/gmock/gtest/include", "${rootDir}/gmock/gtest", 'src/FRCUserProgram/headers']
|
|
includes = ['**/*.h', '**/*.cc']
|
|
}
|
|
}
|
|
}
|
|
binaries.all { binary->
|
|
if (binary.targetPlatform.architecture.name == 'athena') {
|
|
binary.tasks.withType(CppCompile) {
|
|
cppCompiler.args "-Wno-missing-field-initializers"
|
|
cppCompiler.args "-Wno-unused-variable"
|
|
cppCompiler.args "-Wno-error=deprecated-declarations"
|
|
}
|
|
project(':ni-libraries').addNiLibrariesToLinker(binary)
|
|
project(':hal').addHalCompilerArguments(binary)
|
|
project(':hal').addHalToLinker(binary)
|
|
project(':wpilibc').addWpilibCCompilerArguments(binary)
|
|
project(':wpilibc').addWpilibCToLinker(binary)
|
|
} else {
|
|
binary.buildable = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
def testOutputFolder = file("${project(':').buildDir}/integrationTestFiles")
|
|
|
|
|
|
model {
|
|
tasks {
|
|
copyWpilibCTestLibrariesToOutput(Task) {
|
|
$.binaries.each {
|
|
if (it in NativeExecutableBinarySpec && it.targetPlatform.architecture.name == 'athena') {
|
|
def spec = it
|
|
dependsOn spec.buildTask
|
|
}
|
|
}
|
|
outputs.file testOutputFolder
|
|
outputs.upToDateWhen { false }
|
|
|
|
def bin = $.binaries
|
|
doLast {
|
|
bin.each {
|
|
if (it in NativeExecutableBinarySpec && it.targetPlatform.architecture.name == 'athena') {
|
|
def spec = it
|
|
spec.libs.each {
|
|
it.runtimeFiles.each { f ->
|
|
copy {
|
|
from file(f)
|
|
into testOutputFolder.toString() + '/libs'
|
|
}
|
|
}
|
|
}
|
|
copy {
|
|
from spec.executable.file
|
|
into testOutputFolder.toString() + '/cpp'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// This is in a separate if statement because of what I would assume is a bug in grade.
|
|
// Will file an issue on their side.
|
|
if (!project.hasProperty('skipAthena')) {
|
|
build.dependsOn copyWpilibCTestLibrariesToOutput
|
|
}
|
|
}
|
|
}
|