From 1f78412810a2f325993b05ae026ce558683dc717 Mon Sep 17 00:00:00 2001 From: Goooler Date: Sun, 26 Nov 2023 13:11:57 +0800 Subject: [PATCH 1/3] Bump SpotBugs plugin to 5.2.3 https://github.com/spotbugs/spotbugs-gradle-plugin/releases/tag/5.2.3 https://github.com/spotbugs/spotbugs-gradle-plugin?tab=readme-ov-file#refer-the-version-in-the-build-script --- gradle.properties | 1 - gradle/java-setup.gradle | 9 +-------- settings.gradle | 2 +- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/gradle.properties b/gradle.properties index c65ea39f94..b60fa2f805 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,7 +21,6 @@ artifactIdGradle=spotless-plugin-gradle # Build requirements VER_JAVA=11 -VER_SPOTBUGS=4.7.3 VER_JSR_305=3.0.2 # Dependencies provided by Spotless plugin diff --git a/gradle/java-setup.gradle b/gradle/java-setup.gradle index 5a1e23ef0a..91f2f13e8c 100644 --- a/gradle/java-setup.gradle +++ b/gradle/java-setup.gradle @@ -14,7 +14,6 @@ tasks.withType(JavaCompile).configureEach { ////////////// apply plugin: 'com.github.spotbugs' spotbugs { - toolVersion = VER_SPOTBUGS ignoreFailures = false // bug free or it doesn't ship! reportLevel = 'medium' // low|medium|high (low = sensitive to even minor mistakes) omitVisitors = [ @@ -30,16 +29,10 @@ tasks.withType(com.github.spotbugs.snom.SpotBugsTask).configureEach { reports { html.enabled = true } - notCompatibleWithConfigurationCache("https://github.com/spotbugs/spotbugs-gradle-plugin/issues/670") } -tasks.named('spotbugsMain') { - reports { - html.enabled = true - } -} dependencies { compileOnly 'net.jcip:jcip-annotations:1.0' - compileOnly "com.github.spotbugs:spotbugs-annotations:${VER_SPOTBUGS}" + compileOnly "com.github.spotbugs:spotbugs-annotations:${spotbugs.toolVersion.get()}" compileOnly "com.google.code.findbugs:jsr305:${VER_JSR_305}" } diff --git a/settings.gradle b/settings.gradle index e7b9649cf3..e7e5a6d4ea 100644 --- a/settings.gradle +++ b/settings.gradle @@ -12,7 +12,7 @@ plugins { // https://github.com/gradle-nexus/publish-plugin/releases id 'io.github.gradle-nexus.publish-plugin' version '1.3.0' apply false // https://github.com/spotbugs/spotbugs-gradle-plugin/releases - id 'com.github.spotbugs' version '5.2.1' apply false + id 'com.github.spotbugs' version '5.2.3' apply false // https://github.com/diffplug/spotless-changelog/blob/main/CHANGELOG.md id 'com.diffplug.spotless-changelog' version '3.0.2' apply false // https://github.com/diffplug/goomph/blob/main/CHANGES.md From dd344320b5183a20d175d79f3766bde735c8d784 Mon Sep 17 00:00:00 2001 From: Goooler Date: Sun, 26 Nov 2023 15:28:57 +0800 Subject: [PATCH 2/3] Omit ConstructorThrow visitor https://spotbugs.readthedocs.io/en/latest/detectors.html#constructorthrow --- gradle/java-setup.gradle | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gradle/java-setup.gradle b/gradle/java-setup.gradle index 91f2f13e8c..b152097653 100644 --- a/gradle/java-setup.gradle +++ b/gradle/java-setup.gradle @@ -17,7 +17,11 @@ spotbugs { ignoreFailures = false // bug free or it doesn't ship! reportLevel = 'medium' // low|medium|high (low = sensitive to even minor mistakes) omitVisitors = [ - 'FindReturnRef'] // https://spotbugs.readthedocs.io/en/latest/detectors.html#findreturnref + // https://spotbugs.readthedocs.io/en/latest/detectors.html#constructorthrow + 'ConstructorThrow', + // https://spotbugs.readthedocs.io/en/latest/detectors.html#findreturnref + 'FindReturnRef', + ] } tasks.named('spotbugsTest') { enabled = false From 1031d15db96d159e42614532883d5f1319ffc206 Mon Sep 17 00:00:00 2001 From: Goooler Date: Sun, 26 Nov 2023 15:55:00 +0800 Subject: [PATCH 3/3] Defer Jar task configuration --- lib-extra/build.gradle | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib-extra/build.gradle b/lib-extra/build.gradle index 07135ff726..e6524f76bf 100644 --- a/lib-extra/build.gradle +++ b/lib-extra/build.gradle @@ -56,16 +56,16 @@ for (needsP2 in NEEDS_P2_DEPS) { add("${needsP2}CompileOnly", "dev.equo.ide:solstice:${VER_SOLSTICE}") } } -jar { + +def jar = tasks.named('jar', Jar) { for (needsP2 in NEEDS_P2_DEPS) { - from sourceSets.getByName(needsP2).output.classesDirs + from sourceSets.named(needsP2).map { it.output.classesDirs } } } + tasks.withType(Test).configureEach { dependsOn jar - doFirst { - classpath += jar.outputs.files - } + classpath += jar.get().outputs.files } apply plugin: 'dev.equo.p2deps'