Skip to content

Commit 2768996

Browse files
committed
enableConfigCacheDaemonLocal is too long, jvmLocalCache is better.
1 parent 642ac61 commit 2768996

File tree

5 files changed

+17
-20
lines changed

5 files changed

+17
-20
lines changed

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

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,13 @@ public abstract class RegisterDependenciesTask extends DefaultTask {
4141
static final String TASK_NAME = "spotlessInternalRegisterDependencies";
4242

4343
void hookSubprojectTask(SpotlessTask task) {
44-
// TODO: in the future, we might use this hook to add an optional perf improvement
45-
// spotlessRoot {
44+
// TODO: in the future, we might use this hook to implement #984
45+
// spotlessSetup {
4646
// java { googleJavaFormat('1.2') }
4747
// ...etc
4848
// }
49-
// The point would be to reuse configurations from the root project,
50-
// with the restriction that you have to declare every formatter in
51-
// the root, and you'd get an error if you used a formatter somewhere
52-
// which you didn't declare in the root. That's a problem for the future
53-
// though, not today!
49+
// it's also needed to make sure that jvmLocalCache gets set
50+
// in the SpotlessTaskService before any spotless tasks run
5451
task.dependsOn(this);
5552
}
5653

@@ -62,11 +59,11 @@ void setup() {
6259
getBuildEventsListenerRegistry().onTaskCompletion(getTaskService());
6360
}
6461

65-
boolean enableConfigCacheDaemonLocal;
62+
boolean jvmLocalCache;
6663

6764
@Input
68-
public boolean getEnableConfigCacheDaemonLocal() {
69-
return enableConfigCacheDaemonLocal;
65+
public boolean getJvmLocalCache() {
66+
return jvmLocalCache;
7067
}
7168

7269
@TaskAction

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ public SpotlessSetup(Project project) {
2727
task = (TaskProvider<RegisterDependenciesTask>) (Object) project.getTasks().named(RegisterDependenciesTask.TASK_NAME);
2828
}
2929

30-
public boolean isEnableConfigCacheDaemonLocal() {
31-
return task.get().getEnableConfigCacheDaemonLocal();
30+
public boolean isJvmLocalCache() {
31+
return task.get().getJvmLocalCache();
3232
}
3333

34-
public boolean setEnableConfigCacheDaemonLocal(boolean enabled) {
35-
return task.get().enableConfigCacheDaemonLocal = enabled;
34+
public boolean setJvmLocalCache(boolean enabled) {
35+
return task.get().jvmLocalCache = enabled;
3636
}
3737
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public abstract class SpotlessTaskService implements BuildService<BuildServicePa
5050
private Map<String, Provisioner> provisioner = Collections.synchronizedMap(new HashMap<>());
5151

5252
void registerDependenciesTask(RegisterDependenciesTask task) {
53-
enableConfigCacheDaemonLocal = task.getEnableConfigCacheDaemonLocal();
53+
enableConfigCacheDaemonLocal = task.getJvmLocalCache();
5454
}
5555

5656
void registerSourceAlreadyRan(SpotlessTask task) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import org.gradle.testkit.runner.GradleRunner;
2222
import org.junit.jupiter.api.Test;
2323

24-
public class ConfigurationCacheDaemonLocalTest extends GradleIntegrationHarness {
24+
public class ConfigurationCacheJvmLocalTest extends GradleIntegrationHarness {
2525
@Override
2626
protected GradleRunner gradleRunner() throws IOException {
2727
setFile("gradle.properties").toContent("org.gradle.unsafe.configuration-cache=true");
@@ -37,7 +37,7 @@ public void gjf() throws IOException {
3737
"}",
3838
"repositories { mavenCentral() }",
3939
"spotlessSetup {",
40-
" enableConfigCacheDaemonLocal = true",
40+
" jvmLocalCache = true",
4141
"}",
4242
"spotless {",
4343
" java {",

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void singleProjectExhaustive(int useConfigCache) throws Exception {
6565
" id 'com.diffplug.spotless'",
6666
" id 'com.diffplug.spotless-setup'",
6767
"}",
68-
"spotlessSetup { enableConfigCacheDaemonLocal = true }",
68+
"spotlessSetup { jvmLocalCache = true }",
6969
"spotless {",
7070
" ratchetFrom 'baseline'",
7171
" format 'misc', {",
@@ -150,7 +150,7 @@ private BuildResultAssertion assertFail(String... tasks) throws Exception {
150150
return new BuildResultAssertion(gradleRunner().withArguments(tasks).buildAndFail());
151151
}
152152

153-
private static final String BASELINE_ROOT = "a5efb43a0da929853e596a85c1f225a60ae0acfd";
153+
private static final String BASELINE_ROOT = "71a2671ed452d52625245e5101cbf8467e905865";
154154
private static final String BASELINE_CLEAN = "65fdd75c1ae00c0646f6487d68c44ddca51f0841";
155155
private static final String BASELINE_DIRTY = "4cfc3358ccbf186738b82a60276b1e5306bc3870";
156156

@@ -181,7 +181,7 @@ void multiProject(int useConfigCache) throws Exception {
181181
setFile(".gitignore").toContent("build/\n.gradle\n*.properties\n");
182182
setFile("build.gradle").toLines(
183183
"apply plugin: 'com.diffplug.spotless-setup'",
184-
"spotlessSetup { enableConfigCacheDaemonLocal = true }",
184+
"spotlessSetup { jvmLocalCache = true }",
185185
"apply from: rootProject.file('spotless.gradle') // root");
186186
setFile(TEST_PATH).toContent("HELLO");
187187
setFile("clean/build.gradle").toContent("apply from: rootProject.file('spotless.gradle') // clean");

0 commit comments

Comments
 (0)