|
1 | | -plugins { |
2 | | - id "java" |
3 | | - id "edu.wpi.first.GradleRIO" version "2025.3.2" |
4 | | - id "com.peterabeles.gversion" version "1.10" |
5 | | -} |
6 | | - |
7 | | -java { |
8 | | - sourceCompatibility = JavaVersion.VERSION_17 |
9 | | - targetCompatibility = JavaVersion.VERSION_17 |
10 | | -} |
11 | | - |
12 | | -def ROBOT_MAIN_CLASS = "frc.robot.Main" |
13 | | - |
14 | | -repositories { |
15 | | - maven { |
16 | | - url = "https://maven.pkg.github.com/Mechanical-Advantage/AdvantageKit" |
17 | | - credentials { |
18 | | - username = "Mechanical-Advantage-Bot" |
19 | | - password = "\u0067\u0068\u0070\u005f\u006e\u0056\u0051\u006a\u0055\u004f\u004c\u0061\u0079\u0066\u006e\u0078\u006e\u0037\u0051\u0049\u0054\u0042\u0032\u004c\u004a\u006d\u0055\u0070\u0073\u0031\u006d\u0037\u004c\u005a\u0030\u0076\u0062\u0070\u0063\u0051" |
20 | | - } |
21 | | - } |
22 | | - |
23 | | - maven { url = "https://jitpack.io" } |
24 | | -} |
25 | | - |
26 | | -project.compileJava.dependsOn(createVersionFile) |
27 | | -gversion { |
28 | | - srcDir = "src/main/java/" |
29 | | - classPackage = "frc.robot" |
30 | | - className = "BuildConstants" |
31 | | - dateFormat = "yyyy-MM-dd HH:mm:ss z" |
32 | | - timeZone = "America/Chicago" // Use preferred time zone |
33 | | - indent = " " |
34 | | -} |
35 | | - |
36 | | -// Define my targets (RoboRIO) and artifacts (deployable files) |
37 | | -// This is added by GradleRIO's backing project DeployUtils. |
38 | | -deploy { |
39 | | - targets { |
40 | | - roborio(getTargetTypeClass('RoboRIO')) { |
41 | | - // Team number is loaded either from the .wpilib/wpilib_preferences.json |
42 | | - // or from command line. If not found an exception will be thrown. |
43 | | - // You can use getTeamOrDefault(team) instead of getTeamNumber if you |
44 | | - // want to store a team number in this file. |
45 | | - team = project.frc.getTeamNumber() |
46 | | - debug = project.frc.getDebugOrDefault(false) |
47 | | - |
48 | | - artifacts { |
49 | | - // First part is artifact name, 2nd is artifact type |
50 | | - // getTargetTypeClass is a shortcut to get the class type using a string |
51 | | - |
52 | | - frcJava(getArtifactTypeClass('FRCJavaArtifact')) { |
53 | | - } |
54 | | - |
55 | | - // Static files artifact |
56 | | - frcStaticFileDeploy(getArtifactTypeClass('FileTreeArtifact')) { |
57 | | - files = project.fileTree('src/main/deploy') |
58 | | - directory = '/home/lvuser/deploy' |
59 | | - deleteOldFiles = true // Change to true to delete files on roboRIO that no |
60 | | - // longer exist in deploy directory of this project |
61 | | - } |
62 | | - } |
63 | | - } |
64 | | - } |
65 | | -} |
66 | | - |
67 | | -def deployArtifact = deploy.targets.roborio.artifacts.frcJava |
68 | | - |
69 | | -// Set to true to use debug for JNI. |
70 | | -wpi.java.debugJni = false |
71 | | - |
72 | | -// Set this to true to enable desktop support. |
73 | | -def includeDesktopSupport = true |
74 | | - |
75 | | -// Get AdvantageKit version from vendordep file |
76 | | -def AdvantageKitJSON = new groovy.json.JsonSlurper().parseText(new File(projectDir.getAbsolutePath() + "/vendordeps/AdvantageKit.json").text) |
77 | | - |
78 | | -// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. |
79 | | -// Also defines JUnit 5. |
80 | | -dependencies { |
81 | | - annotationProcessor wpi.java.deps.wpilibAnnotations() |
82 | | - implementation wpi.java.deps.wpilib() |
83 | | - implementation wpi.java.vendor.java() |
84 | | - |
85 | | - roborioDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.roborio) |
86 | | - roborioDebug wpi.java.vendor.jniDebug(wpi.platforms.roborio) |
87 | | - |
88 | | - roborioRelease wpi.java.deps.wpilibJniRelease(wpi.platforms.roborio) |
89 | | - roborioRelease wpi.java.vendor.jniRelease(wpi.platforms.roborio) |
90 | | - |
91 | | - nativeDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.desktop) |
92 | | - nativeDebug wpi.java.vendor.jniDebug(wpi.platforms.desktop) |
93 | | - simulationDebug wpi.sim.enableDebug() |
94 | | - |
95 | | - nativeRelease wpi.java.deps.wpilibJniRelease(wpi.platforms.desktop) |
96 | | - nativeRelease wpi.java.vendor.jniRelease(wpi.platforms.desktop) |
97 | | - simulationRelease wpi.sim.enableRelease() |
98 | | - |
99 | | - implementation 'com.github.lasarobotics:PurpleLib:v2025.0.7' |
100 | | - |
101 | | - implementation 'org.apache.commons:commons-math3:3.+' |
102 | | - implementation 'org.tinylog:tinylog-api:2.7.0' |
103 | | - implementation 'org.tinylog:tinylog-impl:2.7.0' |
104 | | - |
105 | | - testImplementation 'org.junit.jupiter:junit-jupiter:5.+' |
106 | | - testImplementation 'org.mockito:mockito-core:3.+' |
107 | | - |
108 | | - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.+' |
109 | | - |
110 | | - annotationProcessor "org.littletonrobotics.akit:akit-autolog:$AdvantageKitJSON.version" |
111 | | -} |
112 | | - |
113 | | -test { |
114 | | - useJUnitPlatform() |
115 | | - systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true' |
116 | | -} |
117 | | - |
118 | | -// Simulation configuration (e.g. environment variables). |
119 | | -wpi.sim.addGui().defaultEnabled = true |
120 | | -wpi.sim.addDriverstation() |
121 | | - |
122 | | -// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') |
123 | | -// in order to make them all available at runtime. Also adding the manifest so WPILib |
124 | | -// knows where to look for our Robot Class. |
125 | | -jar { |
126 | | - from { |
127 | | - configurations.runtimeClasspath.collect { |
128 | | - it.isDirectory() ? it : zipTree(it) |
129 | | - } |
130 | | - } |
131 | | - from sourceSets.main.allSource |
132 | | - manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) |
133 | | - duplicatesStrategy = DuplicatesStrategy.INCLUDE |
134 | | -} |
135 | | - |
136 | | -// Configure replay watch task |
137 | | -task(replayWatch, type: JavaExec) { |
138 | | - mainClass = "org.littletonrobotics.junction.ReplayWatch" |
139 | | - classpath = sourceSets.main.runtimeClasspath |
140 | | -} |
141 | | - |
142 | | -// Configure jar and deploy tasks |
143 | | -deployArtifact.jarTask = jar |
144 | | -wpi.java.configureExecutableTasks(jar) |
145 | | -wpi.java.configureTestTasks(test) |
146 | | - |
147 | | -// Configure string concat to always inline compile |
148 | | -tasks.withType(JavaCompile) { |
149 | | - options.compilerArgs.add '-XDstringConcat=inline' |
150 | | -} |
| 1 | +plugins { |
| 2 | + id "java" |
| 3 | + id "edu.wpi.first.GradleRIO" version "2025.3.2" |
| 4 | + id "com.peterabeles.gversion" version "1.10" |
| 5 | +} |
| 6 | + |
| 7 | +java { |
| 8 | + sourceCompatibility = JavaVersion.VERSION_17 |
| 9 | + targetCompatibility = JavaVersion.VERSION_17 |
| 10 | +} |
| 11 | + |
| 12 | +def ROBOT_MAIN_CLASS = "frc.robot.Main" |
| 13 | + |
| 14 | +repositories { |
| 15 | + maven { |
| 16 | + url = "https://maven.pkg.github.com/Mechanical-Advantage/AdvantageKit" |
| 17 | + credentials { |
| 18 | + username = "Mechanical-Advantage-Bot" |
| 19 | + password = "\u0067\u0068\u0070\u005f\u006e\u0056\u0051\u006a\u0055\u004f\u004c\u0061\u0079\u0066\u006e\u0078\u006e\u0037\u0051\u0049\u0054\u0042\u0032\u004c\u004a\u006d\u0055\u0070\u0073\u0031\u006d\u0037\u004c\u005a\u0030\u0076\u0062\u0070\u0063\u0051" |
| 20 | + } |
| 21 | + } |
| 22 | + |
| 23 | + maven { url = "https://jitpack.io" } |
| 24 | +} |
| 25 | + |
| 26 | +project.compileJava.dependsOn(createVersionFile) |
| 27 | +gversion { |
| 28 | + srcDir = "src/main/java/" |
| 29 | + classPackage = "frc.robot" |
| 30 | + className = "BuildConstants" |
| 31 | + dateFormat = "yyyy-MM-dd HH:mm:ss z" |
| 32 | + timeZone = "America/Chicago" // Use preferred time zone |
| 33 | + indent = " " |
| 34 | +} |
| 35 | + |
| 36 | +// Define my targets (RoboRIO) and artifacts (deployable files) |
| 37 | +// This is added by GradleRIO's backing project DeployUtils. |
| 38 | +deploy { |
| 39 | + targets { |
| 40 | + roborio(getTargetTypeClass('RoboRIO')) { |
| 41 | + // Team number is loaded either from the .wpilib/wpilib_preferences.json |
| 42 | + // or from command line. If not found an exception will be thrown. |
| 43 | + // You can use getTeamOrDefault(team) instead of getTeamNumber if you |
| 44 | + // want to store a team number in this file. |
| 45 | + team = project.frc.getTeamNumber() |
| 46 | + debug = project.frc.getDebugOrDefault(false) |
| 47 | + |
| 48 | + artifacts { |
| 49 | + // First part is artifact name, 2nd is artifact type |
| 50 | + // getTargetTypeClass is a shortcut to get the class type using a string |
| 51 | + |
| 52 | + frcJava(getArtifactTypeClass('FRCJavaArtifact')) { |
| 53 | + } |
| 54 | + |
| 55 | + // Static files artifact |
| 56 | + frcStaticFileDeploy(getArtifactTypeClass('FileTreeArtifact')) { |
| 57 | + files = project.fileTree('src/main/deploy') |
| 58 | + directory = '/home/lvuser/deploy' |
| 59 | + deleteOldFiles = true // Change to true to delete files on roboRIO that no |
| 60 | + // longer exist in deploy directory of this project |
| 61 | + } |
| 62 | + } |
| 63 | + } |
| 64 | + } |
| 65 | +} |
| 66 | + |
| 67 | +def deployArtifact = deploy.targets.roborio.artifacts.frcJava |
| 68 | + |
| 69 | +// Set to true to use debug for JNI. |
| 70 | +wpi.java.debugJni = false |
| 71 | + |
| 72 | +// Set this to true to enable desktop support. |
| 73 | +def includeDesktopSupport = true |
| 74 | + |
| 75 | +// Get AdvantageKit version from vendordep file |
| 76 | +def AdvantageKitJSON = new groovy.json.JsonSlurper().parseText(new File(projectDir.getAbsolutePath() + "/vendordeps/AdvantageKit.json").text) |
| 77 | + |
| 78 | +// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. |
| 79 | +// Also defines JUnit 5. |
| 80 | +dependencies { |
| 81 | + annotationProcessor wpi.java.deps.wpilibAnnotations() |
| 82 | + implementation wpi.java.deps.wpilib() |
| 83 | + implementation wpi.java.vendor.java() |
| 84 | + |
| 85 | + roborioDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.roborio) |
| 86 | + roborioDebug wpi.java.vendor.jniDebug(wpi.platforms.roborio) |
| 87 | + |
| 88 | + roborioRelease wpi.java.deps.wpilibJniRelease(wpi.platforms.roborio) |
| 89 | + roborioRelease wpi.java.vendor.jniRelease(wpi.platforms.roborio) |
| 90 | + |
| 91 | + nativeDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.desktop) |
| 92 | + nativeDebug wpi.java.vendor.jniDebug(wpi.platforms.desktop) |
| 93 | + simulationDebug wpi.sim.enableDebug() |
| 94 | + |
| 95 | + nativeRelease wpi.java.deps.wpilibJniRelease(wpi.platforms.desktop) |
| 96 | + nativeRelease wpi.java.vendor.jniRelease(wpi.platforms.desktop) |
| 97 | + simulationRelease wpi.sim.enableRelease() |
| 98 | + |
| 99 | + implementation 'com.github.lasarobotics:PurpleLib:v2025.0.7' |
| 100 | + |
| 101 | + implementation 'org.apache.commons:commons-math3:3.+' |
| 102 | + implementation 'org.tinylog:tinylog-api:2.7.0' |
| 103 | + implementation 'org.tinylog:tinylog-impl:2.7.0' |
| 104 | + |
| 105 | + testImplementation 'org.junit.jupiter:junit-jupiter:5.+' |
| 106 | + testImplementation 'org.mockito:mockito-core:3.+' |
| 107 | + |
| 108 | + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.+' |
| 109 | + |
| 110 | + annotationProcessor "org.littletonrobotics.akit:akit-autolog:$AdvantageKitJSON.version" |
| 111 | +} |
| 112 | + |
| 113 | +test { |
| 114 | + useJUnitPlatform() |
| 115 | + systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true' |
| 116 | +} |
| 117 | + |
| 118 | +// Simulation configuration (e.g. environment variables). |
| 119 | +wpi.sim.addGui().defaultEnabled = true |
| 120 | +wpi.sim.addDriverstation() |
| 121 | + |
| 122 | +// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') |
| 123 | +// in order to make them all available at runtime. Also adding the manifest so WPILib |
| 124 | +// knows where to look for our Robot Class. |
| 125 | +jar { |
| 126 | + from { |
| 127 | + configurations.runtimeClasspath.collect { |
| 128 | + it.isDirectory() ? it : zipTree(it) |
| 129 | + } |
| 130 | + } |
| 131 | + from sourceSets.main.allSource |
| 132 | + manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) |
| 133 | + duplicatesStrategy = DuplicatesStrategy.INCLUDE |
| 134 | +} |
| 135 | + |
| 136 | +// Configure replay watch task |
| 137 | +task(replayWatch, type: JavaExec) { |
| 138 | + mainClass = "org.littletonrobotics.junction.ReplayWatch" |
| 139 | + classpath = sourceSets.main.runtimeClasspath |
| 140 | +} |
| 141 | + |
| 142 | +// Configure jar and deploy tasks |
| 143 | +deployArtifact.jarTask = jar |
| 144 | +wpi.java.configureExecutableTasks(jar) |
| 145 | +wpi.java.configureTestTasks(test) |
| 146 | + |
| 147 | +// Configure string concat to always inline compile |
| 148 | +tasks.withType(JavaCompile) { |
| 149 | + options.compilerArgs.add '-XDstringConcat=inline' |
| 150 | +} |
0 commit comments