Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 1 | import org.gradle.language.base.internal.ProjectLayout |
| 2 | import edu.wpi.first.deployutils.deploy.target.RemoteTarget |
| 3 | import edu.wpi.first.deployutils.deploy.target.location.SshDeployLocation |
| 4 | import edu.wpi.first.deployutils.deploy.artifact.* |
| 5 | import org.gradle.internal.os.OperatingSystem |
| 6 | |
| 7 | apply plugin: 'cpp' |
| 8 | apply plugin: 'visual-studio' |
| 9 | apply plugin: 'edu.wpi.first.NativeUtils' |
| 10 | apply plugin: ExtraTasks |
| 11 | |
| 12 | apply plugin: 'edu.wpi.first.DeployUtils' |
| 13 | |
| 14 | apply from: '../shared/config.gradle' |
| 15 | |
| 16 | ext { |
| 17 | sharedCvConfigs = [crossConnIntegrationTests: []] |
| 18 | staticCvConfigs = [:] |
| 19 | useJava = false |
| 20 | useCpp = true |
| 21 | staticGtestConfigs = [crossConnIntegrationTests: []] |
| 22 | } |
| 23 | |
| 24 | apply from: "${rootDir}/shared/opencv.gradle" |
| 25 | |
| 26 | apply from: "${rootDir}/shared/googletest.gradle" |
| 27 | |
| 28 | deploy { |
| 29 | targets { |
| 30 | roborio(RemoteTarget) { |
| 31 | directory = '/home/admin' |
| 32 | maxChannels = 4 |
| 33 | locations { |
| 34 | ssh(SshDeployLocation) { |
| 35 | address = "172.22.11.2" |
| 36 | user = 'admin' |
| 37 | password = '' |
| 38 | ipv6 = false |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | artifacts { |
| 43 | all { |
| 44 | predeploy << { ctx -> |
| 45 | ctx.execute('/usr/local/frc/bin/frcKillRobot.sh -t') |
| 46 | } |
| 47 | postdeploy << { ctx -> |
| 48 | ctx.execute("sync") |
| 49 | ctx.execute("ldconfig") |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | crossConnIntegrationTests(NativeExecutableArtifact) { |
| 54 | libraryDirectory = '/usr/local/frc/third-party/lib' |
| 55 | postdeploy << { ctx -> |
| 56 | ctx.execute('chmod +x crossConnIntegrationTests') |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | model { |
| 65 | components { |
| 66 | crossConnIntegrationTests(NativeExecutableSpec) { |
| 67 | targetBuildTypes 'debug' |
| 68 | nativeUtils.useRequiredLibrary(it, 'googletest_static') |
| 69 | binaries.all { binary -> |
| 70 | if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { |
| 71 | if (binary.buildType.name == 'debug') { |
| 72 | deploy.targets.roborio.artifacts.crossConnIntegrationTests.binary = binary |
| 73 | } |
| 74 | |
| 75 | binary.sources { |
| 76 | athenaCpp(CppSourceSet) { |
| 77 | source { |
| 78 | srcDirs = ['src/main/native/cpp'] |
| 79 | includes = ['**/*.cpp'] |
| 80 | } |
| 81 | exportedHeaders { |
| 82 | srcDirs = ['src/main/native/include'] |
| 83 | includes = ['**/*.h'] |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 | binary.tasks.withType(CppCompile) { |
| 88 | cppCompiler.args "-Wno-missing-field-initializers" |
| 89 | cppCompiler.args "-Wno-unused-variable" |
| 90 | cppCompiler.args "-Wno-error=deprecated-declarations" |
| 91 | } |
| 92 | project(':hal').addHalDependency(binary, 'shared') |
| 93 | project(':hal').addHalJniDependency(binary) |
| 94 | lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' |
| 95 | if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { |
| 96 | nativeUtils.useRequiredLibrary(binary, 'ni_link_libraries', 'ni_runtime_libraries') |
| 97 | } |
| 98 | } else { |
| 99 | binary.sources { |
| 100 | simCpp(CppSourceSet) { |
| 101 | source { |
| 102 | srcDirs 'src/main/native/dt' |
| 103 | includes = ['**/*.cpp'] |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | tasks.register('deployTests') { |
| 114 | try { |
| 115 | dependsOn tasks.named('deployCrossConnIntegrationTestsLibrariesRoborio') |
| 116 | dependsOn tasks.named('deployCrossConnIntegrationTestsRoborio') |
| 117 | } catch (ignored) { |
| 118 | } |
| 119 | } |