Skip to content
Closed
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
36 changes: 18 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ concurrency:
jobs:
sanity-check:
name: Sanity Check
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-arm
env:
# Only push to the remote build cache on push events to prevent cache pollution and poisoning from PRs.
buildcacheuser: ${{ github.event_name == 'push' && secrets.BUILDCACHE_USER || '' }}
Expand All @@ -26,7 +26,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-java@v6
with:
distribution: "temurin"
distribution: 'zulu'
java-version: 21
- uses: gradle/actions/setup-gradle@v6
- run: ./gradlew spotlessCheck
Expand All @@ -38,17 +38,17 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
jre: [ 17, 21, 24 ] # Test on all supported LTS and latest JDK.
os: [ ubuntu-24.04-arm ]
jre: [ 17, 21, 25, 26 ] # Test on all supported LTS and latest JDK.
include:
- os: windows-latest
jre: 24 # Test on the latest JDK for speeds.
- os: windows-11-arm
jre: 25 # Test on the latest LTS for speeds.
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
distribution: "temurin"
distribution: 'zulu'
java-version: ${{ matrix.jre }}
- uses: gradle/actions/setup-gradle@v6
- run: ./gradlew build -x spotlessCheck -PSPOTLESS_EXCLUDE_MAVEN=true
Expand All @@ -66,17 +66,17 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
jre: [ 17, 21, 24 ] # Test on all supported LTS and latest JDK.
os: [ ubuntu-24.04-arm ]
jre: [ 17, 21, 25, 26 ] # Test on all supported LTS and latest JDK.
include:
- os: windows-latest
jre: 24 # Test on the latest JDK for speeds.
- os: windows-11-arm
jre: 25 # Test on the latest LTS for speeds.
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
distribution: "temurin"
distribution: 'zulu'
java-version: ${{ matrix.jre }}
- uses: gradle/actions/setup-gradle@v6
- run: ./gradlew :plugin-maven:build -x spotlessCheck
Expand All @@ -91,12 +91,12 @@ jobs:
test-npm:
name: NPM
needs: sanity-check
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
distribution: "temurin"
distribution: 'zulu'
java-version: 17
- uses: gradle/actions/setup-gradle@v6
- run: ./gradlew testNpm
Expand All @@ -111,12 +111,12 @@ jobs:
test-shfmt:
name: Shfmt
needs: sanity-check
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
distribution: "temurin"
distribution: 'zulu'
java-version: 17
- uses: gradle/actions/setup-gradle@v6
- uses: actions/setup-go@v7
Expand All @@ -138,12 +138,12 @@ jobs:
test-idea:
name: IntelliJ IDEA
needs: sanity-check
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
distribution: "temurin"
distribution: 'zulu'
java-version: 17
- uses: gradle/actions/setup-gradle@v6
- name: Test idea
Expand Down
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
- Bump default `jackson` version `2.20.1` -> `2.22.2`. ([#2819](https://github.com/diffplug/spotless/pull/2819))
- Bump default `javaparser` version `3.27.1` -> `3.28.2`. ([#3065](https://github.com/diffplug/spotless/pull/3065))
- Bump default `palantir-java-format` version `2.80.0` -> `2.98.0`. ([#3068](https://github.com/diffplug/spotless/pull/3068))
- Bump default `google-java-format` version `1.30.0` -> `1.36.1`. ([#3075](https://github.com/diffplug/spotless/pull/3075))

### Fixed
- `VersionCatalogStep` preserves entries when comments contain unmatched brackets, preserves commas inside quoted strings, and keeps significant line boundaries in multiline entries. ([#3042](https://github.com/diffplug/spotless/pull/3042))
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ diktat-runner = "com.saveourtool.diktat:diktat-runner:2.0.0"
flexmark-all = "com.vladsch.flexmark:flexmark-all:0.64.8"
freshmark = "com.diffplug.freshmark:freshmark:1.3.1"
gherkin-utils = "io.cucumber:gherkin-utils:10.0.0"
google-java-format = "com.google.googlejavaformat:google-java-format:1.30.0"
google-java-format = "com.google.googlejavaformat:google-java-format:1.36.1"
gson = "com.google.code.gson:gson:2.14.0"
json-simple = "org.json:json:20210307"
ktfmt = "com.facebook:ktfmt:0.64"
Expand Down
2 changes: 1 addition & 1 deletion gradle/pinned-libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ maven-plugin-annotations = { module = "org.apache.maven.plugin-tools:maven-plugi
maven-core = { module = "org.apache.maven:maven-core", version.ref = "maven" }

palantir-java-format = "com.palantir.javaformat:palantir-java-format:1.1.0"
google-java-format = "com.google.googlejavaformat:google-java-format:1.7"
google-java-format = "com.google.googlejavaformat:google-java-format:1.28.0"
diktat-rules = "org.cqfn.diktat:diktat-rules:1.2.5"
aether-api = "org.eclipse.aether:aether-api:1.1.0"
plexus-build-api = "org.sonatype.plexus:plexus-build-api:0.0.7"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2025 DiffPlug
* Copyright 2020-2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -331,6 +331,6 @@ private Git initRepo() throws IllegalStateException, GitAPIException, IOExceptio

private void addAndCommit(Git git, String message) throws GitAPIException {
git.add().addFilepattern(".").call();
git.commit().setMessage(message).call();
git.commit().setSign(false).setMessage(message).call();
}
}
2 changes: 1 addition & 1 deletion lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ dependencies {
"gherkinCompileOnly"(libs.gherkin.utils)
"gherkinCompileOnly"(libs.slf4j.api)
// googleJavaFormat
"googleJavaFormatCompileOnly"(libs.google.java.format)
"googleJavaFormatCompileOnly"(pinnedLibs.google.java.format)
// gson
"gsonCompileOnly"(libs.gson)
// jackson
Expand Down
5 changes: 5 additions & 0 deletions lib/spotbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@
<Match>
<Bug pattern="USO_UNSAFE_STATIC_METHOD_SYNCHRONIZATION"/>
</Match>
<Match>
<!-- Process implements AutoCloseable on Java 24+, but not on Java 17 -->
<Class name="com.diffplug.spotless.ProcessRunner$LongRunningProcess"/>
<Bug pattern="RI_REDUNDANT_INTERFACES"/>
</Match>
</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Objects;
import java.util.TreeMap;

import com.diffplug.spotless.FormatterFunc;
import com.diffplug.spotless.FormatterStep;
import com.diffplug.spotless.JarState;
import com.diffplug.spotless.Jvm;
Expand Down Expand Up @@ -53,10 +54,10 @@ public static State state(RdfFormatterStep step) {
return new State(step.config, step.turtleFormatterStyle, step.jarState.get());
}

public static RdfFormatterFunc formatterFunc(State state)
public static FormatterFunc formatterFunc(State state)
throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
var formatterFunc = new RdfFormatterFunc(state);
return (RdfFormatterFunc) JVM_SUPPORT.suggestLaterVersionOnError(state.config.getTurtleFormatterVersion(), formatterFunc);
return JVM_SUPPORT.suggestLaterVersionOnError(state.config.getTurtleFormatterVersion(), formatterFunc);
}

public RdfFormatterStep(JarState.Promised jarState, RdfFormatterConfig config,
Expand Down
1 change: 1 addition & 0 deletions plugin-gradle/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
- Bump default `jackson` version `2.20.1` -> `2.22.2`. ([#2819](https://github.com/diffplug/spotless/pull/2819))
- Bump default `javaparser` version `3.27.1` -> `3.28.2`. ([#3065](https://github.com/diffplug/spotless/pull/3065))
- Bump default `palantir-java-format` version `2.80.0` -> `2.98.0`. ([#3068](https://github.com/diffplug/spotless/pull/3068))
- Bump default `google-java-format` version `1.30.0` -> `1.36.1`. ([#3075](https://github.com/diffplug/spotless/pull/3075))

### Fixed
- `versionCatalog()` preserves entries when comments contain unmatched brackets, preserves commas inside quoted strings, and keeps significant line boundaries in multiline entries. ([#3042](https://github.com/diffplug/spotless/pull/3042))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2025 DiffPlug
* Copyright 2016-2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -78,7 +78,7 @@ void singleProjectExhaustive(int useConfigCache) throws Exception {
"}");
setFile(TEST_PATH).toContent("HELLO");
git.add().addFilepattern(TEST_PATH).call();
git.commit().setMessage("Initial state").call();
git.commit().setSign(false).setMessage("Initial state").call();
// tag this initial state as the baseline for spotless to ratchet from
git.tag().setName("baseline").call();

Expand Down Expand Up @@ -271,7 +271,7 @@ public BuildResultAssertion outcome(String taskPath, TaskOutcome expected) {
private RevCommit addAndCommit(Git git) throws NoFilepatternException, GitAPIException {
PersonIdent emptyPerson = new PersonIdent("jane doe", "jane@doe.com", new Date(0), TimeZone.getTimeZone("UTC"));
git.add().addFilepattern(".").call();
return git.commit().setMessage("baseline")
return git.commit().setSign(false).setMessage("baseline")
.setCommitter(emptyPerson)
.setAuthor(emptyPerson)
.call();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 DiffPlug
* Copyright 2016-2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,7 +19,11 @@

import org.junit.jupiter.api.Test;

import com.diffplug.spotless.Jvm;

class GoogleJavaFormatIntegrationTest extends GradleIntegrationHarness {
private static final String NON_DEFAULT_VERSION = Jvm.version() <= 17 ? "1.27.0" : "1.34.1";

@Test
void integration() throws IOException {
setFile("build.gradle").toLines(
Expand All @@ -31,7 +35,7 @@ void integration() throws IOException {
"spotless {",
" java {",
" target file('test.java')",
" googleJavaFormat('1.17.0')",
" googleJavaFormat('" + NON_DEFAULT_VERSION + "')",
" }",
"}");

Expand All @@ -41,7 +45,7 @@ void integration() throws IOException {

checkRunsThenUpToDate();
replace("build.gradle",
"googleJavaFormat('1.17.0')",
"googleJavaFormat('" + NON_DEFAULT_VERSION + "')",
"googleJavaFormat()");
checkRunsThenUpToDate();
}
Expand All @@ -57,7 +61,7 @@ void integrationWithReorderImports() throws IOException {
"spotless {",
" java {",
" target file('test.java')",
" googleJavaFormat('1.17.0').aosp().reorderImports(true)",
" googleJavaFormat('" + NON_DEFAULT_VERSION + "').aosp().reorderImports(true)",
" }",
"}");

Expand All @@ -67,7 +71,7 @@ void integrationWithReorderImports() throws IOException {

checkRunsThenUpToDate();
replace("build.gradle",
"googleJavaFormat('1.17.0')",
"googleJavaFormat('" + NON_DEFAULT_VERSION + "')",
"googleJavaFormat()");
checkRunsThenUpToDate();
}
Expand All @@ -83,7 +87,7 @@ void integrationWithSkipJavadocFormatting() throws IOException {
"spotless {",
" java {",
" target file('test.java')",
" googleJavaFormat('1.17.0').skipJavadocFormatting()",
" googleJavaFormat('" + NON_DEFAULT_VERSION + "').skipJavadocFormatting()",
" }",
"}");

Expand All @@ -93,7 +97,7 @@ void integrationWithSkipJavadocFormatting() throws IOException {

checkRunsThenUpToDate();
replace("build.gradle",
"googleJavaFormat('1.17.0')",
"googleJavaFormat('" + NON_DEFAULT_VERSION + "')",
"googleJavaFormat()");
checkRunsThenUpToDate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,12 @@ public enum GradleVersionSupport {
GradleVersionSupport(String version) {
String minVersionForRunningJRE;
switch (Jvm.version()) {
case 26:
throw new IllegalStateException("Gradle does not yet support running on Java 26. " +
case 27:
throw new IllegalStateException("Gradle does not yet support running on Java 27. " +
"You need to update the case ref to https://docs.gradle.org/current/userguide/compatibility.html.");
case 26:
minVersionForRunningJRE = "9.4.0";
break;
case 25:
minVersionForRunningJRE = "9.1.0";
break;
Expand Down
Loading
Loading