From 7ca11bf0b795c49ab0d7f84f2b61d1557289e99b Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Wed, 5 Apr 2023 17:31:17 -0700 Subject: [PATCH 1/6] Bump default Eclipse JDT to 4.27 (for java 17). --- .../diffplug/spotless/extra/java/EclipseJdtFormatterStep.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib-extra/src/main/java/com/diffplug/spotless/extra/java/EclipseJdtFormatterStep.java b/lib-extra/src/main/java/com/diffplug/spotless/extra/java/EclipseJdtFormatterStep.java index 4a90a40832..cd766fc8c8 100644 --- a/lib-extra/src/main/java/com/diffplug/spotless/extra/java/EclipseJdtFormatterStep.java +++ b/lib-extra/src/main/java/com/diffplug/spotless/extra/java/EclipseJdtFormatterStep.java @@ -31,7 +31,7 @@ public final class EclipseJdtFormatterStep { private EclipseJdtFormatterStep() {} private static final String NAME = "eclipse jdt formatter"; - private static final Jvm.Support JVM_SUPPORT = Jvm. support(NAME).add(11, "4.26"); + private static final Jvm.Support JVM_SUPPORT = Jvm. support(NAME).add(11, "4.26").add(17, "4.27"); public static String defaultVersion() { return JVM_SUPPORT.getRecommendedFormatterVersion(); From 9238bfd7a6ed5e7c7d0a903cbc6d380936d6db1d Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Wed, 5 Apr 2023 17:31:27 -0700 Subject: [PATCH 2/6] Bump default Eclipse Groovy to 4.27 (for java 17). --- .../diffplug/spotless/extra/groovy/GrEclipseFormatterStep.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib-extra/src/main/java/com/diffplug/spotless/extra/groovy/GrEclipseFormatterStep.java b/lib-extra/src/main/java/com/diffplug/spotless/extra/groovy/GrEclipseFormatterStep.java index fd3c8b7d8b..3b57df889b 100644 --- a/lib-extra/src/main/java/com/diffplug/spotless/extra/groovy/GrEclipseFormatterStep.java +++ b/lib-extra/src/main/java/com/diffplug/spotless/extra/groovy/GrEclipseFormatterStep.java @@ -32,7 +32,7 @@ public final class GrEclipseFormatterStep { private GrEclipseFormatterStep() {} private static final String NAME = "eclipse groovy formatter"; - private static final Jvm.Support JVM_SUPPORT = Jvm. support(NAME).add(11, "4.26"); + private static final Jvm.Support JVM_SUPPORT = Jvm. support(NAME).add(11, "4.26").add(17, "4.27"); public static String defaultVersion() { return JVM_SUPPORT.getRecommendedFormatterVersion(); From cfe9084169b59cca568c5728a1b9d1afda1b5b63 Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Wed, 5 Apr 2023 17:31:44 -0700 Subject: [PATCH 3/6] Bump default Eclipse CDT to 4.27 (for java 17). --- .../diffplug/spotless/extra/cpp/EclipseCdtFormatterStep.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib-extra/src/main/java/com/diffplug/spotless/extra/cpp/EclipseCdtFormatterStep.java b/lib-extra/src/main/java/com/diffplug/spotless/extra/cpp/EclipseCdtFormatterStep.java index 9f9d591c3c..bcbb58c0f6 100644 --- a/lib-extra/src/main/java/com/diffplug/spotless/extra/cpp/EclipseCdtFormatterStep.java +++ b/lib-extra/src/main/java/com/diffplug/spotless/extra/cpp/EclipseCdtFormatterStep.java @@ -37,7 +37,7 @@ public final class EclipseCdtFormatterStep { private EclipseCdtFormatterStep() {} private static final String NAME = "eclipse cdt formatter"; - private static final Jvm.Support JVM_SUPPORT = Jvm. support(NAME).add(11, "10.7").add(17, "11.0"); + private static final Jvm.Support JVM_SUPPORT = Jvm. support(NAME).add(11, "10.7").add(17, "11.1"); public static String defaultVersion() { return JVM_SUPPORT.getRecommendedFormatterVersion(); From ddc82c17830eb61c93aa10928694d685832360e4 Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Wed, 5 Apr 2023 18:45:12 -0700 Subject: [PATCH 4/6] Update changelogs. --- CHANGES.md | 4 ++++ plugin-gradle/CHANGES.md | 4 ++++ plugin-maven/CHANGES.md | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index cc6b21e399..7e869a2e1b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -21,6 +21,10 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( * Bump default `flexmark` version `0.62.2` -> `0.64.0`. ([#1302](https://github.com/diffplug/spotless/pull/1302)) * Bump default `googleJavaFormat` version `1.15.0` -> `1.16.0`. ([#1630](https://github.com/diffplug/spotless/pull/1630)) * Bump default `scalafmt` version `3.7.1` -> `3.7.3`. ([#1584](https://github.com/diffplug/spotless/pull/1584)) +* Bump default Eclipse formatters for the 2023-03 release. ([#1662](https://github.com/diffplug/spotless/pull/1662)) + * JDT and GrEclipse `4.26` -> `4.27` + * Improve GrEclipse error reporting. ([#1660](https://github.com/diffplug/spotless/pull/1660)) + * CDT `11.0` -> `11.1` ## [2.37.0] - 2023-03-13 ### Added diff --git a/plugin-gradle/CHANGES.md b/plugin-gradle/CHANGES.md index 7ad64c04b2..6d96095bab 100644 --- a/plugin-gradle/CHANGES.md +++ b/plugin-gradle/CHANGES.md @@ -26,6 +26,10 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( * Bump default `flexmark` version `0.62.2` -> `0.64.0`. ([#1302](https://github.com/diffplug/spotless/pull/1302)) * Bump default `googleJavaFormat` version `1.15.0` -> `1.16.0`. ([#1630](https://github.com/diffplug/spotless/pull/1630)) * Bump default `scalafmt` version `3.7.1` -> `3.7.3`. ([#1584](https://github.com/diffplug/spotless/pull/1584)) +* Bump default Eclipse formatters for the 2023-03 release. ([#1662](https://github.com/diffplug/spotless/pull/1662)) + * JDT and GrEclipse `4.26` -> `4.27` + * Improve GrEclipse error reporting. ([#1660](https://github.com/diffplug/spotless/pull/1660)) + * CDT `11.0` -> `11.1` ## [6.17.0] - 2023-03-13 ### Added diff --git a/plugin-maven/CHANGES.md b/plugin-maven/CHANGES.md index 2f89316bf2..f311a22ccb 100644 --- a/plugin-maven/CHANGES.md +++ b/plugin-maven/CHANGES.md @@ -16,6 +16,10 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( * Bump default `flexmark` version `0.62.2` -> `0.64.0`. ([#1302](https://github.com/diffplug/spotless/pull/1302)) * Bump default `googleJavaFormat` version `1.15.0` -> `1.16.0`. ([#1630](https://github.com/diffplug/spotless/pull/1630)) * Bump default `scalafmt` version `3.7.1` -> `3.7.3`. ([#1584](https://github.com/diffplug/spotless/pull/1584)) +* Bump default Eclipse formatters for the 2023-03 release. ([#1662](https://github.com/diffplug/spotless/pull/1662)) + * JDT and GrEclipse `4.26` -> `4.27` + * Improve GrEclipse error reporting. ([#1660](https://github.com/diffplug/spotless/pull/1660)) + * CDT `11.0` -> `11.1` ## [2.35.0] - 2023-03-13 ### Added From 7f245a8892408e40ee72d801dc3ad47ab284295c Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Wed, 5 Apr 2023 18:48:39 -0700 Subject: [PATCH 5/6] Sort all the "glue" adaptors in the build. --- lib-extra/build.gradle | 16 ++++--- lib/build.gradle | 97 ++++++++++++++++++++---------------------- 2 files changed, 56 insertions(+), 57 deletions(-) diff --git a/lib-extra/build.gradle b/lib-extra/build.gradle index 8ed36bede6..5e491eaf20 100644 --- a/lib-extra/build.gradle +++ b/lib-extra/build.gradle @@ -40,9 +40,10 @@ tasks.withType(Test).configureEach { } def NEEDS_P2_DEPS = [ - 'jdt', + // (alphabetic order please) + 'cdt', 'groovy', - 'cdt' + 'jdt' ] for (needsP2 in NEEDS_P2_DEPS) { sourceSets.register(needsP2) { @@ -68,9 +69,11 @@ tasks.withType(Test).configureEach { apply plugin: 'dev.equo.p2deps' p2deps { - into 'jdtCompileOnly', { + // (alphabetic order please) + into 'cdtCompileOnly', { p2repo 'https://download.eclipse.org/eclipse/updates/4.26/' - install 'org.eclipse.jdt.core' + p2repo 'https://download.eclipse.org/tools/cdt/releases/10.7/' + install 'org.eclipse.cdt.core' } into 'groovyCompileOnly', { p2repo 'https://download.eclipse.org/eclipse/updates/4.26/' @@ -80,10 +83,9 @@ p2deps { install 'org.eclipse.jdt.groovy.core' install 'org.codehaus.groovy' } - into 'cdtCompileOnly', { + into 'jdtCompileOnly', { p2repo 'https://download.eclipse.org/eclipse/updates/4.26/' - p2repo 'https://download.eclipse.org/tools/cdt/releases/10.7/' - install 'org.eclipse.cdt.core' + install 'org.eclipse.jdt.core' } } diff --git a/lib/build.gradle b/lib/build.gradle index a0835a09e0..9e31bed698 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -8,18 +8,19 @@ apply from: rootProject.file('gradle/java-setup.gradle') apply from: rootProject.file('gradle/java-publish.gradle') def NEEDS_GLUE = [ - 'sortPom', - 'palantirJavaFormat', + // (alphabetic order please) + 'cleanthat', + 'diktat', + 'flexmark', + 'gherkin', 'googleJavaFormat', + 'gson', + 'jackson', 'ktfmt', 'ktlint', - 'flexmark', - 'diktat', + 'palantirJavaFormat', 'scalafmt', - 'jackson', - 'gson', - 'cleanthat', - 'gherkin' + 'sortPom' ] for (glue in NEEDS_GLUE) { sourceSets.register(glue) { @@ -31,6 +32,13 @@ for (glue in NEEDS_GLUE) { versionCompatibility { adapters { + // (alphabetic order please) + namespaces.register('Cleanthat') { + versions = [ + '2.1', + ] + targetSourceSetName = 'cleanthat' + } namespaces.register('KtLint') { // as discussed at https://github.com/diffplug/spotless/pull/1475 // we will support no more than 2 breaking changes at a time = 3 incompatible versions @@ -42,12 +50,6 @@ versionCompatibility { ] targetSourceSetName = 'ktlint' } - namespaces.register('Cleanthat') { - versions = [ - '2.1', - ] - targetSourceSetName = 'cleanthat' - } } } @@ -66,33 +68,39 @@ dependencies { testCommonImplementation "org.assertj:assertj-core:$VER_ASSERTJ" testCommonImplementation "com.diffplug.durian:durian-testlib:$VER_DURIAN" - // used for pom sorting - sortPomCompileOnly 'com.github.ekryd.sortpom:sortpom-sorter:3.0.0' - sortPomCompileOnly 'org.slf4j:slf4j-api:2.0.0' - - palantirJavaFormatCompileOnly 'com.palantir.javaformat:palantir-java-format:1.1.0' // this version needs to stay compilable against Java 8 for CI Job testNpm - - googleJavaFormatCompileOnly 'com.google.googlejavaformat:google-java-format:1.16.0' // minimum required version due to api changes before then - - // used jackson-based formatters - jacksonCompileOnly 'com.fasterxml.jackson.core:jackson-databind:2.14.2' - jacksonCompileOnly 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.14.2' - - String VER_KTFMT = '0.43' - ktfmtCompileOnly "com.facebook:ktfmt:$VER_KTFMT" - String VER_KTLINT_GOOGLE_JAVA_FORMAT = '1.7' // for JDK 8 compatibility + // GLUE CODE (alphabetic order please) + // cleanthat + String VER_CLEANTHAT='2.13' + cleanthatCompileOnly "io.github.solven-eu.cleanthat:java:$VER_CLEANTHAT" + compatCleanthat2Dot1CompileAndTestOnly "io.github.solven-eu.cleanthat:java:$VER_CLEANTHAT" + // diktat + diktatCompileOnly 'org.cqfn.diktat:diktat-rules:1.2.5' + // flexmark + flexmarkCompileOnly 'com.vladsch.flexmark:flexmark-all:0.64.0' + // gherkin + gherkinCompileOnly 'io.cucumber:gherkin-utils:8.0.2' + gherkinCompileOnly 'org.slf4j:slf4j-api:2.0.0' + // googleJavaFormat + googleJavaFormatCompileOnly 'com.google.googlejavaformat:google-java-format:1.16.0' + // gson + gsonCompileOnly 'com.google.code.gson:gson:2.10.1' + // jackson + String VER_JACKSON='2.14.2' + jacksonCompileOnly "com.fasterxml.jackson.core:jackson-databind:$VER_JACKSON" + jacksonCompileOnly "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$VER_JACKSON" + // ktfmt + ktfmtCompileOnly "com.facebook:ktfmt:0.43" ktfmtCompileOnly("com.google.googlejavaformat:google-java-format") { version { - strictly VER_KTLINT_GOOGLE_JAVA_FORMAT + strictly '1.7' // for JDK 8 compatibility } } - + // ktlint String VER_KTLINT='0.46.1' ktlintCompileOnly "com.pinterest:ktlint:$VER_KTLINT" ktlintCompileOnly "com.pinterest.ktlint:ktlint-core:$VER_KTLINT" ktlintCompileOnly "com.pinterest.ktlint:ktlint-ruleset-experimental:$VER_KTLINT" ktlintCompileOnly "com.pinterest.ktlint:ktlint-ruleset-standard:$VER_KTLINT" - compatKtLint0Dot46Dot0CompileOnly 'com.pinterest.ktlint:ktlint-core:0.46.0' compatKtLint0Dot46Dot0CompileOnly 'com.pinterest.ktlint:ktlint-ruleset-experimental:0.46.0' compatKtLint0Dot46Dot0CompileOnly 'com.pinterest.ktlint:ktlint-ruleset-standard:0.46.0' @@ -102,24 +110,13 @@ dependencies { compatKtLint0Dot48Dot0CompileAndTestOnly 'com.pinterest.ktlint:ktlint-core:0.48.0' compatKtLint0Dot48Dot0CompileAndTestOnly 'com.pinterest.ktlint:ktlint-ruleset-experimental:0.48.0' compatKtLint0Dot48Dot0CompileAndTestOnly 'com.pinterest.ktlint:ktlint-ruleset-standard:0.48.0' - - String VER_SCALAFMT="3.7.3" - scalafmtCompileOnly "org.scalameta:scalafmt-core_2.13:$VER_SCALAFMT" - - String VER_DIKTAT = "1.2.5" - diktatCompileOnly "org.cqfn.diktat:diktat-rules:$VER_DIKTAT" - - // used for markdown formatting - flexmarkCompileOnly 'com.vladsch.flexmark:flexmark-all:0.64.0' - - gsonCompileOnly 'com.google.code.gson:gson:2.10.1' - - String VER_CLEANTHAT="2.13" - cleanthatCompileOnly "io.github.solven-eu.cleanthat:java:$VER_CLEANTHAT" - compatCleanthat2Dot1CompileAndTestOnly "io.github.solven-eu.cleanthat:java:$VER_CLEANTHAT" - - gherkinCompileOnly 'io.cucumber:gherkin-utils:8.0.2' - gherkinCompileOnly 'org.slf4j:slf4j-api:2.0.0' + // palantirJavaFormat + palantirJavaFormatCompileOnly 'com.palantir.javaformat:palantir-java-format:1.1.0' // this version needs to stay compilable against Java 8 for CI Job testNpm + // scalafmt + scalafmtCompileOnly "org.scalameta:scalafmt-core_2.13:3.7.3" + // sortPom + sortPomCompileOnly 'com.github.ekryd.sortpom:sortpom-sorter:3.0.0' + sortPomCompileOnly 'org.slf4j:slf4j-api:2.0.0' } // we'll hold the core lib to a high standard From 7e852e30ccb2e285028083f2b17e8717c62f6759 Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Wed, 5 Apr 2023 20:15:26 -0700 Subject: [PATCH 6/6] On JRE 11, users will get alert that they might fix the GrEclipse issue by bumping to JRE 17 and using the latest. --- .../extra/groovy/GrEclipseFormatterStepSpecialCaseTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib-extra/src/test/java/com/diffplug/spotless/extra/groovy/GrEclipseFormatterStepSpecialCaseTest.java b/lib-extra/src/test/java/com/diffplug/spotless/extra/groovy/GrEclipseFormatterStepSpecialCaseTest.java index 8f832b89f0..25a269834c 100644 --- a/lib-extra/src/test/java/com/diffplug/spotless/extra/groovy/GrEclipseFormatterStepSpecialCaseTest.java +++ b/lib-extra/src/test/java/com/diffplug/spotless/extra/groovy/GrEclipseFormatterStepSpecialCaseTest.java @@ -30,7 +30,7 @@ public class GrEclipseFormatterStepSpecialCaseTest { */ @Test public void issue_1657() { - Assertions.assertThrows(IllegalArgumentException.class, () -> { + Assertions.assertThrows(RuntimeException.class, () -> { StepHarness.forStep(GrEclipseFormatterStep.createBuilder(TestProvisioner.mavenCentral()).build()) .testResourceUnaffected("groovy/greclipse/format/SomeClass.test"); });