forked from wpilibsuite/GradleRIO
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d64b678
commit 7b6023d
Showing
3 changed files
with
60 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,100 @@ | ||
plugins { | ||
id "org.jetbrains.kotlin.jvm" version "1.3.50" | ||
id "org.jetbrains.kotlin.jvm" version "1.9.20" | ||
id "edu.wpi.first.GradleRIO" version "2024.3.2" | ||
} | ||
|
||
def projectFolder = project.buildFile.parentFile | ||
def testingFolder = projectFolder.parentFile | ||
|
||
if (testingFolder.name != 'testing' || projectFolder.name != 'kotlin') { | ||
throw new GradleException("These projects are not to be used for robot projects. See README.md in the GradleRIO testing folder for the correct templates to use.") | ||
} | ||
|
||
def ROBOT_MAIN_CLASS = "frc.team0000.robot.MainKt" | ||
|
||
// Define my targets (RoboRIO) and artifacts (deployable files) | ||
// This is added by GradleRIO's backing project DeployUtils. | ||
deploy { | ||
targets { | ||
roboRIO("roborio") { | ||
roborio(getTargetTypeClass('RoboRIO')) { | ||
// 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 = frc.getTeamNumber() | ||
} | ||
} | ||
artifacts { | ||
frcJavaArtifact('frcJava') { | ||
targets << "roborio" | ||
// Debug can be overridden by command line, for use with VSCode | ||
debug = frc.getDebugOrDefault(false) | ||
} | ||
// Built in artifact to deploy arbitrary files to the roboRIO. | ||
fileTreeArtifact('frcStaticFileDeploy') { | ||
// The directory below is the local directory to deploy | ||
files = fileTree(dir: 'src/main/deploy') | ||
// Deploy to RoboRIO target, into /home/lvuser/deploy | ||
targets << "roborio" | ||
directory = '/home/lvuser/deploy' | ||
team = project.frc.getTeamNumber() | ||
debug = project.frc.getDebugOrDefault(false) | ||
|
||
artifacts { | ||
// First part is artifact name, 2nd is artifact type | ||
// getTargetTypeClass is a shortcut to get the class type using a string | ||
|
||
frcJava(getArtifactTypeClass('FRCJavaArtifact')) { | ||
} | ||
|
||
// Static files artifact | ||
frcStaticFileDeploy(getArtifactTypeClass('FileTreeArtifact')) { | ||
files = project.fileTree('src/main/deploy') | ||
directory = '/home/lvuser/deploy' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
def deployArtifact = deploy.targets.roborio.artifacts.frcJava | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
// Defining my dependencies. In this case, WPILib (+ friends) | ||
dependencies { | ||
implementation wpi.deps.wpilib() | ||
nativeZip wpi.deps.wpilibJni(wpi.platforms.roborio) | ||
nativeDesktopZip wpi.deps.wpilibJni(wpi.platforms.desktop) | ||
implementation wpi.java.deps.wpilib() | ||
implementation wpi.java.vendor.java() | ||
|
||
roborioDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.roborio) | ||
roborioDebug wpi.java.vendor.jniDebug(wpi.platforms.roborio) | ||
|
||
compile wpi.deps.vendor.java() | ||
nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio) | ||
nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop) | ||
roborioRelease wpi.java.deps.wpilibJniRelease(wpi.platforms.roborio) | ||
roborioRelease wpi.java.vendor.jniRelease(wpi.platforms.roborio) | ||
|
||
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() | ||
|
||
// We need to add the Kotlin stdlib in order to use most Kotlin language features. | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib" | ||
} | ||
|
||
// Simulation configuration (e.g. environment variables). | ||
sim { | ||
// Sets the websocket client remote host. | ||
// envVar "HALSIMWS_HOST", "10.0.0.2" | ||
} | ||
|
||
wpi.sim.addGui().defaultEnabled = true | ||
wpi.sim.addDriverstation() | ||
|
||
//Sets the websocket client remote host. | ||
wpi.sim.envVar("HALSIMWS_HOST", "10.0.0.2") | ||
wpi.sim.addWebsocketsServer().defaultEnabled = true | ||
wpi.sim.addWebsocketsClient().defaultEnabled = true | ||
|
||
// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') | ||
// in order to make them all available at runtime. Also adding the manifest so WPILib | ||
// knows where to look for our Robot Class. | ||
jar { | ||
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } | ||
|
||
manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) | ||
|
||
duplicatesStrategy = DuplicatesStrategy.INCLUDE | ||
} | ||
|
||
deployArtifact.jarTask = jar | ||
wpi.java.configureExecutableTasks(jar) | ||
wpi.java.configureTestTasks(test) | ||
|
||
|
||
wrapper { | ||
gradleVersion = '6.8.1' | ||
gradleVersion = '8.5' | ||
distributionType = Wrapper.DistributionType.BIN | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=permwrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=permwrapper/dists |