Skip to content

Commit 9ab5fe7

Browse files
committed
Call Task.usesService wherever the service is used.
1 parent 7867f96 commit 9ab5fe7

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2021 DiffPlug
2+
* Copyright 2016-2022 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.
@@ -64,6 +64,7 @@ void setup() {
6464
String compositeBuildSuffix = getName().substring(TASK_NAME.length()); // see https://github.com/diffplug/spotless/pull/1001
6565
BuildServiceRegistry buildServices = getProject().getGradle().getSharedServices();
6666
getTaskService().set(buildServices.registerIfAbsent("SpotlessTaskService" + compositeBuildSuffix, SpotlessTaskService.class, spec -> {}));
67+
usesService(getTaskService());
6768
getBuildEventsListenerRegistry().onTaskCompletion(getTaskService());
6869
unitOutput = new File(getProject().getBuildDir(), "tmp/spotless-register-dependencies");
6970
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2021 DiffPlug
2+
* Copyright 2016-2022 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.
@@ -46,6 +46,7 @@ public abstract class SpotlessTaskImpl extends SpotlessTask {
4646
abstract DirectoryProperty getProjectDir();
4747

4848
void init(Provider<SpotlessTaskService> service) {
49+
usesService(service);
4950
getTaskService().set(service);
5051
getProjectDir().set(getProject().getProjectDir());
5152
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021 DiffPlug
2+
* Copyright 2021-2022 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.
@@ -105,6 +105,7 @@ static abstract class ClientTask extends DefaultTask {
105105
protected abstract ObjectFactory getConfigCacheWorkaround();
106106

107107
void init(SpotlessTaskImpl impl) {
108+
usesService(impl.getTaskService());
108109
getSpotlessOutDirectory().set(impl.getOutputDirectory());
109110
getTaskService().set(impl.getTaskService());
110111
getProjectDir().set(impl.getProjectDir());

0 commit comments

Comments
 (0)