Skip to content

Commit ee5aaf8

Browse files
committed
It's hard to turn off JvmLocalCache, and there isn't a good reason to, so we don't have any need for the SpotlessSetup plugin anymore.
1 parent 166ab79 commit ee5aaf8

File tree

7 files changed

+3
-140
lines changed

7 files changed

+3
-140
lines changed

plugin-gradle/build.gradle

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ gradlePlugin {
4545
displayName = 'Spotless formatting plugin'
4646
description = project.description
4747
}
48-
spotlessSetupPlugin {
49-
id = 'com.diffplug.spotless-setup'
50-
implementationClass = 'com.diffplug.gradle.spotless.SpotlessSetupPlugin'
51-
displayName = 'Spotless formatting plugin setup'
52-
description = project.description
53-
}
5448
spotlessPluginLegacy {
5549
id = 'com.diffplug.gradle.spotless'
5650
implementationClass = 'com.diffplug.gradle.spotless.SpotlessPluginRedirect'
@@ -84,9 +78,6 @@ if (version.endsWith('-SNAPSHOT')) {
8478
'clang-format'
8579
]
8680
plugins {
87-
spotlessSetupPlugin {
88-
id = 'com.diffplug.spotless-setup'
89-
}
9081
spotlessPlugin {
9182
id = 'com.diffplug.spotless'
9283
}

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import org.gradle.api.DefaultTask;
2121
import org.gradle.api.provider.Property;
2222
import org.gradle.api.services.BuildServiceRegistry;
23-
import org.gradle.api.tasks.Input;
2423
import org.gradle.api.tasks.Internal;
2524
import org.gradle.api.tasks.TaskAction;
2625
import org.gradle.build.event.BuildEventsListenerRegistry;
@@ -59,16 +58,9 @@ void setup() {
5958
getBuildEventsListenerRegistry().onTaskCompletion(getTaskService());
6059
}
6160

62-
boolean jvmLocalCache;
63-
64-
@Input
65-
public boolean getJvmLocalCache() {
66-
return jvmLocalCache;
67-
}
68-
6961
@TaskAction
7062
public void trivialFunction() {
71-
getTaskService().get().registerDependenciesTask(this);
63+
// nothing to do :)
7264
}
7365

7466
@Internal

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

Lines changed: 0 additions & 37 deletions
This file was deleted.

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

Lines changed: 0 additions & 30 deletions
This file was deleted.

plugin-gradle/src/test/java/com/diffplug/gradle/spotless/ConfigurationCacheJvmLocalTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,9 @@ protected GradleRunner gradleRunner() throws IOException {
3232
public void gjf() throws IOException {
3333
setFile("build.gradle").toLines(
3434
"plugins {",
35-
" id 'com.diffplug.spotless-setup'",
3635
" id 'com.diffplug.spotless'",
3736
"}",
3837
"repositories { mavenCentral() }",
39-
"spotlessSetup {",
40-
" jvmLocalCache = true",
41-
"}",
4238
"spotless {",
4339
" java {",
4440
" target file('test.java')",

plugin-gradle/src/test/java/com/diffplug/gradle/spotless/ConfigurationCacheTest.java

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,8 @@
1515
*/
1616
package com.diffplug.gradle.spotless;
1717

18-
import java.io.File;
1918
import java.io.IOException;
20-
import java.nio.file.Files;
21-
import java.nio.file.Path;
22-
import java.util.Comparator;
2319

24-
import org.gradle.testkit.runner.BuildResult;
2520
import org.gradle.testkit.runner.GradleRunner;
2621
import org.junit.jupiter.api.Test;
2722

@@ -64,43 +59,4 @@ public void helpConfiguresIfTasksAreCreated() throws IOException {
6459
"tasks.named('spotlessJavaApply').get()");
6560
gradleRunner().withArguments("help").build();
6661
}
67-
68-
@Test
69-
public void gjf() throws IOException {
70-
setFile("build.gradle").toLines(
71-
"plugins {",
72-
" id 'com.diffplug.spotless'",
73-
"}",
74-
"repositories { mavenCentral() }",
75-
"apply plugin: 'java'",
76-
"spotless {",
77-
" java {",
78-
" target file('test.java')",
79-
" googleJavaFormat('1.2')",
80-
" }",
81-
"}");
82-
83-
// first run works
84-
setFile("test.java").toResource("java/googlejavaformat/JavaCodeUnformatted.test");
85-
gradleRunner().withArguments("spotlessApply").build();
86-
assertFile("test.java").sameAsResource("java/googlejavaformat/JavaCodeFormatted.test");
87-
88-
// but the second fails
89-
BuildResult failure = gradleRunner().withArguments("spotlessApply").buildAndFail();
90-
failure.getOutput().contains("> Spotless doesn't support configuration cache yet");
91-
92-
// and it will keep failing forever
93-
gradleRunner().withArguments("spotlessApply").buildAndFail();
94-
95-
// until you delete the .gradlle/configuration-cache folder
96-
File configCache = new File(super.rootFolder(), ".gradle/configuration-cache");
97-
Files.walk(configCache.toPath())
98-
.sorted(Comparator.reverseOrder())
99-
.map(Path::toFile)
100-
.forEach(File::delete);
101-
102-
// then it will work again (but only once)
103-
gradleRunner().withArguments("spotlessApply").build();
104-
gradleRunner().withArguments("spotlessApply").buildAndFail();
105-
}
10662
}

plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GitRatchetGradleTest.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ void singleProjectExhaustive(int useConfigCache) throws Exception {
6363
setFile("build.gradle").toLines(
6464
"plugins {",
6565
" id 'com.diffplug.spotless'",
66-
" id 'com.diffplug.spotless-setup'",
6766
"}",
68-
"spotlessSetup { jvmLocalCache = true }",
6967
"spotless {",
7068
" ratchetFrom 'baseline'",
7169
" format 'misc', {",
@@ -150,7 +148,7 @@ private BuildResultAssertion assertFail(String... tasks) throws Exception {
150148
return new BuildResultAssertion(gradleRunner().withArguments(tasks).buildAndFail());
151149
}
152150

153-
private static final String BASELINE_ROOT = "71a2671ed452d52625245e5101cbf8467e905865";
151+
private static final String BASELINE_ROOT = "fdc3ca3c850cee44d95d32c64cda30afbb29323c";
154152
private static final String BASELINE_CLEAN = "65fdd75c1ae00c0646f6487d68c44ddca51f0841";
155153
private static final String BASELINE_DIRTY = "4cfc3358ccbf186738b82a60276b1e5306bc3870";
156154

@@ -179,10 +177,7 @@ void multiProject(int useConfigCache) throws Exception {
179177
" }",
180178
"}");
181179
setFile(".gitignore").toContent("build/\n.gradle\n*.properties\n");
182-
setFile("build.gradle").toLines(
183-
"apply plugin: 'com.diffplug.spotless-setup'",
184-
"spotlessSetup { jvmLocalCache = true }",
185-
"apply from: rootProject.file('spotless.gradle') // root");
180+
setFile("build.gradle").toContent("apply from: rootProject.file('spotless.gradle') // root");
186181
setFile(TEST_PATH).toContent("HELLO");
187182
setFile("clean/build.gradle").toContent("apply from: rootProject.file('spotless.gradle') // clean");
188183
setFile("clean/" + TEST_PATH).toContent("HELLO");

0 commit comments

Comments
 (0)