108 lines
3.9 KiB
Groovy
108 lines
3.9 KiB
Groovy
plugins {
|
|
id "java"
|
|
id "application"
|
|
id "org.wpilib.GradleRIO" version "2027.0.0-alpha-7"
|
|
}
|
|
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_25
|
|
targetCompatibility = JavaVersion.VERSION_25
|
|
}
|
|
|
|
def ROBOT_MAIN_CLASS = "first.Main"
|
|
|
|
// Define my targets (SystemCore) and artifacts (deployable files)
|
|
// This is added by GradleRIO's backing project DeployUtils.
|
|
deploy {
|
|
targets {
|
|
systemcore(getTargetTypeClass('SystemCore')) {
|
|
// Team number is loaded either from the .wpilib/wpilib_preferences.json
|
|
// or from command line. If not found an exception will be thrown.
|
|
// You can use getTeamOrDefault(team) instead of getTeamNumber if you
|
|
// want to store a team number in this file.
|
|
team = project.wpilib.getTeamNumber()
|
|
// Use the default systemcore host name. This must be called after setting team
|
|
// as happens on the line above
|
|
useDefaultSystemcoreHostName()
|
|
debug = project.wpilib.getDebugOrDefault(false)
|
|
|
|
artifacts {
|
|
// First part is artifact name, 2nd is artifact type
|
|
// getTargetTypeClass is a shortcut to get the class type using a string
|
|
|
|
wpilibJava(getArtifactTypeClass('WPILibJavaArtifact')) {
|
|
// Set to true to use debug including JNI, which will drastically impact performance.
|
|
debugJni = false
|
|
}
|
|
|
|
// Static files artifact
|
|
wpilibStaticFileDeploy(getArtifactTypeClass('FileTreeArtifact')) {
|
|
files = project.fileTree('src/main/deploy')
|
|
directory = '/home/systemcore/deploy'
|
|
deleteOldFiles = false // Change to true to delete files on systemcore that no
|
|
// longer exist in deploy directory of this project
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
def deployArtifact = deploy.targets.systemcore.artifacts.wpilibJava
|
|
|
|
// Set to true to use debug for simulation including JNI
|
|
wpi.java.runSimWithDebugJni = false
|
|
|
|
// Set this to true to enable desktop support.
|
|
def includeDesktopSupport = true
|
|
|
|
// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries.
|
|
// Also defines JUnit 5.
|
|
dependencies {
|
|
annotationProcessor wpi.java.deps.wpilibAnnotations()
|
|
implementation wpi.java.deps.wpilib()
|
|
implementation wpi.java.vendor.java()
|
|
|
|
systemcoreDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.systemcore)
|
|
systemcoreDebug wpi.java.vendor.jniDebug(wpi.platforms.systemcore)
|
|
|
|
systemcoreRelease wpi.java.deps.wpilibJniRelease(wpi.platforms.systemcore)
|
|
systemcoreRelease wpi.java.vendor.jniRelease(wpi.platforms.systemcore)
|
|
|
|
nativeDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.desktop)
|
|
nativeDebug wpi.java.vendor.jniDebug(wpi.platforms.desktop)
|
|
simulationDebug wpi.sim.enableDebug()
|
|
|
|
nativeRelease wpi.java.deps.wpilibJniRelease(wpi.platforms.desktop)
|
|
nativeRelease wpi.java.vendor.jniRelease(wpi.platforms.desktop)
|
|
simulationRelease wpi.sim.enableRelease()
|
|
|
|
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1'
|
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true'
|
|
}
|
|
|
|
// Simulation configuration (e.g. environment variables).
|
|
wpi.sim.addGui().defaultEnabled = true
|
|
wpi.sim.addDriverstation()
|
|
|
|
application.mainClass = ROBOT_MAIN_CLASS
|
|
|
|
deployArtifact.configureApplication(application)
|
|
wpi.java.configureApplication(application)
|
|
wpi.java.configureTestTasks(test)
|
|
|
|
jar {
|
|
from('src') { into 'backup/src' }
|
|
from('vendordeps') { into 'backup/vendordeps' }
|
|
from('build.gradle') { into 'backup' }
|
|
}
|
|
|
|
// Configure string concat to always inline compile
|
|
tasks.withType(JavaCompile) {
|
|
options.compilerArgs.add '-XDstringConcat=inline'
|
|
}
|