|
28 | 28 | import org.gradle.api.file.FileTree;
|
29 | 29 | import org.gradle.api.specs.Spec;
|
30 | 30 | import org.gradle.api.tasks.CacheableTask;
|
| 31 | +import org.gradle.api.tasks.Classpath; |
31 | 32 | import org.gradle.api.tasks.Input;
|
32 | 33 | import org.gradle.api.tasks.InputFile;
|
33 | 34 | import org.gradle.api.tasks.InputFiles;
|
| 35 | +import org.gradle.api.tasks.Internal; |
34 | 36 | import org.gradle.api.tasks.Optional;
|
35 |
| -import org.gradle.api.tasks.OutputDirectory; |
| 37 | +import org.gradle.api.tasks.OutputFile; |
36 | 38 | import org.gradle.api.tasks.PathSensitive;
|
37 | 39 | import org.gradle.api.tasks.PathSensitivity;
|
38 | 40 | import org.gradle.api.tasks.SkipWhenEmpty;
|
|
45 | 47 | import java.net.URISyntaxException;
|
46 | 48 | import java.net.URL;
|
47 | 49 | import java.nio.charset.StandardCharsets;
|
| 50 | +import java.nio.file.Files; |
48 | 51 | import java.util.Arrays;
|
49 | 52 | import java.util.Collections;
|
50 | 53 | import java.util.Set;
|
@@ -113,14 +116,19 @@ public void setJavaHome(String javaHome) {
|
113 | 116 | this.javaHome = javaHome;
|
114 | 117 | }
|
115 | 118 |
|
116 |
| - @OutputDirectory |
| 119 | + @Internal |
117 | 120 | public File getJarExpandDir() {
|
118 | 121 | return new File(
|
119 | 122 | new File(getProject().getBuildDir(), "precommit/thirdPartyAudit"),
|
120 | 123 | getName()
|
121 | 124 | );
|
122 | 125 | }
|
123 | 126 |
|
| 127 | + @OutputFile |
| 128 | + public File getSuccessMarker() { |
| 129 | + return new File(getProject().getBuildDir(), "markers/" + getName()); |
| 130 | + } |
| 131 | + |
124 | 132 | public void ignoreMissingClasses(String... classesOrPackages) {
|
125 | 133 | if (classesOrPackages.length == 0) {
|
126 | 134 | missingClassExcludes = null;
|
@@ -157,8 +165,7 @@ public Set<String> getMissingClassExcludes() {
|
157 | 165 | return missingClassExcludes;
|
158 | 166 | }
|
159 | 167 |
|
160 |
| - @InputFiles |
161 |
| - @PathSensitive(PathSensitivity.NAME_ONLY) |
| 168 | + @Classpath |
162 | 169 | @SkipWhenEmpty
|
163 | 170 | public Set<File> getJarsToScan() {
|
164 | 171 | // These are SelfResolvingDependency, and some of them backed by file collections, like the Gradle API files,
|
@@ -241,6 +248,10 @@ public void runThirdPartyAudit() throws IOException {
|
241 | 248 | }
|
242 | 249 |
|
243 | 250 | assertNoJarHell(jdkJarHellClasses);
|
| 251 | + |
| 252 | + // Mark successful third party audit check |
| 253 | + getSuccessMarker().getParentFile().mkdirs(); |
| 254 | + Files.write(getSuccessMarker().toPath(), new byte[]{}); |
244 | 255 | }
|
245 | 256 |
|
246 | 257 | private void logForbiddenAPIsOutput(String forbiddenApisOutput) {
|
|
0 commit comments