parent
70ea3cf847
commit
a8aa818e00
|
@ -28,11 +28,13 @@ import org.gradle.api.artifacts.Dependency;
|
||||||
import org.gradle.api.file.FileTree;
|
import org.gradle.api.file.FileTree;
|
||||||
import org.gradle.api.specs.Spec;
|
import org.gradle.api.specs.Spec;
|
||||||
import org.gradle.api.tasks.CacheableTask;
|
import org.gradle.api.tasks.CacheableTask;
|
||||||
|
import org.gradle.api.tasks.Classpath;
|
||||||
import org.gradle.api.tasks.Input;
|
import org.gradle.api.tasks.Input;
|
||||||
import org.gradle.api.tasks.InputFile;
|
import org.gradle.api.tasks.InputFile;
|
||||||
import org.gradle.api.tasks.InputFiles;
|
import org.gradle.api.tasks.InputFiles;
|
||||||
|
import org.gradle.api.tasks.Internal;
|
||||||
import org.gradle.api.tasks.Optional;
|
import org.gradle.api.tasks.Optional;
|
||||||
import org.gradle.api.tasks.OutputDirectory;
|
import org.gradle.api.tasks.OutputFile;
|
||||||
import org.gradle.api.tasks.PathSensitive;
|
import org.gradle.api.tasks.PathSensitive;
|
||||||
import org.gradle.api.tasks.PathSensitivity;
|
import org.gradle.api.tasks.PathSensitivity;
|
||||||
import org.gradle.api.tasks.SkipWhenEmpty;
|
import org.gradle.api.tasks.SkipWhenEmpty;
|
||||||
|
@ -45,6 +47,7 @@ import java.io.IOException;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -113,7 +116,7 @@ public class ThirdPartyAuditTask extends DefaultTask {
|
||||||
this.javaHome = javaHome;
|
this.javaHome = javaHome;
|
||||||
}
|
}
|
||||||
|
|
||||||
@OutputDirectory
|
@Internal
|
||||||
public File getJarExpandDir() {
|
public File getJarExpandDir() {
|
||||||
return new File(
|
return new File(
|
||||||
new File(getProject().getBuildDir(), "precommit/thirdPartyAudit"),
|
new File(getProject().getBuildDir(), "precommit/thirdPartyAudit"),
|
||||||
|
@ -121,6 +124,11 @@ public class ThirdPartyAuditTask extends DefaultTask {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OutputFile
|
||||||
|
public File getSuccessMarker() {
|
||||||
|
return new File(getProject().getBuildDir(), "markers/" + getName());
|
||||||
|
}
|
||||||
|
|
||||||
public void ignoreMissingClasses(String... classesOrPackages) {
|
public void ignoreMissingClasses(String... classesOrPackages) {
|
||||||
if (classesOrPackages.length == 0) {
|
if (classesOrPackages.length == 0) {
|
||||||
missingClassExcludes = null;
|
missingClassExcludes = null;
|
||||||
|
@ -157,8 +165,7 @@ public class ThirdPartyAuditTask extends DefaultTask {
|
||||||
return missingClassExcludes;
|
return missingClassExcludes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@InputFiles
|
@Classpath
|
||||||
@PathSensitive(PathSensitivity.NAME_ONLY)
|
|
||||||
@SkipWhenEmpty
|
@SkipWhenEmpty
|
||||||
public Set<File> getJarsToScan() {
|
public Set<File> getJarsToScan() {
|
||||||
// These are SelfResolvingDependency, and some of them backed by file collections, like the Gradle API files,
|
// These are SelfResolvingDependency, and some of them backed by file collections, like the Gradle API files,
|
||||||
|
@ -241,6 +248,10 @@ public class ThirdPartyAuditTask extends DefaultTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
assertNoJarHell(jdkJarHellClasses);
|
assertNoJarHell(jdkJarHellClasses);
|
||||||
|
|
||||||
|
// Mark successful third party audit check
|
||||||
|
getSuccessMarker().getParentFile().mkdirs();
|
||||||
|
Files.write(getSuccessMarker().toPath(), new byte[]{});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logForbiddenAPIsOutput(String forbiddenApisOutput) {
|
private void logForbiddenAPIsOutput(String forbiddenApisOutput) {
|
||||||
|
|
Loading…
Reference in New Issue