Add OpenJDK distribution to external dependency report (#58187)
This commit is contained in:
parent
01795d1925
commit
5eb6692b0f
|
@ -23,7 +23,9 @@ import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.StandardOpenOption;
|
import java.nio.file.StandardOpenOption;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.gradle.api.DefaultTask;
|
import org.gradle.api.DefaultTask;
|
||||||
import org.gradle.api.file.FileTree;
|
import org.gradle.api.file.FileTree;
|
||||||
|
@ -50,6 +52,8 @@ public class ConcatFilesTask extends DefaultTask {
|
||||||
|
|
||||||
private File target;
|
private File target;
|
||||||
|
|
||||||
|
private List<String> additionalLines = new ArrayList<>();
|
||||||
|
|
||||||
public void setFiles(FileTree files) {
|
public void setFiles(FileTree files) {
|
||||||
this.files = files;
|
this.files = files;
|
||||||
}
|
}
|
||||||
|
@ -78,6 +82,15 @@ public class ConcatFilesTask extends DefaultTask {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Input
|
||||||
|
public List<String> getAdditionalLines() {
|
||||||
|
return additionalLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdditionalLines(List<String> additionalLines) {
|
||||||
|
this.additionalLines = additionalLines;
|
||||||
|
}
|
||||||
|
|
||||||
@TaskAction
|
@TaskAction
|
||||||
public void concatFiles() throws IOException {
|
public void concatFiles() throws IOException {
|
||||||
if (getHeaderLine() != null) {
|
if (getHeaderLine() != null) {
|
||||||
|
@ -90,6 +103,10 @@ public class ConcatFilesTask extends DefaultTask {
|
||||||
uniqueLines.addAll(Files.readAllLines(f.toPath(), StandardCharsets.UTF_8));
|
uniqueLines.addAll(Files.readAllLines(f.toPath(), StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
Files.write(getTarget().toPath(), uniqueLines, StandardCharsets.UTF_8, StandardOpenOption.APPEND);
|
Files.write(getTarget().toPath(), uniqueLines, StandardCharsets.UTF_8, StandardOpenOption.APPEND);
|
||||||
|
|
||||||
|
for (String additionalLine : additionalLines) {
|
||||||
|
Files.write(getTarget().toPath(), (additionalLine + '\n').getBytes(StandardCharsets.UTF_8), StandardOpenOption.APPEND);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,12 @@ tasks.register("generateDependenciesReport", ConcatFilesTask) {
|
||||||
files = fileTree(dir: project.rootDir, include: '**/dependencies.csv')
|
files = fileTree(dir: project.rootDir, include: '**/dependencies.csv')
|
||||||
headerLine = "name,version,url,license,sourceURL"
|
headerLine = "name,version,url,license,sourceURL"
|
||||||
target = new File(System.getProperty('csv') ?: "${project.buildDir}/reports/dependencies/es-dependencies.csv")
|
target = new File(System.getProperty('csv') ?: "${project.buildDir}/reports/dependencies/es-dependencies.csv")
|
||||||
|
|
||||||
|
// explicitly add our dependency on the JDK
|
||||||
|
String jdkVersion = VersionProperties.versions.get('bundled_jdk')
|
||||||
|
String jdkMajorVersion = jdkVersion.split('[+.]')[0]
|
||||||
|
String sourceUrl = "http://hg.openjdk.java.net/jdk-updates/jdk${jdkMajorVersion}u/archive/jdk-${jdkVersion}.tar.gz"
|
||||||
|
additionalLines << "OpenJDK,${jdkVersion},https://openjdk.java.net/,GPL-2.0-with-classpath-exception,${sourceUrl}".toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
Loading…
Reference in New Issue