Add JRE deployment to MyRobot Deploy (#2099)

This commit is contained in:
Thad House
2019-11-18 19:52:56 -08:00
committed by Peter Johnson
parent 0e83c65d27
commit b37b68daaf
3 changed files with 54 additions and 0 deletions

1
.gitignore vendored
View File

@@ -3,6 +3,7 @@
dependency-reduced-pom.xml
doxygen.log
build*/
!buildSrc/
# Created by the jenkins test script
test-reports

View File

@@ -0,0 +1,48 @@
import groovy.transform.CompileStatic
import javax.inject.Inject
import jaci.gradle.deploy.artifact.MavenArtifact
import jaci.gradle.deploy.context.DeployContext
import org.gradle.api.Project
import jaci.gradle.ActionWrapper
import java.util.function.Function
@CompileStatic
class JREArtifact extends MavenArtifact {
Function<DeployContext, Boolean> buildRequiresJre = (Function<DeployContext, Boolean>){ true }
void setJreDependency(String dep) {
dependency = project.dependencies.add(configuration(), dep)
}
@Inject
JREArtifact(String name, Project project) {
super(name, project)
configuration = project.configurations.create(configuration())
onlyIf = { DeployContext ctx ->
(buildRequiresJre.apply(ctx) && jreMissing(ctx)) || project.hasProperty("force-redeploy-jre")
}
predeploy << new ActionWrapper({ DeployContext ctx ->
ctx.logger.log('Deploying RoboRIO JRE (this will take a while)...')
})
directory = '/tmp'
filename = 'frcjre.ipk'
postdeploy << new ActionWrapper({ DeployContext ctx ->
ctx.logger.log('Installing JRE...')
ctx.execute('opkg remove frc2020-openjdk*; opkg install /tmp/frcjre.ipk; rm /tmp/frcjre.ipk')
ctx.logger.log('JRE Deployed!')
})
}
String configuration() {
return name + 'frcjre'
}
boolean jreMissing(DeployContext ctx) {
return ctx.execute('if [[ -f "/usr/local/frc/JRE/bin/java" ]]; then echo OK; else echo MISSING; fi').result.contains("MISSING")
}
}

View File

@@ -50,6 +50,10 @@ deploy {
}
}
artifact('jre', JREArtifact) {
jreDependency = 'edu.wpi.first.jdk:roborio-2020:11.0.4u10-2'
}
javaArtifact('myRobotJava') {
jar = 'shadowJar'
postdeploy << { ctx ->
@@ -82,6 +86,7 @@ deploy {
}
tasks.register('deployJava') {
dependsOn tasks.named('deployJreRoborio')
dependsOn tasks.named('deployMyRobotJavaRoborio')
dependsOn tasks.named('deployMyRobotCppLibrariesRoborio')
}