blob: 1c55e1bb389266022643b74492d4f9595ded3417 [file] [log] [blame]
Austin Schuh812d0d12021-11-04 20:16:48 -07001import org.gradle.language.base.internal.ProjectLayout
2import edu.wpi.first.deployutils.deploy.target.RemoteTarget
3import edu.wpi.first.deployutils.deploy.target.location.SshDeployLocation
4import edu.wpi.first.deployutils.deploy.artifact.*
5import org.gradle.internal.os.OperatingSystem
6
7apply plugin: 'cpp'
8apply plugin: 'visual-studio'
9apply plugin: 'edu.wpi.first.NativeUtils'
10apply plugin: ExtraTasks
11
12apply plugin: 'edu.wpi.first.DeployUtils'
13
14apply from: '../shared/config.gradle'
15
16ext {
17 sharedCvConfigs = [crossConnIntegrationTests: []]
18 staticCvConfigs = [:]
19 useJava = false
20 useCpp = true
21 staticGtestConfigs = [crossConnIntegrationTests: []]
22}
23
24apply from: "${rootDir}/shared/opencv.gradle"
25
26apply from: "${rootDir}/shared/googletest.gradle"
27
28deploy {
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
64model {
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 }
Austin Schuh812d0d12021-11-04 20:16:48 -070087 project(':hal').addHalDependency(binary, 'shared')
88 project(':hal').addHalJniDependency(binary)
James Kuszmaulcf324122023-01-14 14:07:17 -080089 lib project: ':wpinet', library: 'wpinet', linkage: 'shared'
Austin Schuh812d0d12021-11-04 20:16:48 -070090 lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
91 if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
92 nativeUtils.useRequiredLibrary(binary, 'ni_link_libraries', 'ni_runtime_libraries')
93 }
94 } else {
95 binary.sources {
96 simCpp(CppSourceSet) {
97 source {
98 srcDirs 'src/main/native/dt'
99 includes = ['**/*.cpp']
100 }
101 }
102 }
103 }
104 }
105 }
106 }
107}
108
109tasks.register('deployTests') {
110 try {
111 dependsOn tasks.named('deployCrossConnIntegrationTestsLibrariesRoborio')
112 dependsOn tasks.named('deployCrossConnIntegrationTestsRoborio')
113 } catch (ignored) {
114 }
115}