Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 31 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -189,7 +205,7 @@ spotless {
include "**/*.gradle"
exclude "**/build/**", "**/build-*/**"
}
greclipse()
greclipse('4.31')
leadingTabsToSpaces(4)
trimTrailingWhitespace()
endWithNewline()
Expand All @@ -211,3 +227,7 @@ spotless {
endWithNewline()
}
}

tasks.withType(com.diffplug.gradle.spotless.SpotlessTask).configureEach {
notCompatibleWithConfigurationCache("Spotless Equo engine relies on execution-time state unpacking")
}
Loading