|
| 1 | +plugins { |
| 2 | + id "java" |
| 3 | + id "edu.wpi.first.GradleRIO" version "2020.3.2" |
| 4 | + id "org.jetbrains.kotlin.jvm" version "1.3.50" |
| 5 | +} |
| 6 | + |
| 7 | +sourceCompatibility = JavaVersion.VERSION_11 |
| 8 | +targetCompatibility = JavaVersion.VERSION_11 |
| 9 | + |
| 10 | +def ROBOT_MAIN_CLASS = "com.teamXXXX.robot.Main" |
| 11 | + |
| 12 | +// Define my targets (RoboRIO) and artifacts (deployable files) |
| 13 | +// This is added by GradleRIO's backing project EmbeddedTools. |
| 14 | +deploy { |
| 15 | + targets { |
| 16 | + roboRIO("roborio") { |
| 17 | + // Team number is loaded either from the .wpilib/wpilib_preferences.json |
| 18 | + // or from command line. If not found an exception will be thrown. |
| 19 | + // You can use getTeamOrDefault(team) instead of getTeamNumber if you |
| 20 | + // want to store a team number in this file. |
| 21 | + team = frc.getTeamNumber() |
| 22 | + } |
| 23 | + } |
| 24 | + artifacts { |
| 25 | + frcJavaArtifact('frcJava') { |
| 26 | + targets << "roborio" |
| 27 | + // Debug can be overridden by command line, for use with VSCode |
| 28 | + debug = frc.getDebugOrDefault(false) |
| 29 | + } |
| 30 | + // Built in artifact to deploy arbitrary files to the roboRIO. |
| 31 | + fileTreeArtifact('frcStaticFileDeploy') { |
| 32 | + // The directory below is the local directory to deploy |
| 33 | + files = fileTree(dir: 'src/main/deploy') |
| 34 | + // Deploy to RoboRIO target, into /home/lvuser/deploy |
| 35 | + targets << "roborio" |
| 36 | + directory = '/home/lvuser/deploy' |
| 37 | + } |
| 38 | + } |
| 39 | +} |
| 40 | + |
| 41 | +// Set this to true to enable desktop support. |
| 42 | +def includeDesktopSupport = false |
| 43 | + |
| 44 | +// Maven central needed for JUnit and Kotlin |
| 45 | +repositories { |
| 46 | + mavenCentral() |
| 47 | +} |
| 48 | + |
| 49 | +// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. |
| 50 | +// Also defines JUnit 4. |
| 51 | +dependencies { |
| 52 | + implementation "org.jetbrains.kotlin:kotlin-stdlib" |
| 53 | + |
| 54 | + implementation wpi.deps.wpilib() |
| 55 | + nativeZip wpi.deps.wpilibJni(wpi.platforms.roborio) |
| 56 | + nativeDesktopZip wpi.deps.wpilibJni(wpi.platforms.desktop) |
| 57 | + |
| 58 | + |
| 59 | + implementation wpi.deps.vendor.java() |
| 60 | + nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio) |
| 61 | + nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop) |
| 62 | + |
| 63 | + testImplementation 'junit:junit:4.12' |
| 64 | + |
| 65 | + // Enable simulation gui support. Must check the box in vscode to enable support |
| 66 | + // upon debugging |
| 67 | + simulation wpi.deps.sim.gui(wpi.platforms.desktop, false) |
| 68 | +} |
| 69 | + |
| 70 | +// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') |
| 71 | +// in order to make them all available at runtime. Also adding the manifest so WPILib |
| 72 | +// knows where to look for our Robot Class. |
| 73 | +jar { |
| 74 | + from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } |
| 75 | + manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) |
| 76 | +} |
0 commit comments