mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Bump spotless version and update config for groovyGradle stuff (#979)
This commit is contained in:
38
build.gradle
38
build.gradle
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id "com.diffplug.spotless" version "6.19.0"
|
||||
id "com.diffplug.spotless" version "6.22.0"
|
||||
id "com.github.johnrengelman.shadow" version "7.1.2"
|
||||
id "com.github.node-gradle.node" version "3.1.1" apply false
|
||||
id "edu.wpi.first.GradleJni" version "1.1.0"
|
||||
@@ -49,6 +49,10 @@ wpilibTools.deps.wpilibVersion = wpilibVersion
|
||||
|
||||
spotless {
|
||||
java {
|
||||
target fileTree('.') {
|
||||
include '**/*.java'
|
||||
exclude '**/build/**', '**/build-*/**', "photon-core\\src\\main\\java\\org\\photonvision\\PhotonVersion.java", "photon-lib\\src\\main\\java\\org\\photonvision\\PhotonVersion.java"
|
||||
}
|
||||
toggleOffOn()
|
||||
googleJavaFormat()
|
||||
indentWithTabs(2)
|
||||
@@ -57,10 +61,34 @@ spotless {
|
||||
trimTrailingWhitespace()
|
||||
endWithNewline()
|
||||
}
|
||||
java {
|
||||
target "**/*.java"
|
||||
targetExclude("photon-core/src/main/java/org/photonvision/PhotonVersion.java")
|
||||
targetExclude("photon-lib/src/main/java/org/photonvision/PhotonVersion.java")
|
||||
groovyGradle {
|
||||
target fileTree('.') {
|
||||
include '**/*.gradle'
|
||||
exclude '**/build/**', '**/build-*/**'
|
||||
}
|
||||
greclipse()
|
||||
indentWithSpaces(4)
|
||||
trimTrailingWhitespace()
|
||||
endWithNewline()
|
||||
}
|
||||
format 'xml', {
|
||||
target fileTree('.') {
|
||||
include '**/*.xml'
|
||||
exclude '**/build/**', '**/build-*/**', "**/.idea/**"
|
||||
}
|
||||
eclipseWtp('xml')
|
||||
trimTrailingWhitespace()
|
||||
indentWithSpaces(2)
|
||||
endWithNewline()
|
||||
}
|
||||
format 'misc', {
|
||||
target fileTree('.') {
|
||||
include '**/*.md', '**/.gitignore'
|
||||
exclude '**/build/**', '**/build-*/**'
|
||||
}
|
||||
trimTrailingWhitespace()
|
||||
indentWithSpaces(2)
|
||||
endWithNewline()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -120,17 +120,17 @@ task generateVendorJson() {
|
||||
outputs.file photonlibFileOutput
|
||||
inputs.file photonlibFileInput
|
||||
|
||||
println "Writing vendor JSON ${pubVersion} to $photonlibFileOutput"
|
||||
println "Writing vendor JSON ${pubVersion} to $photonlibFileOutput"
|
||||
|
||||
if (photonlibFileOutput.exists()) {
|
||||
photonlibFileOutput.delete()
|
||||
}
|
||||
photonlibFileOutput.parentFile.mkdirs()
|
||||
if (photonlibFileOutput.exists()) {
|
||||
photonlibFileOutput.delete()
|
||||
}
|
||||
photonlibFileOutput.parentFile.mkdirs()
|
||||
|
||||
def read = photonlibFileInput.text
|
||||
def read = photonlibFileInput.text
|
||||
.replace('${photon_version}', pubVersion)
|
||||
.replace('${frc_year}', frcYear)
|
||||
photonlibFileOutput.text = read
|
||||
photonlibFileOutput.text = read
|
||||
|
||||
outputs.upToDateWhen { false }
|
||||
}
|
||||
|
||||
@@ -50,7 +50,9 @@ dependencies {
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
configurations = [project.configurations.runtimeClasspath]
|
||||
configurations = [
|
||||
project.configurations.runtimeClasspath
|
||||
]
|
||||
String name = "photonvision-${project.version}"
|
||||
archiveClassifier.set(wpilibTools.platformMapper.currentPlatform.platformName)
|
||||
archiveBaseName = "photonvision"
|
||||
@@ -81,11 +83,11 @@ copyClientUIToResources.shouldRunAfter runNpmOnClient
|
||||
run {
|
||||
if (project.hasProperty("profile")) {
|
||||
jvmArgs=[
|
||||
"-Dcom.sun.management.jmxremote=true",
|
||||
"-Dcom.sun.management.jmxremote.ssl=false",
|
||||
"-Dcom.sun.management.jmxremote.authenticate=false",
|
||||
"-Dcom.sun.management.jmxremote.port=5000",
|
||||
"-Djava.rmi.server.hostname=0.0.0.0",
|
||||
"-Dcom.sun.management.jmxremote=true",
|
||||
"-Dcom.sun.management.jmxremote.ssl=false",
|
||||
"-Dcom.sun.management.jmxremote.authenticate=false",
|
||||
"-Dcom.sun.management.jmxremote.port=5000",
|
||||
"-Djava.rmi.server.hostname=0.0.0.0",
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -143,7 +145,7 @@ task findDeployTarget {
|
||||
}
|
||||
|
||||
run {
|
||||
environment "PATH_PREFIX", "../"
|
||||
environment "PATH_PREFIX", "../"
|
||||
}
|
||||
|
||||
// task overrideToPi {
|
||||
@@ -159,7 +161,7 @@ task deploy {
|
||||
dependsOn assemble
|
||||
dependsOn findDeployTarget
|
||||
|
||||
doLast {
|
||||
doLast {
|
||||
println 'Starting deployment to ' + findDeployTarget.rmt.host
|
||||
println 'targetArch = ' + wpilibTools.platformMapper.currentPlatform.platformName
|
||||
ssh.run{
|
||||
@@ -170,7 +172,7 @@ task deploy {
|
||||
execute 'sleep 3'
|
||||
// Copy into a folder owned by PI. Mostly because, as far as I can tell, the put command doesn't support sudo.
|
||||
put from: "${projectDir}/build/libs/photonvision-${project.version}-${wpilibTools.platformMapper.currentPlatform.platformName}.jar", into: "/tmp/photonvision.jar"
|
||||
//belt-and-suspenders. Make sure the old jar is gone first.
|
||||
//belt-and-suspenders. Make sure the old jar is gone first.
|
||||
execute 'sudo rm -f /opt/photonvision/photonvision.jar'
|
||||
//Copy in the new .jar and make sure it's executable
|
||||
execute 'sudo mv /tmp/photonvision.jar /opt/photonvision/photonvision.jar'
|
||||
|
||||
@@ -4,11 +4,11 @@ def EXCLUDED_DIRS = ["bin", "build"]
|
||||
|
||||
// List all non-hidden directories not in EXCUDED_DIRS
|
||||
ext.exampleFolderNames = file("${rootDir}")
|
||||
.listFiles()
|
||||
.findAll {
|
||||
return (it.isDirectory()
|
||||
&& !it.isHidden()
|
||||
&& !(it.name in EXCLUDED_DIRS) && !it.name.startsWith(".")
|
||||
&& it.toPath().resolve("build.gradle").toFile().exists())
|
||||
}
|
||||
.collect { it.name }
|
||||
.listFiles()
|
||||
.findAll {
|
||||
return (it.isDirectory()
|
||||
&& !it.isHidden()
|
||||
&& !(it.name in EXCLUDED_DIRS) && !it.name.startsWith(".")
|
||||
&& it.toPath().resolve("build.gradle").toFile().exists())
|
||||
}
|
||||
.collect { it.name }
|
||||
|
||||
@@ -78,7 +78,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)
|
||||
}
|
||||
}
|
||||
manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS)
|
||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||
}
|
||||
|
||||
@@ -78,7 +78,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)
|
||||
}
|
||||
}
|
||||
manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS)
|
||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ def EXCLUDED_DIRS = ["bin", "build"]
|
||||
|
||||
// List all non-hidden directories not in EXCUDED_DIRS
|
||||
ext.exampleFolderNames = file("${rootDir}")
|
||||
.listFiles()
|
||||
.findAll {
|
||||
return (it.isDirectory()
|
||||
&& !it.isHidden()
|
||||
&& !(it.name in EXCLUDED_DIRS) && !it.name.startsWith(".")
|
||||
&& it.toPath().resolve("build.gradle").toFile().exists())
|
||||
}
|
||||
.collect { it.name }
|
||||
.listFiles()
|
||||
.findAll {
|
||||
return (it.isDirectory()
|
||||
&& !it.isHidden()
|
||||
&& !(it.name in EXCLUDED_DIRS) && !it.name.startsWith(".")
|
||||
&& it.toPath().resolve("build.gradle").toFile().exists())
|
||||
}
|
||||
.collect { it.name }
|
||||
|
||||
@@ -78,7 +78,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)
|
||||
}
|
||||
}
|
||||
manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS)
|
||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||
}
|
||||
|
||||
@@ -78,7 +78,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)
|
||||
}
|
||||
}
|
||||
manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS)
|
||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||
}
|
||||
|
||||
@@ -78,7 +78,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)
|
||||
}
|
||||
}
|
||||
manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS)
|
||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ jacocoTestReport {
|
||||
afterEvaluate {
|
||||
classDirectories.setFrom(files(classDirectories.files.collect {
|
||||
fileTree(dir: it,
|
||||
exclude: "edu/wpi/**"
|
||||
exclude: "edu/wpi/**"
|
||||
)
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ ext.createComponentZipTasks = { components, names, base, type, project, func ->
|
||||
if (it in NativeLibrarySpec && stringNames.contains(it.name)) {
|
||||
it.binaries.each {
|
||||
if (!it.buildable) return
|
||||
def target = nativeUtils.getPublishClassifier(it)
|
||||
def target = nativeUtils.getPublishClassifier(it)
|
||||
if (configMap.containsKey(target)) {
|
||||
configMap.get(target).add(it)
|
||||
} else {
|
||||
@@ -128,7 +128,7 @@ ext.createAllCombined = { list, name, base, type, project ->
|
||||
|
||||
list.each {
|
||||
if (it.name.endsWith('debug')) return
|
||||
from project.zipTree(it.archiveFile)
|
||||
from project.zipTree(it.archiveFile)
|
||||
dependsOn it
|
||||
}
|
||||
}
|
||||
@@ -140,7 +140,6 @@ ext.createAllCombined = { list, name, base, type, project ->
|
||||
}
|
||||
|
||||
return task
|
||||
|
||||
}
|
||||
|
||||
// Create the standard ZIP format for the dependencies.
|
||||
|
||||
@@ -3,7 +3,8 @@ import java.time.LocalDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
|
||||
gradle.allprojects {
|
||||
ext.getCurrentVersion = { ->
|
||||
ext.getCurrentVersion = {
|
||||
->
|
||||
def stdout = new ByteArrayOutputStream()
|
||||
String tagIsh
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user