Skip to content

Commit 8ae59f2

Browse files
committed
Bump the min Gradle requirement to 7.1 and test on 9.0.0-rc-1
1 parent 03a4cd2 commit 8ae59f2

File tree

17 files changed

+73
-63
lines changed

17 files changed

+73
-63
lines changed

.github/workflows/changelog-print.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ jobs:
1010
name: changelogPrint
1111
steps:
1212
- uses: actions/checkout@v4
13-
- name: jdk 11
14-
uses: actions/setup-java@v4
13+
- uses: actions/setup-java@v4
1514
with:
16-
java-version: 11
15+
java-version: 21
1716
distribution: 'temurin'
1817
- name: gradle caching
1918
uses: gradle/actions/setup-gradle@v4

.github/workflows/ci.yml

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ jobs:
2323
uses: actions/checkout@v4
2424
with:
2525
fetch-depth: 0
26-
- name: Install JDK 11
27-
uses: actions/setup-java@v4
26+
- uses: actions/setup-java@v4
2827
with:
2928
distribution: "temurin"
30-
java-version: 11
29+
java-version: 21
3130
- name: gradle caching
3231
uses: gradle/actions/setup-gradle@v4
3332
- name: spotlessCheck
@@ -41,33 +40,25 @@ jobs:
4140
matrix:
4241
kind: [maven, gradle]
4342
# Test on the latest Java version once Gradle & Maven support it.
44-
jre: [11, 17, 21, 24]
45-
os: [ubuntu-latest]
43+
jre: [17, 21, 24]
44+
os: [ubuntu-latest, windows-latest]
4645
include:
47-
# test windows at the diagonals of the above matrix
48-
- kind: maven
49-
jre: 11
50-
os: windows-latest
51-
- kind: gradle
52-
jre: 17
53-
os: windows-latest
5446
# npm on linux only (crazy slow on windows)
5547
- kind: npm
56-
jre: 11
48+
jre: 17
5749
os: ubuntu-latest
5850
- kind: shfmt
59-
jre: 11
51+
jre: 17
6052
os: ubuntu-latest
6153
shfmt-version: v3.8.0
6254
- kind: idea
63-
jre: 11
55+
jre: 17
6456
os: ubuntu-latest
6557
runs-on: ${{ matrix.os }}
6658
steps:
6759
- name: Checkout
6860
uses: actions/checkout@v4
69-
- name: Install JDK ${{ matrix.distribution }} ${{ matrix.java_version }}
70-
uses: actions/setup-java@v4
61+
- uses: actions/setup-java@v4
7162
with:
7263
distribution: "temurin"
7364
java-version: ${{ matrix.jre }}
@@ -111,3 +102,37 @@ jobs:
111102
check_name: JUnit ${{ matrix.kind }} ${{ matrix.jre }} ${{ matrix.os }}
112103
report_paths: '*/build/test-results/*/TEST-*.xml'
113104
check_retries: true
105+
106+
# Gradle 9 requires Java 17 or higher, we use Gradle 8.14 (instead of gradlew) to build on Java 11.
107+
build-on-java-11:
108+
needs: sanityCheck
109+
strategy:
110+
fail-fast: false
111+
matrix:
112+
kind: [maven, gradle]
113+
jre: [11]
114+
os: [ubuntu-latest]
115+
runs-on: ${{ matrix.os }}
116+
steps:
117+
- name: Checkout
118+
uses: actions/checkout@v4
119+
- uses: actions/setup-java@v4
120+
with:
121+
distribution: "temurin"
122+
java-version: ${{ matrix.jre }}
123+
- uses: gradle/actions/setup-gradle@v4
124+
with:
125+
gradle-version: 8.14.2
126+
- name: build (maven-only)
127+
if: matrix.kind == 'maven'
128+
run: gradle :plugin-maven:build -x spotlessCheck
129+
- name: build (everything-but-maven)
130+
if: matrix.kind == 'gradle'
131+
run: gradle build -x spotlessCheck -PSPOTLESS_EXCLUDE_MAVEN=true
132+
- name: junit result
133+
uses: mikepenz/action-junit-report@v5
134+
if: always() # always run even if the previous step fails
135+
with:
136+
check_name: JUnit ${{ matrix.kind }} ${{ matrix.jre }} ${{ matrix.os }}
137+
report_paths: '*/build/test-results/*/TEST-*.xml'
138+
check_retries: true

