Skip to content
Open
Show file tree
Hide file tree
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
55 changes: 55 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,60 @@ on:
types: [published]

jobs:
Checkstyle:
name: Run Checkstyle
runs-on: ubuntu-latest
continue-on-error: true
permissions:
contents: read
steps:
- uses: actions/checkout@v6.0.2
- name: Setup the java environment
uses: actions/setup-java@v5.2.0
with:
distribution: 'temurin'
java-version: '21'
- name: Validate the Gradle wrapper
uses: gradle/actions/wrapper-validation@v5.0.2
- name: Run Checkstyle
run: |
./gradlew checkstyleMain checkstyleTest --console=plain --stacktrace
- name: Upload Checkstyle Reports
uses: actions/upload-artifact@v7.0.0
if: always()
with:
name: checkstyle-report
retention-days: 30
path: |
**/build/reports/checkstyle/**

SpotBugs:
name: Run SpotBugs
runs-on: ubuntu-latest
continue-on-error: true
permissions:
contents: read
steps:
- uses: actions/checkout@v6.0.2
- name: Setup the java environment
uses: actions/setup-java@v5.2.0
with:
distribution: 'temurin'
java-version: '21'
- name: Validate the Gradle wrapper
uses: gradle/actions/wrapper-validation@v5.0.2
- name: Run SpotBugs
run: |
./gradlew -PenableSpotBugs=true spotbugsMain spotbugsTest --console=plain --stacktrace
- name: Upload SpotBugs Reports
uses: actions/upload-artifact@v7.0.0
if: always()
with:
name: spotbugs-report
retention-days: 30
path: |
**/build/reports/spotbugs/**

ScreenshotTests:
name: Run Screenshot Tests
runs-on: ubuntu-latest
Expand Down Expand Up @@ -234,6 +288,7 @@ jobs:
run: |
# Normal build plus ZIP distribution and merged javadoc
./gradlew -PuseCommitHashAsVersionName=true -PskipPrebuildLibraries=true \
-x checkstyleMain -x checkstyleTest \
build createZipDistribution mergedJavadoc

if [ "${{ matrix.deploy }}" = "true" ];
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ subprojects {
// Currently we only warn about issues and try to fix them as we go, but those aren't mission critical.
spotbugs {
ignoreFailures = true
toolVersion = '4.8.6'
toolVersion = libs.versions.spotbugs.get()
}

tasks.withType(com.github.spotbugs.snom.SpotBugsTask ) {
reports {
html.enabled = !project.hasProperty("xml-reports")
xml.enabled = project.hasProperty("xml-reports")
html.required = !project.hasProperty("xml-reports")
xml.required = project.hasProperty("xml-reports")
}
}
Comment on lines 52 to 57
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The Spotbugs tasks are not guarded by a Java version check, unlike the Checkstyle tasks in common.gradle. Since Spotbugs 4.8+ and its Gradle plugin 6.x require at least Java 17, running these tasks on older JDKs will cause the build to fail. Adding an enabled check ensures the tasks are skipped gracefully on unsupported environments, which aligns with the "non-blocking" goal stated in the PR description.

        tasks.withType(com.github.spotbugs.snom.SpotBugsTask) {
            enabled = JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)
            reports {
                html.required = !project.hasProperty("xml-reports")
                xml.required = project.hasProperty("xml-reports")
            }
        }

}
Expand Down Expand Up @@ -242,4 +242,4 @@ if (skipPrebuildLibraries != "true" && buildNativeProjects != "true") {

assemble.dependsOn extractPrebuiltNatives
}
}
}
5 changes: 4 additions & 1 deletion common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ tasks.withType(Sign) {
onlyIf { gradle.rootProject.hasProperty('signingKey') }
}

def checkstyleSupported = JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_21)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New version of checkstyle requires jdk 21+.


checkstyle {
toolVersion libs.versions.checkstyle.get()
configFile file("${gradle.rootProject.rootDir}/config/checkstyle/checkstyle.xml")
Expand All @@ -222,9 +224,10 @@ checkstyleTest {
}

tasks.withType(Checkstyle) {
enabled = checkstyleSupported
reports {
xml.required.set(false)
html.required.set(true)
}
include("**/com/jme3/renderer/**/*.java")
}
}
5 changes: 3 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

[versions]

checkstyle = "9.3"
checkstyle = "13.3.0"
lwjgl3 = "3.4.1"
nifty = "1.4.3"
spotbugs = "4.9.8"

[libraries]

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

spotbugs-gradle-plugin = "com.github.spotbugs.snom:spotbugs-gradle-plugin:6.0.18"
spotbugs-gradle-plugin = "com.github.spotbugs.snom:spotbugs-gradle-plugin:6.4.8"
vecmath = "javax.vecmath:vecmath:1.5.2"

[bundles]
Expand Down
Loading