Add deploy options to myRobot (#2079)

Will only deploy to USB by default, and will not deploy the JRE, but will deploy a Java app.
This commit is contained in:
Thad House
2019-11-13 22:45:19 -08:00
committed by Peter Johnson
parent b7bc1ea745
commit bf5388393e
2 changed files with 105 additions and 7 deletions

View File

@@ -5,5 +5,5 @@ repositories {
}
}
dependencies {
implementation "edu.wpi.first:native-utils:2020.5.1"
implementation "edu.wpi.first:native-utils:2020.5.2"
}

View File

@@ -1,3 +1,6 @@
import jaci.gradle.toolchains.*
import jaci.gradle.nativedeps.*
plugins {
id 'java'
id 'application'
@@ -6,6 +9,7 @@ plugins {
}
apply plugin: 'edu.wpi.first.NativeUtils'
apply plugin: 'jaci.gradle.EmbeddedTools'
apply from: '../shared/config.gradle'
@@ -19,6 +23,106 @@ ext {
apply from: "${rootDir}/shared/opencv.gradle"
deploy {
targets {
target('roborio') {
directory = '/home/admin'
maxChannels = 4
locations {
ssh {
address = "172.22.11.2"
user = 'admin'
password = ''
ipv6 = false
}
}
}
}
artifacts {
all {
targets << 'roborio'
predeploy << { ctx ->
ctx.execute('/usr/local/frc/bin/frcKillRobot.sh -t')
}
postdeploy << { ctx ->
ctx.execute("sync")
ctx.execute("ldconfig")
}
}
javaArtifact('myRobotJava') {
jar = 'shadowJar'
postdeploy << { ctx ->
ctx.execute("echo '/usr/local/frc/JRE/bin/java -XX:+UseConcMarkSweepGC -Djava.library.path=/usr/local/frc/third-party/lib -Djava.lang.invoke.stringConcat=BC_SB -jar /home/admin/myRobot-all.jar' > /home/admin/myRobotJavaRun")
ctx.execute("chmod +x /home/admin/myRobotJavaRun; chown lvuser /home/admin/myRobotJavaRun")
}
}
nativeArtifact('myRobotCpp') {
component = 'myRobotCpp'
targetPlatform = nativeUtils.wpi.platforms.roborio
libraryDirectory = '/usr/local/frc/third-party/lib'
buildType = 'debug'
postdeploy << { ctx ->
ctx.execute('chmod +x myRobotCpp')
}
}
nativeArtifact('myRobotCppRelease') {
component = 'myRobotCpp'
targetPlatform = nativeUtils.wpi.platforms.roborio
libraryDirectory = '/usr/local/frc/third-party/lib'
buildType = 'release'
postdeploy << { ctx ->
ctx.execute('chmod +x myRobotCpp')
}
}
nativeArtifact('myRobotCppStatic') {
component = 'myRobotCppStatic'
targetPlatform = nativeUtils.wpi.platforms.roborio
buildType = 'debug'
postdeploy << { ctx ->
ctx.execute('chmod +x myRobotCppStatic')
}
}
nativeArtifact('myRobotCppStaticRelease') {
component = 'myRobotCppStatic'
targetPlatform = nativeUtils.wpi.platforms.roborio
buildType = 'release'
postdeploy << { ctx ->
ctx.execute('chmod +x myRobotCppStatic')
}
}
}
}
tasks.register('deployJava') {
dependsOn tasks.named('deployMyRobotJavaRoborio')
dependsOn tasks.named('deployMyRobotCppLibrariesRoborio')
}
tasks.register('deployShared') {
dependsOn tasks.named('deployMyRobotCppLibrariesRoborio')
dependsOn tasks.named('deployMyRobotCppRoborio')
}
tasks.register('deployStatic') {
dependsOn tasks.named('deployMyRobotCppStaticRoborio')
}
tasks.register('deployReleaseShared') {
dependsOn tasks.named('deployMyRobotCppReleaseLibrariesRoborio')
dependsOn tasks.named('deployMyRobotCppReleaseRoborio')
}
tasks.register('deployReleaseStatic') {
dependsOn tasks.named('deployMyRobotCppReleaseStaticRoborio')
}
mainClassName = 'Main'
apply plugin: 'com.github.johnrengelman.shadow'
@@ -38,15 +142,10 @@ dependencies {
implementation project(':wpilibNewCommands')
}
jar {
manifest { attributes 'Robot-Class': 'MyRobot' }
}
model {
components {
myRobotCpp(NativeExecutableSpec) {
targetBuildTypes 'debug'
baseName = 'FRCUserProgram'
sources {
cpp {
source {
@@ -78,7 +177,6 @@ model {
}
myRobotCppStatic(NativeExecutableSpec) {
targetBuildTypes 'debug'
baseName = 'FRCUserProgram'
sources {
cpp {
source {