mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Add JRE deployment to MyRobot Deploy (#2099)
This commit is contained in:
committed by
Peter Johnson
parent
0e83c65d27
commit
b37b68daaf
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,6 +3,7 @@
|
||||
dependency-reduced-pom.xml
|
||||
doxygen.log
|
||||
build*/
|
||||
!buildSrc/
|
||||
|
||||
# Created by the jenkins test script
|
||||
test-reports
|
||||
|
||||
48
buildSrc/src/main/groovy/JREArtifact.groovy
Normal file
48
buildSrc/src/main/groovy/JREArtifact.groovy
Normal 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")
|
||||
}
|
||||
}
|
||||
@@ -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')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user