diff --git a/build.gradle b/build.gradle index f22cec9..55ff78f 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,7 @@ plugins { id "java" id "edu.wpi.first.GradleRIO" version "2026.2.1" id "com.diffplug.spotless" version "8.2.1" + id 'com.github.node-gradle.node' version '7.1.0' } java { @@ -9,6 +10,12 @@ java { targetCompatibility = JavaVersion.VERSION_17 } +node { + download = true + version = '24.13.0' + workDir = file("${buildDir}/nodejs") +} + def ROBOT_MAIN_CLASS = "org.team340.robot.Main" // Define my targets (RoboRIO) and artifacts (deployable files) @@ -92,6 +99,11 @@ dependencies { testRuntimeOnly 'org.junit.platform:junit-platform-launcher' } +def npmExec = "bin/npm" +if (System.properties['os.name'].toLowerCase().contains('windows')) { + npmExec = "npm.cmd" +} + // Code formatting via spotless spotless { java { @@ -104,7 +116,8 @@ spotless { endWithNewline() removeUnusedImports() trimTrailingWhitespace() - prettier(['prettier': '3.8.1', 'prettier-plugin-java': '2.8.1']) + prettier(['prettier': '3.8.0', 'prettier-plugin-java': '2.8.1']) + .npmExecutable("${tasks.named('npmSetup').get().npmDir.get()}${File.separator}${npmExec}") .config([ parser: 'java', plugins: ['prettier-plugin-java'], @@ -149,3 +162,7 @@ tasks.withType(JavaCompile) { options.compilerArgs.add '-XDstringConcat=inline' dependsOn 'spotlessApply' } + +tasks.matching { it.name.startsWith("spotless")}.all { + dependsOn 'nodeSetup', 'npmSetup' +} diff --git a/gradlew b/gradlew old mode 100644 new mode 100755