.github/workflows/deploy.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ jobs:
3838
ORG_GRADLE_PROJECT_gpg_key64: ${{ secrets.GPG_KEY64 }}
3939
steps:
4040
- uses: actions/checkout@v4
41-
- name: jdk 11
42-
uses: actions/setup-java@v4
41+
- uses: actions/setup-java@v4
4342
with:
44-
java-version: 17
43+
java-version: 21
4544
distribution: 'temurin'
4645
- name: gradle caching
4746
uses: gradle/actions/setup-gradle@v4

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1024m -Dfile.encoding=UTF-8
33
org.gradle.parallel=true
44
org.gradle.caching=true
55
org.gradle.configuration-cache=true
6+
org.gradle.configuration-cache.parallel=true
67

78
name=spotless
89
description=Spotless - keep your code spotless with Gradle
@@ -32,4 +33,4 @@ VER_JGIT=6.10.1.202505221210-r
3233
VER_JUNIT=5.13.3
3334
VER_ASSERTJ=3.27.3
3435
VER_MOCKITO=5.18.0
35-
VER_SELFIE=2.5.3
36+
VER_SELFIE=2.5.3

gradle/wrapper/gradle-wrapper.jar

1.65 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-rc-1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
#
4-
# Copyright © 2015-2021 the original authors.
4+
# Copyright © 2015 the original authors.
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.

lib/build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.gradle.util.GradleVersion
2+
13
plugins {
24
id 'java-library'
35
id 'io.github.davidburstrom.version-compatibility'
@@ -148,6 +150,11 @@ tasks.withType(Test).configureEach {
148150
// https://docs.gradle.org/7.5/userguide/upgrading_version_7.html#removes_implicit_add_opens_for_test_workers
149151
jvmArgs "--add-opens=java.base/java.lang=ALL-UNNAMED"
150152
}
153+
154+
if (GradleVersion.current() >= GradleVersion.version('9.0')) {
155+
// https://github.com/gradle/gradle/issues/33619
156+
failOnNoDiscoveredTests = false
157+
}
151158
}
152159

153160
jar {

plugin-gradle/CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
55
## [Unreleased]
66

77
## Changed
8+
* Bump the min Gradle requirement from `6.1.1` to `7.1`. ([#2540](https://github.com/diffplug/spotless/pull/2540))
89
* Bump default `gson` version to latest `2.11.0` -> `2.13.1`. ([#2414](https://github.com/diffplug/spotless/pull/2414))
910
* Bump default `jackson` version to latest `2.18.1` -> `2.19.1`. ([#2352](https://github.com/diffplug/spotless/pull/2352))
1011
* Bump default `gherkin-utils` version to latest `9.0.0` -> `9.2.0`. ([#2408](https://github.com/diffplug/spotless/pull/2408))

plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GroovyExtension.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2023 DiffPlug
2+
* Copyright 2016-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,11 +18,8 @@
1818
import javax.inject.Inject;
1919

2020
import org.gradle.api.GradleException;
21-
import org.gradle.api.internal.plugins.DslObject;
2221
import org.gradle.api.plugins.GroovyBasePlugin;
2322
import org.gradle.api.tasks.GroovySourceDirectorySet;
24-
import org.gradle.api.tasks.GroovySourceSet;
25-
import org.gradle.util.GradleVersion;
2623

2724
import com.diffplug.spotless.generic.LicenseHeaderStep;
2825

@@ -66,12 +63,7 @@ protected void setupTask(SpotlessTask task) {
6663
target = getSources(getProject(),
6764
message,
6865
sourceSet -> {
69-
if (GradleVersion.current().compareTo(GradleVersion.version(SpotlessPlugin.VER_GRADLE_javaPluginExtension)) >= 0) {
70-
return sourceSet.getExtensions().getByType(GroovySourceDirectorySet.class);
71-
} else {
72-
final GroovySourceSet groovySourceSet = new DslObject(sourceSet).getConvention().getPlugin(GroovySourceSet.class);
73-
return groovySourceSet.getGroovy();
74-
}
66+
return sourceSet.getExtensions().getByType(GroovySourceDirectorySet.class);
7567
},
7668
file -> {
7769
final String name = file.getName();

0 commit comments

Comments
 (0)