John Park | 7eb9042 | 2018-01-27 12:04:57 -0800 | [diff] [blame^] | 1 | import org.gradle.language.base.internal.ProjectLayout |
| 2 | |
| 3 | if (!project.hasProperty('skipAthena')) { |
| 4 | apply plugin: 'cpp' |
| 5 | apply plugin: 'visual-studio' |
| 6 | apply plugin: 'edu.wpi.first.NativeUtils' |
| 7 | |
| 8 | apply from: '../config.gradle' |
| 9 | |
| 10 | model { |
| 11 | dependencyConfigs { |
| 12 | wpiutil(DependencyConfig) { |
| 13 | groupId = 'edu.wpi.first.wpiutil' |
| 14 | artifactId = 'wpiutil-cpp' |
| 15 | headerClassifier = 'headers' |
| 16 | ext = 'zip' |
| 17 | version = '3.+' |
| 18 | sharedConfigs = [ wpilibcIntegrationTests: [] ] |
| 19 | } |
| 20 | ntcore(DependencyConfig) { |
| 21 | groupId = 'edu.wpi.first.ntcore' |
| 22 | artifactId = 'ntcore-cpp' |
| 23 | headerClassifier = 'headers' |
| 24 | ext = 'zip' |
| 25 | version = '4.+' |
| 26 | sharedConfigs = [ wpilibcIntegrationTests: [] ] |
| 27 | } |
| 28 | opencv(DependencyConfig) { |
| 29 | groupId = 'org.opencv' |
| 30 | artifactId = 'opencv-cpp' |
| 31 | headerClassifier = 'headers' |
| 32 | ext = 'zip' |
| 33 | version = '3.2.0' |
| 34 | sharedConfigs = [ wpilibcIntegrationTests: [] ] |
| 35 | } |
| 36 | cscore(DependencyConfig) { |
| 37 | groupId = 'edu.wpi.first.cscore' |
| 38 | artifactId = 'cscore-cpp' |
| 39 | headerClassifier = 'headers' |
| 40 | ext = 'zip' |
| 41 | version = '1.+' |
| 42 | sharedConfigs = [ wpilibcIntegrationTests: [] ] |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | model { |
| 48 | components { |
| 49 | wpilibcIntegrationTests(NativeExecutableSpec) { |
| 50 | baseName = 'FRCUserProgram' |
| 51 | sources { |
| 52 | cpp { |
| 53 | source { |
| 54 | srcDirs = ["${rootDir}/gmock/gtest/src", 'src/FRCUserProgram/cpp'] |
| 55 | includes = ['*-all.cc', '*_main.cc', '**/*.cpp'] |
| 56 | } |
| 57 | exportedHeaders { |
| 58 | srcDirs = ["${rootDir}/gmock/gtest/include", "${rootDir}/gmock/gtest", 'src/FRCUserProgram/headers'] |
| 59 | includes = ['**/*.h', '**/*.cc'] |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | binaries.all { binary-> |
| 64 | if (binary.targetPlatform.architecture.name == 'athena') { |
| 65 | binary.tasks.withType(CppCompile) { |
| 66 | cppCompiler.args "-Wno-missing-field-initializers" |
| 67 | cppCompiler.args "-Wno-unused-variable" |
| 68 | cppCompiler.args "-Wno-error=deprecated-declarations" |
| 69 | } |
| 70 | project(':ni-libraries').addNiLibrariesToLinker(binary) |
| 71 | project(':hal').addHalToLinker(binary) |
| 72 | project(':wpilibc').addWpilibCCompilerArguments(binary) |
| 73 | project(':wpilibc').addWpilibCToLinker(binary) |
| 74 | } else { |
| 75 | binary.buildable = false |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | def testOutputFolder = file("${project(':').buildDir}/integrationTestFiles") |
| 84 | |
| 85 | |
| 86 | model { |
| 87 | tasks { |
| 88 | copyWpilibCTestLibrariesToOutput(Task) { |
| 89 | $.binaries.each { |
| 90 | if (it in NativeExecutableBinarySpec && it.targetPlatform.architecture.name == 'athena') { |
| 91 | def spec = it |
| 92 | dependsOn spec.buildTask |
| 93 | } |
| 94 | } |
| 95 | outputs.file testOutputFolder |
| 96 | outputs.upToDateWhen { false } |
| 97 | |
| 98 | def bin = $.binaries |
| 99 | doLast { |
| 100 | bin.each { |
| 101 | if (it in NativeExecutableBinarySpec && it.targetPlatform.architecture.name == 'athena') { |
| 102 | def spec = it |
| 103 | spec.libs.each { |
| 104 | it.runtimeFiles.each { f -> |
| 105 | copy { |
| 106 | from file(f) |
| 107 | into testOutputFolder.toString() + '/libs' |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | copy { |
| 112 | from spec.executable.file |
| 113 | into testOutputFolder.toString() + '/cpp' |
| 114 | } |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | // This is in a separate if statement because of what I would assume is a bug in grade. |
| 120 | // Will file an issue on their side. |
| 121 | if (!project.hasProperty('skipAthena')) { |
| 122 | build.dependsOn copyWpilibCTestLibrariesToOutput |
| 123 | } |
| 124 | } |
| 125 | } |