|
1 | 1 | /*
|
2 |
| - * Copyright 2016-2020 DiffPlug |
| 2 | + * Copyright 2016-2021 DiffPlug |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -42,16 +42,13 @@ public void apply(Project project) {
|
42 | 42 | project.getExtensions().create(SpotlessExtension.class, SpotlessExtension.EXTENSION, SpotlessExtensionImpl.class, project);
|
43 | 43 |
|
44 | 44 | // clear spotless' cache when the user does a clean
|
45 |
| - project.getTasks().named(BasePlugin.CLEAN_TASK_NAME).configure(clean -> { |
46 |
| - clean.doLast(unused -> { |
47 |
| - // resolution for: https://github.com/diffplug/spotless/issues/243#issuecomment-564323856 |
48 |
| - // project.getRootProject() is consistent across every project, so only of one the clears will |
49 |
| - // actually happen (as desired) |
50 |
| - // |
51 |
| - // we use System.identityHashCode() to avoid a memory leak by hanging on to the reference directly |
52 |
| - SpotlessCache.clearOnce(System.identityHashCode(project.getRootProject())); |
53 |
| - }); |
54 |
| - }); |
| 45 | + // resolution for: https://github.com/diffplug/spotless/issues/243#issuecomment-564323856 |
| 46 | + // project.getRootProject() is consistent across every project, so only of one the clears will |
| 47 | + // actually happen (as desired) |
| 48 | + // |
| 49 | + // we use System.identityHashCode() to avoid a memory leak by hanging on to the reference directly |
| 50 | + int cacheKey = System.identityHashCode(project.getRootProject()); |
| 51 | + project.getTasks().named(BasePlugin.CLEAN_TASK_NAME).configure(clean -> clean.doLast(unused -> SpotlessCache.clearOnce(cacheKey))); |
55 | 52 | }
|
56 | 53 |
|
57 | 54 | static String capitalize(String input) {
|
|
0 commit comments