Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…2024 into spotlessCiCheck
  • Loading branch information
BrownGenius committed Jan 9, 2024
2 parents 7e8bf97 + f433fdb commit 673a1da
Showing 1 changed file with 58 additions and 1 deletion.
59 changes: 58 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id "java"
id "edu.wpi.first.GradleRIO" version "2024.1.1"
id("com.diffplug.spotless") version "6.23.3"
}

java {
Expand Down Expand Up @@ -84,7 +85,11 @@ wpi.sim.addDriverstation()
// 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) } }
from {
configurations.runtimeClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
}
from sourceSets.main.allSource
manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS)
duplicatesStrategy = DuplicatesStrategy.INCLUDE
Expand All @@ -99,3 +104,55 @@ wpi.java.configureTestTasks(test)
tasks.withType(JavaCompile) {
options.compilerArgs.add '-XDstringConcat=inline'
}

// START: Setup spotless
spotless {
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()
}
}

if (!('spotlessCheck' in gradle.startParameter.taskNames)) {
spotlessJavaCheck.enabled = false
spotlessGroovyGradleCheck.enabled = false
spotlessXmlCheck.enabled = false
spotlessMiscCheck.enabled = false
}
// END: Setup spotless

0 comments on commit 673a1da

Please sign in to comment.