Skip to content

Commit 82f3fc2

Browse files
committed
Upgrade checkstyle and spotbugs tooling
1 parent 4bf1a51 commit 82f3fc2

4 files changed

Lines changed: 66 additions & 7 deletions

File tree

.github/workflows/main.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,60 @@ on:
5757
types: [published]
5858

5959
jobs:
60+
Checkstyle:
61+
name: Run Checkstyle
62+
runs-on: ubuntu-latest
63+
continue-on-error: true
64+
permissions:
65+
contents: read
66+
steps:
67+
- uses: actions/checkout@v6.0.2
68+
- name: Setup the java environment
69+
uses: actions/setup-java@v5.2.0
70+
with:
71+
distribution: 'temurin'
72+
java-version: '21'
73+
- name: Validate the Gradle wrapper
74+
uses: gradle/actions/wrapper-validation@v5.0.2
75+
- name: Run Checkstyle
76+
run: |
77+
./gradlew checkstyleMain checkstyleTest --console=plain --stacktrace
78+
- name: Upload Checkstyle Reports
79+
uses: actions/upload-artifact@v7.0.0
80+
if: always()
81+
with:
82+
name: checkstyle-report
83+
retention-days: 30
84+
path: |
85+
**/build/reports/checkstyle/**
86+
87+
SpotBugs:
88+
name: Run SpotBugs
89+
runs-on: ubuntu-latest
90+
continue-on-error: true
91+
permissions:
92+
contents: read
93+
steps:
94+
- uses: actions/checkout@v6.0.2
95+
- name: Setup the java environment
96+
uses: actions/setup-java@v5.2.0
97+
with:
98+
distribution: 'temurin'
99+
java-version: '21'
100+
- name: Validate the Gradle wrapper
101+
uses: gradle/actions/wrapper-validation@v5.0.2
102+
- name: Run SpotBugs
103+
run: |
104+
./gradlew -PenableSpotBugs=true spotbugsMain spotbugsTest --console=plain --stacktrace
105+
- name: Upload SpotBugs Reports
106+
uses: actions/upload-artifact@v7.0.0
107+
if: always()
108+
with:
109+
name: spotbugs-report
110+
retention-days: 30
111+
path: |
112+
**/build/reports/spotbugs/**
113+
60114
ScreenshotTests:
61115
name: Run Screenshot Tests
62116
runs-on: ubuntu-latest
@@ -234,6 +288,7 @@ jobs:
234288
run: |
235289
# Normal build plus ZIP distribution and merged javadoc
236290
./gradlew -PuseCommitHashAsVersionName=true -PskipPrebuildLibraries=true \
291+
-x checkstyleMain -x checkstyleTest \
237292
build createZipDistribution mergedJavadoc
238293
239294
if [ "${{ matrix.deploy }}" = "true" ];

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ subprojects {
4646
// Currently we only warn about issues and try to fix them as we go, but those aren't mission critical.
4747
spotbugs {
4848
ignoreFailures = true
49-
toolVersion = '4.8.6'
49+
toolVersion = libs.versions.spotbugs.get()
5050
}
5151

5252
tasks.withType(com.github.spotbugs.snom.SpotBugsTask ) {
5353
reports {
54-
html.enabled = !project.hasProperty("xml-reports")
55-
xml.enabled = project.hasProperty("xml-reports")
54+
html.required = !project.hasProperty("xml-reports")
55+
xml.required = project.hasProperty("xml-reports")
5656
}
5757
}
5858
}
@@ -242,4 +242,4 @@ if (skipPrebuildLibraries != "true" && buildNativeProjects != "true") {
242242

243243
assemble.dependsOn extractPrebuiltNatives
244244
}
245-
}
245+
}

common.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ tasks.withType(Sign) {
208208
onlyIf { gradle.rootProject.hasProperty('signingKey') }
209209
}
210210

211+
def checkstyleSupported = JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_21)
212+
211213
checkstyle {
212214
toolVersion libs.versions.checkstyle.get()
213215
configFile file("${gradle.rootProject.rootDir}/config/checkstyle/checkstyle.xml")
@@ -222,9 +224,10 @@ checkstyleTest {
222224
}
223225

224226
tasks.withType(Checkstyle) {
227+
enabled = checkstyleSupported
225228
reports {
226229
xml.required.set(false)
227230
html.required.set(true)
228231
}
229232
include("**/com/jme3/renderer/**/*.java")
230-
}
233+
}

gradle/libs.versions.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
[versions]
44

5-
checkstyle = "9.3"
5+
checkstyle = "13.3.0"
66
lwjgl3 = "3.4.1"
77
nifty = "1.4.3"
8+
spotbugs = "4.9.8"
89

910
[libraries]
1011

@@ -40,7 +41,7 @@ nifty-default-controls = { module = "com.github.nifty-gui:nifty-default-controls
4041
nifty-examples = { module = "com.github.nifty-gui:nifty-examples", version.ref = "nifty" }
4142
nifty-style-black = { module = "com.github.nifty-gui:nifty-style-black", version.ref = "nifty" }
4243

43-
spotbugs-gradle-plugin = "com.github.spotbugs.snom:spotbugs-gradle-plugin:6.0.18"
44+
spotbugs-gradle-plugin = "com.github.spotbugs.snom:spotbugs-gradle-plugin:6.4.8"
4445
vecmath = "javax.vecmath:vecmath:1.5.2"
4546

4647
[bundles]

0 commit comments

Comments
 (0)