-
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.
Fixes #8
- Loading branch information
Showing
3 changed files
with
155 additions
and
93 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Our code formatter, Spotless, checks that file line endings match whatever | ||
# Git thinks they should be. Unfortunately, Git's default thinking is that | ||
# lines should follow the platform's native line ending: see | ||
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreeol. | ||
# Git has this thought rattling around in the back of its mind even when | ||
# automatic line ending convertion (`core.autocrlf`) is turned off (`false`). | ||
# When Spotless rolls up and asks Git what it thinks on a Windows system, it'll | ||
# say “CRLF” (assuming the user hasn't overridden `core.eol`), even when all of | ||
# the checked-out files are LF-terminated. So Spotless will throw an error for | ||
# every. Single. Line of source. | ||
*.gradle text eol=crlf | ||
*.java text eol=crlf | ||
*.md text eol=crlf |
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,92 +1,137 @@ | ||
import edu.wpi.first.gradlerio.deploy.roborio.RoboRIO | ||
|
||
plugins { | ||
id "java" | ||
id "edu.wpi.first.GradleRIO" version "2022.3.1" | ||
} | ||
|
||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
|
||
def ROBOT_MAIN_CLASS = "frc.robot.Main" | ||
|
||
// Define my targets (RoboRIO) and artifacts (deployable files) | ||
// This is added by GradleRIO's backing project DeployUtils. | ||
deploy { | ||
targets { | ||
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 = 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 | ||
|
||
// This has to be after the deploy block for the dependencies to work. | ||
apply from: "splash.gradle" | ||
|
||
// Set to true to use debug for JNI. | ||
wpi.java.debugJni = false | ||
|
||
// Set this to true to enable desktop support. | ||
def includeDesktopSupport = false | ||
|
||
// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. | ||
// Also defines JUnit 4. | ||
dependencies { | ||
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) | ||
|
||
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() | ||
|
||
testImplementation 'junit:junit:4.12' | ||
} | ||
|
||
// Simulation configuration (e.g. environment variables). | ||
wpi.sim.addGui().defaultEnabled = true | ||
wpi.sim.addDriverstation() | ||
|
||
// 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 | ||
} | ||
|
||
// Configure jar and deploy tasks | ||
deployArtifact.jarTask = jar | ||
wpi.java.configureExecutableTasks(jar) | ||
wpi.java.configureTestTasks(test) | ||
import edu.wpi.first.gradlerio.deploy.roborio.RoboRIO | ||
|
||
plugins { | ||
id "java" | ||
id "edu.wpi.first.GradleRIO" version "2022.3.1" | ||
id "com.diffplug.spotless" version "6.1.0" | ||
} | ||
|
||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
|
||
def ROBOT_MAIN_CLASS = "frc.robot.Main" | ||
|
||
// Define my targets (RoboRIO) and artifacts (deployable files) | ||
// This is added by GradleRIO's backing project DeployUtils. | ||
deploy { | ||
targets { | ||
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 = 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 | ||
|
||
// This has to be after the deploy block for the dependencies to work. | ||
apply from: "splash.gradle" | ||
|
||
// Set to true to use debug for JNI. | ||
wpi.java.debugJni = false | ||
|
||
// Set this to true to enable desktop support. | ||
def includeDesktopSupport = false | ||
|
||
// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. | ||
// Also defines JUnit 4. | ||
dependencies { | ||
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) | ||
|
||
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() | ||
|
||
testImplementation 'junit:junit:4.12' | ||
} | ||
|
||
// Simulation configuration (e.g. environment variables). | ||
wpi.sim.addGui().defaultEnabled = true | ||
wpi.sim.addDriverstation() | ||
|
||
// 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 | ||
} | ||
|
||
// Configure jar and deploy tasks | ||
deployArtifact.jarTask = jar | ||
wpi.java.configureExecutableTasks(jar) | ||
wpi.java.configureTestTasks(test) | ||
|
||
spotless { | ||
ratchetFrom 'origin/main' //only format files which have changed since origin/main | ||
java { | ||
target fileTree('.') { | ||
include '**/*.java' | ||
exclude '**/build/**', '**/build-*/**' | ||
} | ||
toggleOffOn() | ||
googleJavaFormat() | ||
removeUnusedImports() | ||
trimTrailingWhitespace() | ||
endWithNewline() | ||
} | ||
groovyGradle { | ||
target fileTree('.') { | ||
include '**/*.gradle' | ||
exclude '**/build/**', '**/build-*/**' | ||
} | ||
greclipse() | ||
indentWithSpaces(4) | ||
trimTrailingWhitespace() | ||
endWithNewline() | ||
} | ||
format 'xml', { | ||
target fileTree('.') { | ||
include '**/*.xml' | ||
exclude '**/build/**', '**/build-*/**' | ||
} | ||
eclipseWtp('xml') | ||
trimTrailingWhitespace() | ||
indentWithSpaces(2) | ||
endWithNewline() | ||
} | ||
format 'misc', { | ||
target fileTree('.') { | ||
include '**/*.md', '**/.gitignore' | ||
exclude '**/build/**', '**/build-*/**' | ||
} | ||
trimTrailingWhitespace() | ||
indentWithSpaces(2) | ||
endWithNewline() | ||
} | ||
} |