diff --git a/build.gradle b/build.gradle index b9efd92..5cab379 100755 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,9 @@ plugins { id "java" id "application" - id "org.wpilib.GradleRIO" version "2027.0.0-alpha-7" + id "org.wpilib.GradleRIO" version "2027.0.0-alpha-8" id "com.peterabeles.gversion" version "1.10" - id "com.diffplug.spotless" version "8.6.0" + id "com.diffplug.spotless" version "8.10.4" } java { @@ -58,7 +58,7 @@ wpi.java.runSimWithDebugJni = false def includeDesktopSupport = true // Configuration for AdvantageKit -task(replayWatch, type: JavaExec) { +tasks.register("replayWatch", JavaExec) { mainClass = "org.littletonrobotics.junction.ReplayWatch" classpath = sourceSets.main.runtimeClasspath } @@ -133,22 +133,24 @@ gversion { indent = " " } +def projectDirectory = projectDir +def isDeployTaskIncluded = project.gradle.startParameter.taskNames.any({it.toLowerCase().contains("deploy")}) + // Create commit with working changes on event branches -task(eventDeploy) { +tasks.register("eventDeploy") { doLast { - if (project.gradle.startParameter.taskNames.any({ it.toLowerCase().contains("deploy") })) { + if (isDeployTaskIncluded) { def branchPrefix = "event" def branch = 'git branch --show-current'.execute().text.trim() def commitMessage = "Update at '${new Date().toString()}'" - if (branch.startsWith(branchPrefix)) { - exec { - workingDir(projectDir) + execOperations.exec { + workingDir(projectDirectory) executable 'git' args 'add', '-A' } - exec { - workingDir(projectDir) + execOperations.exec { + workingDir(projectDirectory) executable 'git' args 'commit', '-m', commitMessage ignoreExitValue = true @@ -171,7 +173,21 @@ def onlyOurHeaders = '(?is)\\A(?:(?!(?:(?!package ).)*(?:copyright|license|\\u00 // Spotless formatting project.compileJava.dependsOn(spotlessApply) + +spotlessPredeclare { + groovyGradle { + greclipse('4.31') + } + java { + googleJavaFormat('1.36.1') + } + json { + gson().version('2.14.0') + } +} + spotless { + predeclareDepsFromBuildscript() java { target fileTree(".") { include "**/*.java" @@ -189,7 +205,7 @@ spotless { include "**/*.gradle" exclude "**/build/**", "**/build-*/**" } - greclipse() + greclipse('4.31') leadingTabsToSpaces(4) trimTrailingWhitespace() endWithNewline() @@ -211,3 +227,7 @@ spotless { endWithNewline() } } + +tasks.withType(com.diffplug.gradle.spotless.SpotlessTask).configureEach { + notCompatibleWithConfigurationCache("Spotless Equo engine relies on execution-time state unpacking") +}