Skip to content

Commit

Permalink
Merge pull request #88 from flamingchickens1540/robot-class
Browse files Browse the repository at this point in the history
Pass robot class in via project properties
  • Loading branch information
RobinsonZ authored Oct 9, 2018
2 parents 01645e3 + ce013d2 commit 446d960
Show file tree
Hide file tree
Showing 8 changed files with 132 additions and 9 deletions.
21 changes: 21 additions & 0 deletions .idea/runConfigurations/Deploy_AsyncCommandTestRobot.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions .idea/runConfigurations/Deploy_BlinkenTestRobot.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions .idea/runConfigurations/Deploy_DriveTestRobot.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions .idea/runConfigurations/Deploy_HelloWorldTestRobot.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions .idea/runConfigurations/Deploy_PreferencesTestRobot.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
task wrapper(type: Wrapper) {
gradleVersion = '4.4'
distributionUrl = "https://services.gradle.org/distributions/gradle-4.4-all.zip"
}

subprojects {
Expand All @@ -10,6 +11,6 @@ subprojects {
}

dependencies {
compile 'org.jetbrains:annotations:15.0'
compile 'org.jetbrains:annotations:16.0.3'
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
31 changes: 24 additions & 7 deletions test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ dependencies {
}

def TEAM = 1540
def ROBOT_CLASS = "org.team1540.base.testing.XXX"

deploy {
targets {
Expand All @@ -27,17 +26,35 @@ deploy {
artifact('frcJava', FRCJavaArtifact) {
targets << "roborio"
/*
IMPORTANT: With this line in the buildscript, the robot code will not start until
you connect your debugger to the robot. Connect by running the "Remote Robot Debug"
run configuration which should be shared through version control. Alternatively,
remove this line and redeploy.
IMPORTANT: With the "deploy-debug" property set (i.e. -Pdeploy-debug is on the
command line), the robot code will not start until you connect your debugger to the
robot. Connect by running the "Remote Robot Debug" run configuration which should be
shared through version control. Alternatively, remove this line and redeploy.
*/
debug = true
debug = project.hasProperty("deploy-debug")
}
}
}

jar {
// declare the robot class property as an input, as normally since we
// set it at runtime this wouldn't run if the class changed due to up-to-date checking
inputs.property("robotClass", project.hasProperty("robotClass") ? project.robotClass : "")
gradle.taskGraph.whenReady {
/*
check if we are deploying to the robot. If we're building in CI, for example, the
robot class doesn't need to be set.
this is inside the gradle.taskGraph.whenReady so that we don't check if the deploy
task is being run before Gradle has figured it out.
*/
if (gradle.taskGraph.hasTask(":test:deploy")) { // fully qualified task name is needed
if (!project.hasProperty("robotClass")) {
throw new GradleException("Robot class not set. Pass a value in on the command line by adding -ProbotClass=<your robot class>.")
} else {
println "Creating JAR for robot ${project.robotClass}"
}
manifest GradleRIOPlugin.javaManifest(project.robotClass)
}
}
from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
manifest GradleRIOPlugin.javaManifest(ROBOT_CLASS)
}

0 comments on commit 446d960

Please sign in to comment.