Skip to content

Commit 0426db1

Browse files
authored
Apply Gradle's strict plugin types validation to the Spotless plugin in preparation for Gradle 9.0 (#2454)
2 parents 48b4cde + fc0ec00 commit 0426db1

File tree

6 files changed

+16
-4
lines changed

6 files changed

+16
-4
lines changed

Diff for: plugin-gradle/CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
66
### Changed
77
* Use palantir-java-format 2.57.0 on Java 21. ([#2447](https://github.com/diffplug/spotless/pull/2447))
88
* Re-try `npm install` with `--prefer-online` after `ERESOLVE` error. ([#2448](https://github.com/diffplug/spotless/pull/2448))
9+
* Apply Gradle's strict plugin types validation to the Spotless plugin. ([#2454](https://github.com/diffplug/spotless/pull/2454))
910

1011
## [7.0.2] - 2025-01-14
1112
### Fixed

Diff for: plugin-gradle/build.gradle

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ apply from: rootProject.file('gradle/special-tests.gradle')
3333
tasks.withType(Test).configureEach {
3434
testLogging.showStandardStreams = true
3535
}
36+
tasks.validatePlugins {
37+
enableStricterValidation = true
38+
}
3639

3740
//////////////////////////
3841
// GRADLE PLUGIN PORTAL //

Diff for: plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessApply.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 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.
@@ -25,7 +25,9 @@
2525
import org.gradle.api.file.FileVisitDetails;
2626
import org.gradle.api.file.FileVisitor;
2727
import org.gradle.api.tasks.TaskAction;
28+
import org.gradle.work.DisableCachingByDefault;
2829

30+
@DisableCachingByDefault(because = "not worth caching")
2931
public abstract class SpotlessApply extends SpotlessTaskService.ClientTask {
3032
@TaskAction
3133
public void performAction() {

Diff for: plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessCheck.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 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.
@@ -32,12 +32,14 @@
3232
import org.gradle.api.tasks.Input;
3333
import org.gradle.api.tasks.Internal;
3434
import org.gradle.api.tasks.TaskAction;
35+
import org.gradle.work.DisableCachingByDefault;
3536
import org.jetbrains.annotations.NotNull;
3637

3738
import com.diffplug.spotless.FileSignature;
3839
import com.diffplug.spotless.ThrowingEx;
3940
import com.diffplug.spotless.extra.integration.DiffMessageFormatter;
4041

42+
@DisableCachingByDefault(because = "not worth caching")
4143
public abstract class SpotlessCheck extends SpotlessTaskService.ClientTask {
4244
@Internal
4345
public abstract Property<String> getEncoding();

Diff for: plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessDiagnoseTask.java

+3-1
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.
@@ -25,12 +25,14 @@
2525
import org.gradle.api.DefaultTask;
2626
import org.gradle.api.tasks.Internal;
2727
import org.gradle.api.tasks.TaskAction;
28+
import org.gradle.api.tasks.UntrackedTask;
2829

2930
import com.diffplug.spotless.Formatter;
3031
import com.diffplug.spotless.PaddedCell;
3132

3233
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
3334

35+
@UntrackedTask(because = "undeclared inputs/outputs")
3436
public class SpotlessDiagnoseTask extends DefaultTask {
3537
SpotlessTask source;
3638

Diff for: plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessTask.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2024 DiffPlug
2+
* Copyright 2020-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.
@@ -34,6 +34,7 @@
3434
import org.gradle.api.tasks.OutputDirectory;
3535
import org.gradle.api.tasks.PathSensitive;
3636
import org.gradle.api.tasks.PathSensitivity;
37+
import org.gradle.work.DisableCachingByDefault;
3738
import org.gradle.work.Incremental;
3839

3940
import com.diffplug.spotless.ConfigurationCacheHackList;
@@ -43,6 +44,7 @@
4344
import com.diffplug.spotless.LintSuppression;
4445
import com.diffplug.spotless.extra.GitRatchet;
4546

47+
@DisableCachingByDefault(because = "abstract definition")
4648
public abstract class SpotlessTask extends DefaultTask {
4749
@Internal
4850
abstract Property<SpotlessTaskService> getTaskService();

0 commit comments

Comments
 (0)