Refactor global build info plugin to leverage JavaInstallationRegistry (#54026)

This commit removes the configuration time vs execution time distinction
with regards to certain BuildParms properties. Because of the cost of
determining Java versions for configuration JDK locations we deferred
this until execution time. This had two main downsides. First, we had
to implement all this build logic in tasks, which required a bunch of
additional plumbing and complexity. Second, because some information
wasn't known during configuration time, we had to nest any build logic
that depended on this in awkward callbacks.

We now defer to the JavaInstallationRegistry recently added in Gradle.
This utility uses a much more efficient method for probing Java
installations vs our jrunscript implementation. This, combined with some
optimizations to avoid probing the current JVM as well as deferring
some evaluation via Providers when probing installations for BWC builds
we can maintain effectively the same configuration time performance
while removing a bunch of complexity and runtime cost (snapshotting
inputs for the GenerateGlobalBuildInfoTask was very expensive). The end
result should be a much more responsive build execution in almost all
scenarios.

(cherry picked from commit ecdbd37f2e0f0447ed574b306adb64c19adc3ce1)
This commit is contained in:
Mark Vieira 2020-03-23 15:30:10 -07:00 committed by GitHub
parent c97ee4e695
commit 70cfedf542
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 654 additions and 1032 deletions

View File

@ -103,9 +103,6 @@ be used to test against other JDKs as well, this is not only limited to JDK 8.
> Note: It is also required to have `JAVA8_HOME`, `JAVA9_HOME`, `JAVA10_HOME` > Note: It is also required to have `JAVA8_HOME`, `JAVA9_HOME`, `JAVA10_HOME`
and `JAVA11_HOME`, and `JAVA12_HOME` available so that the tests can pass. and `JAVA11_HOME`, and `JAVA12_HOME` available so that the tests can pass.
> Warning: do not use `sdkman` for Java installations which do not have proper
`jrunscript` for jdk distributions.
Elasticsearch uses the Gradle wrapper for its build. You can execute Gradle Elasticsearch uses the Gradle wrapper for its build. You can execute Gradle
using the wrapper via the `gradlew` script on Unix systems or `gradlew.bat` using the wrapper via the `gradlew` script on Unix systems or `gradlew.bat`
script on Windows in the root of the repository. The examples below show the script on Windows in the root of the repository. The examples below show the

View File

@ -31,7 +31,7 @@ import org.gradle.plugins.ide.eclipse.model.SourceFolder
import org.gradle.util.DistributionLocator import org.gradle.util.DistributionLocator
import org.gradle.util.GradleVersion import org.gradle.util.GradleVersion
import static org.elasticsearch.gradle.tool.Boilerplate.maybeConfigure import static org.elasticsearch.gradle.util.GradleUtils.maybeConfigure
plugins { plugins {
id 'lifecycle-base' id 'lifecycle-base'

View File

@ -26,16 +26,15 @@ import groovy.transform.CompileStatic
import org.apache.commons.io.IOUtils import org.apache.commons.io.IOUtils
import org.elasticsearch.gradle.info.BuildParams import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin
import org.elasticsearch.gradle.info.GlobalInfoExtension
import org.elasticsearch.gradle.info.JavaHome import org.elasticsearch.gradle.info.JavaHome
import org.elasticsearch.gradle.precommit.DependencyLicensesTask import org.elasticsearch.gradle.precommit.DependencyLicensesTask
import org.elasticsearch.gradle.precommit.PrecommitTasks import org.elasticsearch.gradle.precommit.PrecommitTasks
import org.elasticsearch.gradle.test.ErrorReportingTestListener import org.elasticsearch.gradle.test.ErrorReportingTestListener
import org.elasticsearch.gradle.testclusters.ElasticsearchCluster import org.elasticsearch.gradle.testclusters.ElasticsearchCluster
import org.elasticsearch.gradle.testclusters.TestClustersPlugin import org.elasticsearch.gradle.testclusters.TestClustersPlugin
import org.gradle.api.Action
import org.elasticsearch.gradle.testclusters.TestDistribution import org.elasticsearch.gradle.testclusters.TestDistribution
import org.elasticsearch.gradle.tool.Boilerplate import org.elasticsearch.gradle.util.GradleUtils
import org.gradle.api.Action
import org.gradle.api.GradleException import org.gradle.api.GradleException
import org.gradle.api.InvalidUserDataException import org.gradle.api.InvalidUserDataException
import org.gradle.api.JavaVersion import org.gradle.api.JavaVersion
@ -84,7 +83,7 @@ import org.gradle.util.GradleVersion
import java.nio.charset.StandardCharsets import java.nio.charset.StandardCharsets
import java.nio.file.Files import java.nio.file.Files
import static org.elasticsearch.gradle.tool.Boilerplate.maybeConfigure import static org.elasticsearch.gradle.util.GradleUtils.maybeConfigure
/** /**
* Encapsulates build configuration for elasticsearch projects. * Encapsulates build configuration for elasticsearch projects.
@ -146,7 +145,7 @@ class BuildPlugin implements Plugin<Project> {
// Common config when running with a FIPS-140 runtime JVM // Common config when running with a FIPS-140 runtime JVM
if (inFipsJvm()) { if (inFipsJvm()) {
// This configuration can be removed once system modules are available // This configuration can be removed once system modules are available
Boilerplate.maybeCreate(project.configurations, 'extraJars') { GradleUtils.maybeCreate(project.configurations, 'extraJars') {
project.dependencies.add('extraJars', "org.bouncycastle:bc-fips:1.0.1") project.dependencies.add('extraJars', "org.bouncycastle:bc-fips:1.0.1")
project.dependencies.add('extraJars', "org.bouncycastle:bctls-fips:1.0.9") project.dependencies.add('extraJars', "org.bouncycastle:bctls-fips:1.0.9")
} }
@ -156,7 +155,6 @@ class BuildPlugin implements Plugin<Project> {
File securityPolicy = buildResources.copy("fips_java.policy") File securityPolicy = buildResources.copy("fips_java.policy")
File security8Policy = buildResources.copy("fips_java8.policy") File security8Policy = buildResources.copy("fips_java8.policy")
File bcfksKeystore = buildResources.copy("cacerts.bcfks") File bcfksKeystore = buildResources.copy("cacerts.bcfks")
GlobalInfoExtension globalInfo = project.rootProject.extensions.getByType(GlobalInfoExtension)
project.pluginManager.withPlugin("elasticsearch.testclusters") { project.pluginManager.withPlugin("elasticsearch.testclusters") {
NamedDomainObjectContainer<ElasticsearchCluster> testClusters = project.extensions.findByName(TestClustersPlugin.EXTENSION_NAME) as NamedDomainObjectContainer<ElasticsearchCluster> NamedDomainObjectContainer<ElasticsearchCluster> testClusters = project.extensions.findByName(TestClustersPlugin.EXTENSION_NAME) as NamedDomainObjectContainer<ElasticsearchCluster>
if (testClusters != null) { if (testClusters != null) {
@ -165,14 +163,12 @@ class BuildPlugin implements Plugin<Project> {
for (File dep : project.getConfigurations().getByName("extraJars").getFiles()) { for (File dep : project.getConfigurations().getByName("extraJars").getFiles()) {
cluster.extraJarFile(dep) cluster.extraJarFile(dep)
} }
globalInfo.ready { if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_1_8) {
if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_1_8) { cluster.extraConfigFile("fips_java.security", securityProperties)
cluster.extraConfigFile("fips_java.security", securityProperties) cluster.extraConfigFile("fips_java.policy", securityPolicy)
cluster.extraConfigFile("fips_java.policy", securityPolicy) } else {
} else { cluster.extraConfigFile("fips_java.security", security8Properties)
cluster.extraConfigFile("fips_java.security", security8Properties) cluster.extraConfigFile("fips_java.policy", security8Policy)
cluster.extraConfigFile("fips_java.policy", security8Policy)
}
} }
cluster.extraConfigFile("cacerts.bcfks", bcfksKeystore) cluster.extraConfigFile("cacerts.bcfks", bcfksKeystore)
cluster.systemProperty('java.security.properties', '=${ES_PATH_CONF}/fips_java.security') cluster.systemProperty('java.security.properties', '=${ES_PATH_CONF}/fips_java.security')
@ -188,16 +184,14 @@ class BuildPlugin implements Plugin<Project> {
} }
project.tasks.withType(Test).configureEach { Test task -> project.tasks.withType(Test).configureEach { Test task ->
task.dependsOn(buildResources) task.dependsOn(buildResources)
globalInfo.ready { // Using the key==value format to override default JVM security settings and policy
// Using the key==value format to override default JVM security settings and policy // see also: https://docs.oracle.com/javase/8/docs/technotes/guides/security/PolicyFiles.html
// see also: https://docs.oracle.com/javase/8/docs/technotes/guides/security/PolicyFiles.html if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_1_8) {
if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_1_8) { task.systemProperty('java.security.properties', String.format(Locale.ROOT, "=%s", securityProperties.toString()))
task.systemProperty('java.security.properties', String.format(Locale.ROOT, "=%s", securityProperties.toString())) task.systemProperty('java.security.policy', String.format(Locale.ROOT, "=%s", securityPolicy.toString()))
task.systemProperty('java.security.policy', String.format(Locale.ROOT, "=%s", securityPolicy.toString())) } else {
} else { task.systemProperty('java.security.properties', String.format(Locale.ROOT, "=%s", security8Properties.toString()))
task.systemProperty('java.security.properties', String.format(Locale.ROOT, "=%s", security8Properties.toString())) task.systemProperty('java.security.policy', String.format(Locale.ROOT, "=%s", security8Policy.toString()))
task.systemProperty('java.security.policy', String.format(Locale.ROOT, "=%s", security8Policy.toString()))
}
} }
task.systemProperty('javax.net.ssl.trustStorePassword', 'password') task.systemProperty('javax.net.ssl.trustStorePassword', 'password')
task.systemProperty('javax.net.ssl.keyStorePassword', 'password') task.systemProperty('javax.net.ssl.keyStorePassword', 'password')
@ -258,7 +252,7 @@ class BuildPlugin implements Plugin<Project> {
static String getJavaHome(final Task task, final int version) { static String getJavaHome(final Task task, final int version) {
requireJavaHome(task, version) requireJavaHome(task, version)
JavaHome java = BuildParams.javaVersions.find { it.version == version } JavaHome java = BuildParams.javaVersions.find { it.version == version }
return java == null ? null : java.javaHome.absolutePath return java == null ? null : java.javaHome.get().absolutePath
} }
/** /**
@ -407,7 +401,7 @@ class BuildPlugin implements Plugin<Project> {
dependencyNode.appendNode('groupId', dependency.group) dependencyNode.appendNode('groupId', dependency.group)
dependencyNode.appendNode('artifactId', dependency.getDependencyProject().convention.getPlugin(BasePluginConvention).archivesBaseName) dependencyNode.appendNode('artifactId', dependency.getDependencyProject().convention.getPlugin(BasePluginConvention).archivesBaseName)
dependencyNode.appendNode('version', dependency.version) dependencyNode.appendNode('version', dependency.version)
dependencyNode.appendNode('scope', 'runtime') dependencyNode.appendNode('scope', 'compile')
} }
} }
} }
@ -426,13 +420,10 @@ class BuildPlugin implements Plugin<Project> {
/** Adds compiler settings to the project */ /** Adds compiler settings to the project */
static void configureCompile(Project project) { static void configureCompile(Project project) {
ExtraPropertiesExtension ext = project.extensions.getByType(ExtraPropertiesExtension) ExtraPropertiesExtension ext = project.extensions.getByType(ExtraPropertiesExtension)
GlobalInfoExtension globalBuildInfo = project.rootProject.extensions.getByType(GlobalInfoExtension) if (BuildParams.compilerJavaVersion < JavaVersion.VERSION_1_10) {
globalBuildInfo.ready { ext.set('compactProfile', 'compact3')
if (BuildParams.compilerJavaVersion < JavaVersion.VERSION_1_10) { } else {
ext.set('compactProfile', 'compact3') ext.set('compactProfile', 'full')
} else {
ext.set('compactProfile', 'full')
}
} }
ext.set('compactProfile', 'full') ext.set('compactProfile', 'full')
@ -450,12 +441,10 @@ class BuildPlugin implements Plugin<Project> {
compileTask.options.forkOptions.javaHome = BuildParams.compilerJavaHome compileTask.options.forkOptions.javaHome = BuildParams.compilerJavaHome
} }
if (targetCompatibilityVersion == JavaVersion.VERSION_1_8) { if (targetCompatibilityVersion == JavaVersion.VERSION_1_8) {
globalBuildInfo.ready { // compile with compact 3 profile by default
// compile with compact 3 profile by default // NOTE: this is just a compile time check: does not replace testing with a compact3 JRE
// NOTE: this is just a compile time check: does not replace testing with a compact3 JRE if (ext.get('compactProfile') != 'full') {
if (ext.get('compactProfile') != 'full') { compileTask.options.compilerArgs << '-profile' << ext.get('compactProfile').toString()
compileTask.options.compilerArgs << '-profile' << ext.get('compactProfile').toString()
}
} }
} }
/* /*
@ -657,16 +646,13 @@ class BuildPlugin implements Plugin<Project> {
project.mkdir(heapdumpDir) project.mkdir(heapdumpDir)
project.mkdir(test.workingDir) project.mkdir(test.workingDir)
project.mkdir(test.workingDir.toPath().resolve('temp')) project.mkdir(test.workingDir.toPath().resolve('temp'))
}
if (BuildParams.runtimeJavaVersion >= JavaVersion.VERSION_1_9) { //TODO remove once jvm.options are added to test system properties
test.jvmArgs '--illegal-access=warn' if (BuildParams.runtimeJavaVersion == JavaVersion.VERSION_1_8) {
} test.systemProperty ('java.locale.providers','SPI,JRE')
//TODO remove once jvm.options are added to test system properties } else if (BuildParams.runtimeJavaVersion >= JavaVersion.VERSION_1_9) {
if (BuildParams.runtimeJavaVersion == JavaVersion.VERSION_1_8) { test.systemProperty ('java.locale.providers','SPI,COMPAT')
test.systemProperty ('java.locale.providers','SPI,JRE') test.jvmArgs '--illegal-access=warn'
} else if (BuildParams.runtimeJavaVersion >= JavaVersion.VERSION_1_9) {
test.systemProperty ('java.locale.providers','SPI,COMPAT')
}
} }
if (inFipsJvm()) { if (inFipsJvm()) {
project.dependencies.add('testRuntimeOnly', "org.bouncycastle:bc-fips:1.0.1") project.dependencies.add('testRuntimeOnly', "org.bouncycastle:bc-fips:1.0.1")

View File

@ -143,16 +143,13 @@ class PrecommitTasks {
ExportElasticsearchBuildResourcesTask buildResources = project.tasks.getByName('buildResources') ExportElasticsearchBuildResourcesTask buildResources = project.tasks.getByName('buildResources')
project.tasks.withType(CheckForbiddenApis).configureEach { project.tasks.withType(CheckForbiddenApis).configureEach {
dependsOn(buildResources) dependsOn(buildResources)
doFirst { targetCompatibility = BuildParams.runtimeJavaVersion.majorVersion
// we need to defer this configuration since we don't know the runtime java version until execution time if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_13) {
targetCompatibility = BuildParams.runtimeJavaVersion.majorVersion project.logger.warn(
if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_13) { "Forbidden APIs does not support Java versions past 13. Will use the signatures from 13 for {}.",
project.logger.warn( BuildParams.runtimeJavaVersion
"Forbidden APIs does not support Java versions past 13. Will use the signatures from 13 for {}.", )
BuildParams.runtimeJavaVersion targetCompatibility = JavaVersion.VERSION_13.majorVersion
)
targetCompatibility = JavaVersion.VERSION_13.majorVersion
}
} }
bundledSignatures = [ bundledSignatures = [
"jdk-unsafe", "jdk-deprecated", "jdk-non-portable", "jdk-system-out" "jdk-unsafe", "jdk-deprecated", "jdk-non-portable", "jdk-system-out"

View File

@ -26,7 +26,7 @@ import org.elasticsearch.gradle.docker.DockerSupportPlugin;
import org.elasticsearch.gradle.docker.DockerSupportService; import org.elasticsearch.gradle.docker.DockerSupportService;
import org.elasticsearch.gradle.info.BuildParams; import org.elasticsearch.gradle.info.BuildParams;
import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin; import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin;
import org.elasticsearch.gradle.tool.Boilerplate; import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.GradleException; import org.gradle.api.GradleException;
import org.gradle.api.NamedDomainObjectContainer; import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.Plugin; import org.gradle.api.Plugin;
@ -53,7 +53,7 @@ import java.util.Map;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.function.Supplier; import java.util.function.Supplier;
import static org.elasticsearch.gradle.Util.capitalize; import static org.elasticsearch.gradle.util.Util.capitalize;
/** /**
* A plugin to manage getting and extracting distributions of Elasticsearch. * A plugin to manage getting and extracting distributions of Elasticsearch.
@ -78,7 +78,7 @@ public class DistributionDownloadPlugin implements Plugin<Project> {
project.getRootProject().getPluginManager().apply(GlobalBuildInfoPlugin.class); project.getRootProject().getPluginManager().apply(GlobalBuildInfoPlugin.class);
project.getRootProject().getPluginManager().apply(DockerSupportPlugin.class); project.getRootProject().getPluginManager().apply(DockerSupportPlugin.class);
Provider<DockerSupportService> dockerSupport = Boilerplate.getBuildService( Provider<DockerSupportService> dockerSupport = GradleUtils.getBuildService(
project.getGradle().getSharedServices(), project.getGradle().getSharedServices(),
DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME
); );

View File

@ -47,8 +47,8 @@ import java.util.Map;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.stream.StreamSupport; import java.util.stream.StreamSupport;
import static org.elasticsearch.gradle.tool.Boilerplate.findByName; import static org.elasticsearch.gradle.util.GradleUtils.findByName;
import static org.elasticsearch.gradle.tool.Boilerplate.maybeCreate; import static org.elasticsearch.gradle.util.GradleUtils.maybeCreate;
public class JdkDownloadPlugin implements Plugin<Project> { public class JdkDownloadPlugin implements Plugin<Project> {

View File

@ -1,293 +0,0 @@
package org.elasticsearch.gradle.info;
import org.elasticsearch.gradle.OS;
import org.gradle.api.DefaultTask;
import org.gradle.api.GradleException;
import org.gradle.api.JavaVersion;
import org.gradle.api.file.RegularFileProperty;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.tasks.CacheableTask;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputDirectory;
import org.gradle.api.tasks.Nested;
import org.gradle.api.tasks.OutputFile;
import org.gradle.api.tasks.PathSensitive;
import org.gradle.api.tasks.PathSensitivity;
import org.gradle.api.tasks.TaskAction;
import org.gradle.internal.jvm.Jvm;
import org.gradle.process.ExecResult;
import javax.inject.Inject;
import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.Writer;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import static java.nio.charset.StandardCharsets.UTF_8;
@CacheableTask
public class GenerateGlobalBuildInfoTask extends DefaultTask {
private JavaVersion minimumCompilerVersion;
private JavaVersion minimumRuntimeVersion;
private File compilerJavaHome;
private File runtimeJavaHome;
private List<JavaHome> javaVersions;
private final RegularFileProperty outputFile;
private final RegularFileProperty compilerVersionFile;
private final RegularFileProperty runtimeVersionFile;
@Inject
public GenerateGlobalBuildInfoTask(ObjectFactory objectFactory) {
this.outputFile = objectFactory.fileProperty();
this.compilerVersionFile = objectFactory.fileProperty();
this.runtimeVersionFile = objectFactory.fileProperty();
}
@Input
public JavaVersion getMinimumCompilerVersion() {
return minimumCompilerVersion;
}
public void setMinimumCompilerVersion(JavaVersion minimumCompilerVersion) {
this.minimumCompilerVersion = minimumCompilerVersion;
}
@Input
public JavaVersion getMinimumRuntimeVersion() {
return minimumRuntimeVersion;
}
public void setMinimumRuntimeVersion(JavaVersion minimumRuntimeVersion) {
this.minimumRuntimeVersion = minimumRuntimeVersion;
}
@InputDirectory
@PathSensitive(PathSensitivity.RELATIVE)
public File getCompilerJavaHome() {
return compilerJavaHome;
}
public void setCompilerJavaHome(File compilerJavaHome) {
this.compilerJavaHome = compilerJavaHome;
}
@InputDirectory
@PathSensitive(PathSensitivity.RELATIVE)
public File getRuntimeJavaHome() {
return runtimeJavaHome;
}
public void setRuntimeJavaHome(File runtimeJavaHome) {
this.runtimeJavaHome = runtimeJavaHome;
}
@Nested
public List<JavaHome> getJavaVersions() {
return javaVersions;
}
public void setJavaVersions(List<JavaHome> javaVersions) {
this.javaVersions = javaVersions;
}
@OutputFile
public RegularFileProperty getOutputFile() {
return outputFile;
}
@OutputFile
public RegularFileProperty getCompilerVersionFile() {
return compilerVersionFile;
}
@OutputFile
public RegularFileProperty getRuntimeVersionFile() {
return runtimeVersionFile;
}
@TaskAction
public void generate() {
String javaVendorVersion = System.getProperty("java.vendor.version", System.getProperty("java.vendor"));
String gradleJavaVersion = System.getProperty("java.version");
String gradleJavaVersionDetails = javaVendorVersion
+ " "
+ gradleJavaVersion
+ " ["
+ System.getProperty("java.vm.name")
+ " "
+ System.getProperty("java.vm.version")
+ "]";
String compilerJavaVersionDetails = gradleJavaVersionDetails;
JavaVersion compilerJavaVersionEnum = JavaVersion.current();
String runtimeJavaVersionDetails = gradleJavaVersionDetails;
JavaVersion runtimeJavaVersionEnum = JavaVersion.current();
File gradleJavaHome = Jvm.current().getJavaHome();
try {
if (Files.isSameFile(compilerJavaHome.toPath(), gradleJavaHome.toPath()) == false) {
if (compilerJavaHome.exists()) {
compilerJavaVersionDetails = findJavaVersionDetails(compilerJavaHome);
compilerJavaVersionEnum = JavaVersion.toVersion(findJavaSpecificationVersion(compilerJavaHome));
} else {
throw new RuntimeException("Compiler Java home path of '" + compilerJavaHome + "' does not exist");
}
}
if (Files.isSameFile(runtimeJavaHome.toPath(), gradleJavaHome.toPath()) == false) {
if (runtimeJavaHome.exists()) {
runtimeJavaVersionDetails = findJavaVersionDetails(runtimeJavaHome);
runtimeJavaVersionEnum = JavaVersion.toVersion(findJavaSpecificationVersion(runtimeJavaHome));
} else {
throw new RuntimeException("Runtime Java home path of '" + compilerJavaHome + "' does not exist");
}
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
try (BufferedWriter writer = new BufferedWriter(new FileWriter(outputFile.getAsFile().get()))) {
final String osName = System.getProperty("os.name");
final String osVersion = System.getProperty("os.version");
final String osArch = System.getProperty("os.arch");
final JavaVersion parsedVersion = JavaVersion.toVersion(gradleJavaVersion);
writer.write(" Gradle Version : " + getProject().getGradle().getGradleVersion() + "\n");
writer.write(" OS Info : " + osName + " " + osVersion + " (" + osArch + ")\n");
if (gradleJavaVersionDetails.equals(compilerJavaVersionDetails) == false
|| gradleJavaVersionDetails.equals(runtimeJavaVersionDetails) == false) {
writer.write(" Compiler JDK Version : " + compilerJavaVersionEnum + " (" + compilerJavaVersionDetails + ")\n");
writer.write(" Compiler java.home : " + compilerJavaHome + "\n");
writer.write(" Runtime JDK Version : " + runtimeJavaVersionEnum + " (" + runtimeJavaVersionDetails + ")\n");
writer.write(" Runtime java.home : " + runtimeJavaHome + "\n");
writer.write(" Gradle JDK Version : " + parsedVersion + " (" + gradleJavaVersionDetails + ")\n");
writer.write(" Gradle java.home : " + gradleJavaHome);
} else {
writer.write(" JDK Version : " + parsedVersion + " (" + gradleJavaVersionDetails + ")\n");
writer.write(" JAVA_HOME : " + gradleJavaHome);
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
// enforce Java version
if (compilerJavaVersionEnum.compareTo(minimumCompilerVersion) < 0) {
String message = String.format(
Locale.ROOT,
"The compiler java.home must be set to a JDK installation directory for Java %s but is [%s] " + "corresponding to [%s]",
minimumCompilerVersion,
compilerJavaHome,
compilerJavaVersionEnum
);
throw new GradleException(message);
}
if (runtimeJavaVersionEnum.compareTo(minimumRuntimeVersion) < 0) {
String message = String.format(
Locale.ROOT,
"The runtime java.home must be set to a JDK installation directory for Java %s but is [%s] " + "corresponding to [%s]",
minimumRuntimeVersion,
runtimeJavaHome,
runtimeJavaVersionEnum
);
throw new GradleException(message);
}
for (JavaHome javaVersion : javaVersions) {
File javaHome = javaVersion.getJavaHome();
if (javaHome == null) {
continue;
}
JavaVersion javaVersionEnum = JavaVersion.toVersion(findJavaSpecificationVersion(javaHome));
JavaVersion expectedJavaVersionEnum;
int version = javaVersion.getVersion();
if (version < 9) {
expectedJavaVersionEnum = JavaVersion.toVersion("1." + version);
} else {
expectedJavaVersionEnum = JavaVersion.toVersion(Integer.toString(version));
}
if (javaVersionEnum != expectedJavaVersionEnum) {
String message = String.format(
Locale.ROOT,
"The environment variable JAVA%d_HOME must be set to a JDK installation directory for Java"
+ " %s but is [%s] corresponding to [%s]",
version,
expectedJavaVersionEnum,
javaHome,
javaVersionEnum
);
throw new GradleException(message);
}
}
writeToFile(compilerVersionFile.getAsFile().get(), compilerJavaVersionEnum.name());
writeToFile(runtimeVersionFile.getAsFile().get(), runtimeJavaVersionEnum.name());
}
private void writeToFile(File file, String content) {
try (Writer writer = new FileWriter(file)) {
writer.write(content);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
/**
* Finds printable java version of the given JAVA_HOME
*/
private String findJavaVersionDetails(File javaHome) {
String versionInfoScript = "print("
+ "java.lang.System.getProperty(\"java.vendor.version\", java.lang.System.getProperty(\"java.vendor\")) + \" \" + "
+ "java.lang.System.getProperty(\"java.version\") + \" [\" + "
+ "java.lang.System.getProperty(\"java.vm.name\") + \" \" + "
+ "java.lang.System.getProperty(\"java.vm.version\") + \"]\");";
return runJavaAsScript(javaHome, versionInfoScript).trim();
}
/**
* Finds the parsable java specification version
*/
private String findJavaSpecificationVersion(File javaHome) {
String versionScript = "print(java.lang.System.getProperty(\"java.specification.version\"));";
return runJavaAsScript(javaHome, versionScript);
}
/**
* Runs the given javascript using jjs from the jdk, and returns the output
*/
private String runJavaAsScript(File javaHome, String script) {
ByteArrayOutputStream stdout = new ByteArrayOutputStream();
ByteArrayOutputStream stderr = new ByteArrayOutputStream();
if (OS.current() == OS.WINDOWS) {
// gradle/groovy does not properly escape the double quote for windows
script = script.replace("\"", "\\\"");
}
File jrunscriptPath = new File(javaHome, "bin/jrunscript");
String finalScript = script;
ExecResult result = getProject().exec(spec -> {
spec.setExecutable(jrunscriptPath);
spec.args("-e", finalScript);
spec.setStandardOutput(stdout);
spec.setErrorOutput(stderr);
spec.setIgnoreExitValue(true);
});
if (result.getExitValue() != 0) {
getLogger().error("STDOUT:");
Arrays.stream(stdout.toString(UTF_8).split(System.getProperty("line.separator"))).forEach(getLogger()::error);
getLogger().error("STDERR:");
Arrays.stream(stderr.toString(UTF_8).split(System.getProperty("line.separator"))).forEach(getLogger()::error);
result.rethrowFailure();
}
return stdout.toString(UTF_8).trim();
}
}

View File

@ -1,18 +1,27 @@
package org.elasticsearch.gradle.info; package org.elasticsearch.gradle.info;
import org.elasticsearch.gradle.OS; import org.elasticsearch.gradle.OS;
import org.elasticsearch.gradle.util.Util;
import org.gradle.api.GradleException; import org.gradle.api.GradleException;
import org.gradle.api.JavaVersion; import org.gradle.api.JavaVersion;
import org.gradle.api.Plugin; import org.gradle.api.Plugin;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.Provider;
import org.gradle.api.provider.ProviderFactory;
import org.gradle.internal.jvm.Jvm; import org.gradle.internal.jvm.Jvm;
import org.gradle.jvm.toolchain.JavaInstallation;
import org.gradle.jvm.toolchain.JavaInstallationRegistry;
import org.gradle.util.GradleVersion;
import javax.inject.Inject;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UncheckedIOException; import java.io.UncheckedIOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
@ -33,23 +42,146 @@ import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
public class GlobalBuildInfoPlugin implements Plugin<Project> { public class GlobalBuildInfoPlugin implements Plugin<Project> {
private static final String GLOBAL_INFO_EXTENSION_NAME = "globalInfo"; private static final Logger LOGGER = Logging.getLogger(GlobalBuildInfoPlugin.class);
private static Integer _defaultParallel = null; private static Integer _defaultParallel = null;
private final JavaInstallationRegistry javaInstallationRegistry;
private final ObjectFactory objects;
private final ProviderFactory providers;
@Inject
public GlobalBuildInfoPlugin(JavaInstallationRegistry javaInstallationRegistry, ObjectFactory objects, ProviderFactory providers) {
this.javaInstallationRegistry = javaInstallationRegistry;
this.objects = objects;
this.providers = providers;
}
@Override @Override
public void apply(Project project) { public void apply(Project project) {
if (project != project.getRootProject()) { if (project != project.getRootProject()) {
throw new IllegalStateException(this.getClass().getName() + " can only be applied to the root project."); throw new IllegalStateException(this.getClass().getName() + " can only be applied to the root project.");
} }
GlobalInfoExtension extension = project.getExtensions().create(GLOBAL_INFO_EXTENSION_NAME, GlobalInfoExtension.class); JavaVersion minimumCompilerVersion = JavaVersion.toVersion(Util.getResourceContents("/minimumCompilerVersion"));
JavaVersion minimumRuntimeVersion = JavaVersion.toVersion(Util.getResourceContents("/minimumRuntimeVersion"));
JavaVersion minimumCompilerVersion = JavaVersion.toVersion(getResourceContents("/minimumCompilerVersion"));
JavaVersion minimumRuntimeVersion = JavaVersion.toVersion(getResourceContents("/minimumRuntimeVersion"));
File compilerJavaHome = findCompilerJavaHome(); File compilerJavaHome = findCompilerJavaHome();
File runtimeJavaHome = findRuntimeJavaHome(compilerJavaHome); File runtimeJavaHome = findRuntimeJavaHome(compilerJavaHome);
// Initialize global build parameters
BuildParams.init(params -> {
params.reset();
params.setCompilerJavaHome(compilerJavaHome);
params.setRuntimeJavaHome(runtimeJavaHome);
params.setCompilerJavaVersion(determineJavaVersion("compiler java.home", compilerJavaHome, minimumCompilerVersion));
params.setRuntimeJavaVersion(determineJavaVersion("runtime java.home", runtimeJavaHome, minimumRuntimeVersion));
params.setIsRutimeJavaHomeSet(compilerJavaHome.equals(runtimeJavaHome) == false);
params.setJavaVersions(getAvailableJavaVersions(minimumCompilerVersion));
params.setMinimumCompilerVersion(minimumCompilerVersion);
params.setMinimumRuntimeVersion(minimumRuntimeVersion);
params.setGradleJavaVersion(Jvm.current().getJavaVersion());
params.setGitRevision(gitRevision(project.getRootProject().getRootDir()));
params.setBuildDate(ZonedDateTime.now(ZoneOffset.UTC));
params.setTestSeed(getTestSeed());
params.setIsCi(System.getenv("JENKINS_URL") != null);
params.setIsInternal(GlobalBuildInfoPlugin.class.getResource("/buildSrc.marker") != null);
params.setDefaultParallel(findDefaultParallel(project));
params.setInFipsJvm(Util.getBooleanProperty("tests.fips.enabled", false));
params.setIsSnapshotBuild(Util.getBooleanProperty("build.snapshot", true));
});
// Print global build info header just before task execution
project.getGradle().getTaskGraph().whenReady(graph -> logGlobalBuildInfo());
}
private void logGlobalBuildInfo() {
final String osName = System.getProperty("os.name");
final String osVersion = System.getProperty("os.version");
final String osArch = System.getProperty("os.arch");
final Jvm gradleJvm = Jvm.current();
final String gradleJvmDetails = getJavaInstallation(gradleJvm.getJavaHome()).getImplementationName();
LOGGER.quiet("=======================================");
LOGGER.quiet("Elasticsearch Build Hamster says Hello!");
LOGGER.quiet(" Gradle Version : " + GradleVersion.current().getVersion());
LOGGER.quiet(" OS Info : " + osName + " " + osVersion + " (" + osArch + ")");
if (Jvm.current().getJavaVersion().equals(BuildParams.getCompilerJavaVersion()) == false || BuildParams.getIsRuntimeJavaHomeSet()) {
String compilerJvmDetails = getJavaInstallation(BuildParams.getCompilerJavaHome()).getImplementationName();
String runtimeJvmDetails = getJavaInstallation(BuildParams.getRuntimeJavaHome()).getImplementationName();
LOGGER.quiet(" Compiler JDK Version : " + BuildParams.getCompilerJavaVersion() + " (" + compilerJvmDetails + ")");
LOGGER.quiet(" Compiler java.home : " + BuildParams.getCompilerJavaHome());
LOGGER.quiet(" Runtime JDK Version : " + BuildParams.getRuntimeJavaVersion() + " (" + runtimeJvmDetails + ")");
LOGGER.quiet(" Runtime java.home : " + BuildParams.getRuntimeJavaHome());
LOGGER.quiet(" Gradle JDK Version : " + gradleJvm.getJavaVersion() + " (" + gradleJvmDetails + ")");
LOGGER.quiet(" Gradle java.home : " + gradleJvm.getJavaHome());
} else {
LOGGER.quiet(" JDK Version : " + gradleJvm.getJavaVersion() + " (" + gradleJvmDetails + ")");
LOGGER.quiet(" JAVA_HOME : " + gradleJvm.getJavaHome());
}
LOGGER.quiet(" Random Testing Seed : " + BuildParams.getTestSeed());
LOGGER.quiet(" In FIPS 140 mode : " + BuildParams.isInFipsJvm());
LOGGER.quiet("=======================================");
}
private JavaVersion determineJavaVersion(String description, File javaHome, JavaVersion requiredVersion) {
JavaInstallation installation = getJavaInstallation(javaHome);
JavaVersion actualVersion = installation.getJavaVersion();
if (actualVersion.isCompatibleWith(requiredVersion) == false) {
throwInvalidJavaHomeException(
description,
javaHome,
Integer.parseInt(requiredVersion.getMajorVersion()),
Integer.parseInt(actualVersion.getMajorVersion())
);
}
return actualVersion;
}
private JavaInstallation getJavaInstallation(File javaHome) {
JavaInstallation installation;
if (isCurrentJavaHome(javaHome)) {
installation = javaInstallationRegistry.getInstallationForCurrentVirtualMachine().get();
} else {
installation = javaInstallationRegistry.installationForDirectory(objects.directoryProperty().fileValue(javaHome)).get();
}
return installation;
}
private List<JavaHome> getAvailableJavaVersions(JavaVersion minimumCompilerVersion) {
final List<JavaHome> javaVersions = new ArrayList<>();
for (int v = 8; v <= Integer.parseInt(minimumCompilerVersion.getMajorVersion()); v++) {
int version = v;
String javaHomeEnvVarName = getJavaHomeEnvVarName(Integer.toString(version));
if (System.getenv(javaHomeEnvVarName) != null) {
File javaHomeDirectory = new File(findJavaHome(Integer.toString(version)));
Provider<JavaInstallation> javaInstallationProvider = javaInstallationRegistry.installationForDirectory(
objects.directoryProperty().fileValue(javaHomeDirectory)
);
JavaHome javaHome = JavaHome.of(version, providers.provider(() -> {
int actualVersion = Integer.parseInt(javaInstallationProvider.get().getJavaVersion().getMajorVersion());
if (actualVersion != version) {
throwInvalidJavaHomeException("env variable " + javaHomeEnvVarName, javaHomeDirectory, version, actualVersion);
}
return javaHomeDirectory;
}));
javaVersions.add(javaHome);
}
}
return javaVersions;
}
private static boolean isCurrentJavaHome(File javaHome) {
try {
return Files.isSameFile(javaHome.toPath(), Jvm.current().getJavaHome().toPath());
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
private static String getTestSeed() {
String testSeedProperty = System.getProperty("tests.seed"); String testSeedProperty = System.getProperty("tests.seed");
final String testSeed; final String testSeed;
if (testSeedProperty == null) { if (testSeedProperty == null) {
@ -58,77 +190,20 @@ public class GlobalBuildInfoPlugin implements Plugin<Project> {
} else { } else {
testSeed = testSeedProperty; testSeed = testSeedProperty;
} }
return testSeed;
}
final String buildSnapshotSystemProperty = System.getProperty("build.snapshot", "true"); private static void throwInvalidJavaHomeException(String description, File javaHome, int expectedVersion, int actualVersion) {
final boolean isSnapshotBuild; String message = String.format(
switch (buildSnapshotSystemProperty) { Locale.ROOT,
case "true": "The %s must be set to a JDK installation directory for Java %d but is [%s] corresponding to [%s]",
isSnapshotBuild = true; description,
break; expectedVersion,
case "false": javaHome,
isSnapshotBuild = false; actualVersion
break;
default:
throw new IllegalArgumentException(
"build.snapshot was set to [" + buildSnapshotSystemProperty + "] but can only be unset or [true|false]"
);
}
final List<JavaHome> javaVersions = new ArrayList<>();
for (int version = 8; version <= Integer.parseInt(minimumCompilerVersion.getMajorVersion()); version++) {
if (System.getenv(getJavaHomeEnvVarName(Integer.toString(version))) != null) {
javaVersions.add(JavaHome.of(version, new File(findJavaHome(Integer.toString(version)))));
}
}
GenerateGlobalBuildInfoTask generateTask = project.getTasks()
.create("generateGlobalBuildInfo", GenerateGlobalBuildInfoTask.class, task -> {
task.setJavaVersions(javaVersions);
task.setMinimumCompilerVersion(minimumCompilerVersion);
task.setMinimumRuntimeVersion(minimumRuntimeVersion);
task.setCompilerJavaHome(compilerJavaHome);
task.setRuntimeJavaHome(runtimeJavaHome);
task.getOutputFile().set(new File(project.getBuildDir(), "global-build-info"));
task.getCompilerVersionFile().set(new File(project.getBuildDir(), "java-compiler-version"));
task.getRuntimeVersionFile().set(new File(project.getBuildDir(), "java-runtime-version"));
});
PrintGlobalBuildInfoTask printTask = project.getTasks().create("printGlobalBuildInfo", PrintGlobalBuildInfoTask.class, task -> {
task.getBuildInfoFile().set(generateTask.getOutputFile());
task.getCompilerVersionFile().set(generateTask.getCompilerVersionFile());
task.getRuntimeVersionFile().set(generateTask.getRuntimeVersionFile());
task.setGlobalInfoListeners(extension.listeners);
});
// Initialize global build parameters
BuildParams.init(params -> {
params.reset();
params.setCompilerJavaHome(compilerJavaHome);
params.setRuntimeJavaHome(runtimeJavaHome);
params.setIsRutimeJavaHomeSet(compilerJavaHome.equals(runtimeJavaHome) == false);
params.setJavaVersions(javaVersions);
params.setMinimumCompilerVersion(minimumCompilerVersion);
params.setMinimumRuntimeVersion(minimumRuntimeVersion);
params.setGradleJavaVersion(Jvm.current().getJavaVersion());
params.setGitRevision(gitRevision(project.getRootProject().getRootDir()));
params.setBuildDate(ZonedDateTime.now(ZoneOffset.UTC));
params.setTestSeed(testSeed);
params.setIsCi(System.getenv("JENKINS_URL") != null);
params.setIsInternal(GlobalBuildInfoPlugin.class.getResource("/buildSrc.marker") != null);
params.setDefaultParallel(findDefaultParallel(project));
params.setInFipsJvm(isInFipsJvm());
params.setIsSnapshotBuild(isSnapshotBuild);
});
project.allprojects(
p -> {
// Make sure than any task execution generates and prints build info
p.getTasks().configureEach(task -> {
if (task != generateTask && task != printTask) {
task.dependsOn(printTask);
}
});
}
); );
throw new GradleException(message);
} }
private static File findCompilerJavaHome() { private static File findCompilerJavaHome() {
@ -174,28 +249,6 @@ public class GlobalBuildInfoPlugin implements Plugin<Project> {
return "JAVA" + version + "_HOME"; return "JAVA" + version + "_HOME";
} }
private static boolean isInFipsJvm() {
return Boolean.parseBoolean(System.getProperty("tests.fips.enabled"));
}
private static String getResourceContents(String resourcePath) {
try (
BufferedReader reader = new BufferedReader(new InputStreamReader(GlobalBuildInfoPlugin.class.getResourceAsStream(resourcePath)))
) {
StringBuilder b = new StringBuilder();
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
if (b.length() != 0) {
b.append('\n');
}
b.append(line);
}
return b.toString();
} catch (IOException e) {
throw new UncheckedIOException("Error trying to read classpath resource: " + resourcePath, e);
}
}
private static int findDefaultParallel(Project project) { private static int findDefaultParallel(Project project) {
// Since it costs IO to compute this, and is done at configuration time we want to cache this if possible // Since it costs IO to compute this, and is done at configuration time we want to cache this if possible
// It's safe to store this in a static variable since it's just a primitive so leaking memory isn't an issue // It's safe to store this in a static variable since it's just a primitive so leaking memory isn't an issue

View File

@ -1,12 +0,0 @@
package org.elasticsearch.gradle.info;
import java.util.ArrayList;
import java.util.List;
public class GlobalInfoExtension {
final List<Runnable> listeners = new ArrayList<>();
public void ready(Runnable block) {
listeners.add(block);
}
}

View File

@ -1,75 +0,0 @@
package org.elasticsearch.gradle.info;
import org.gradle.api.DefaultTask;
import org.gradle.api.JavaVersion;
import org.gradle.api.file.RegularFileProperty;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.resources.TextResource;
import org.gradle.api.tasks.InputFile;
import org.gradle.api.tasks.TaskAction;
import javax.inject.Inject;
import java.util.ArrayList;
import java.util.List;
public class PrintGlobalBuildInfoTask extends DefaultTask {
private final RegularFileProperty buildInfoFile;
private final RegularFileProperty compilerVersionFile;
private final RegularFileProperty runtimeVersionFile;
private List<Runnable> globalInfoListeners = new ArrayList<>();
@Inject
public PrintGlobalBuildInfoTask(ObjectFactory objectFactory) {
this.buildInfoFile = objectFactory.fileProperty();
this.compilerVersionFile = objectFactory.fileProperty();
this.runtimeVersionFile = objectFactory.fileProperty();
}
@InputFile
public RegularFileProperty getBuildInfoFile() {
return buildInfoFile;
}
@InputFile
public RegularFileProperty getCompilerVersionFile() {
return compilerVersionFile;
}
@InputFile
public RegularFileProperty getRuntimeVersionFile() {
return runtimeVersionFile;
}
public void setGlobalInfoListeners(List<Runnable> globalInfoListeners) {
this.globalInfoListeners = globalInfoListeners;
}
@TaskAction
public void print() {
getLogger().quiet("=======================================");
getLogger().quiet("Elasticsearch Build Hamster says Hello!");
getLogger().quiet(getFileText(getBuildInfoFile()).asString());
getLogger().quiet(" Random Testing Seed : " + BuildParams.getTestSeed());
getLogger().quiet(" In FIPS 140 mode : " + BuildParams.isInFipsJvm());
getLogger().quiet("=======================================");
setGlobalProperties();
globalInfoListeners.forEach(Runnable::run);
// Since all tasks depend on this task, and it always runs for every build, this makes sure that lifecycle tasks will still
// correctly report as UP-TO-DATE, since the convention is a lifecycle task (i.e. assemble, build, etc) will only be marked as
// UP-TO-DATE if all upstream tasks were also UP-TO-DATE.
setDidWork(false);
}
private TextResource getFileText(RegularFileProperty regularFileProperty) {
return getProject().getResources().getText().fromFile(regularFileProperty.getAsFile().get());
}
private void setGlobalProperties() {
BuildParams.init(params -> {
params.setCompilerJavaVersion(JavaVersion.valueOf(getFileText(getCompilerVersionFile()).asString()));
params.setRuntimeJavaVersion(JavaVersion.valueOf(getFileText(getRuntimeVersionFile()).asString()));
});
}
}

View File

@ -28,7 +28,7 @@ import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.tools.ant.taskdefs.condition.Os; import org.apache.tools.ant.taskdefs.condition.Os;
import org.elasticsearch.gradle.tool.Boilerplate; import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.DefaultTask; import org.gradle.api.DefaultTask;
import org.gradle.api.GradleException; import org.gradle.api.GradleException;
import org.gradle.api.file.FileCollection; import org.gradle.api.file.FileCollection;
@ -80,7 +80,7 @@ public class FilePermissionsTask extends DefaultTask {
@InputFiles @InputFiles
@SkipWhenEmpty @SkipWhenEmpty
public FileCollection getFiles() { public FileCollection getFiles() {
return Boilerplate.getJavaSourceSets(getProject()) return GradleUtils.getJavaSourceSets(getProject())
.stream() .stream()
.map(sourceSet -> sourceSet.getAllSource().matching(filesFilter)) .map(sourceSet -> sourceSet.getAllSource().matching(filesFilter))
.reduce(FileTree::plus) .reduce(FileTree::plus)

View File

@ -19,7 +19,7 @@
package org.elasticsearch.gradle.precommit; package org.elasticsearch.gradle.precommit;
import groovy.lang.Closure; import groovy.lang.Closure;
import org.elasticsearch.gradle.tool.Boilerplate; import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.DefaultTask; import org.gradle.api.DefaultTask;
import org.gradle.api.NamedDomainObjectContainer; import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.Task; import org.gradle.api.Task;
@ -65,7 +65,7 @@ public class TestingConventionsTasks extends DefaultTask {
public TestingConventionsTasks() { public TestingConventionsTasks() {
setDescription("Tests various testing conventions"); setDescription("Tests various testing conventions");
// Run only after everything is compiled // Run only after everything is compiled
Boilerplate.getJavaSourceSets(getProject()).all(sourceSet -> dependsOn(sourceSet.getOutput().getClassesDirs())); GradleUtils.getJavaSourceSets(getProject()).all(sourceSet -> dependsOn(sourceSet.getOutput().getClassesDirs()));
naming = getProject().container(TestingConventionRule.class); naming = getProject().container(TestingConventionRule.class);
} }
@ -81,7 +81,7 @@ public class TestingConventionsTasks extends DefaultTask {
@Input @Input
public Map<String, File> getTestClassNames() { public Map<String, File> getTestClassNames() {
if (testClassNames == null) { if (testClassNames == null) {
testClassNames = Boilerplate.getJavaSourceSets(getProject()) testClassNames = GradleUtils.getJavaSourceSets(getProject())
.getByName("test") .getByName("test")
.getOutput() .getOutput()
.getClassesDirs() .getClassesDirs()
@ -110,7 +110,7 @@ public class TestingConventionsTasks extends DefaultTask {
@Input @Input
public Set<String> getMainClassNamedLikeTests() { public Set<String> getMainClassNamedLikeTests() {
SourceSetContainer javaSourceSets = Boilerplate.getJavaSourceSets(getProject()); SourceSetContainer javaSourceSets = GradleUtils.getJavaSourceSets(getProject());
if (javaSourceSets.findByName(SourceSet.MAIN_SOURCE_SET_NAME) == null) { if (javaSourceSets.findByName(SourceSet.MAIN_SOURCE_SET_NAME) == null) {
// some test projects don't have a main source set // some test projects don't have a main source set
return Collections.emptySet(); return Collections.emptySet();
@ -351,7 +351,7 @@ public class TestingConventionsTasks extends DefaultTask {
// running the tests. // running the tests.
return getProject().files( return getProject().files(
getProject().getConfigurations().getByName("testRuntime").resolve(), getProject().getConfigurations().getByName("testRuntime").resolve(),
Boilerplate.getJavaSourceSets(getProject()) GradleUtils.getJavaSourceSets(getProject())
.stream() .stream()
.flatMap(sourceSet -> sourceSet.getOutput().getClassesDirs().getFiles().stream()) .flatMap(sourceSet -> sourceSet.getOutput().getClassesDirs().getFiles().stream())
.collect(Collectors.toList()) .collect(Collectors.toList())

View File

@ -32,7 +32,7 @@ import org.elasticsearch.gradle.VersionProperties;
import org.elasticsearch.gradle.docker.DockerSupportPlugin; import org.elasticsearch.gradle.docker.DockerSupportPlugin;
import org.elasticsearch.gradle.docker.DockerSupportService; import org.elasticsearch.gradle.docker.DockerSupportService;
import org.elasticsearch.gradle.info.BuildParams; import org.elasticsearch.gradle.info.BuildParams;
import org.elasticsearch.gradle.tool.Boilerplate; import org.elasticsearch.gradle.util.GradleUtils;
import org.elasticsearch.gradle.vagrant.BatsProgressLogger; import org.elasticsearch.gradle.vagrant.BatsProgressLogger;
import org.elasticsearch.gradle.vagrant.VagrantBasePlugin; import org.elasticsearch.gradle.vagrant.VagrantBasePlugin;
import org.elasticsearch.gradle.vagrant.VagrantExtension; import org.elasticsearch.gradle.vagrant.VagrantExtension;
@ -88,7 +88,7 @@ public class DistroTestPlugin implements Plugin<Project> {
project.getPluginManager().apply(DistributionDownloadPlugin.class); project.getPluginManager().apply(DistributionDownloadPlugin.class);
project.getPluginManager().apply("elasticsearch.build"); project.getPluginManager().apply("elasticsearch.build");
Provider<DockerSupportService> dockerSupport = Boilerplate.getBuildService( Provider<DockerSupportService> dockerSupport = GradleUtils.getBuildService(
project.getGradle().getSharedServices(), project.getGradle().getSharedServices(),
DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME
); );

View File

@ -20,7 +20,7 @@ package org.elasticsearch.gradle.test.rest;
import org.elasticsearch.gradle.VersionProperties; import org.elasticsearch.gradle.VersionProperties;
import org.elasticsearch.gradle.info.BuildParams; import org.elasticsearch.gradle.info.BuildParams;
import org.elasticsearch.gradle.tool.Boilerplate; import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.DefaultTask; import org.gradle.api.DefaultTask;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.Configuration;
@ -203,6 +203,6 @@ public class CopyRestApiTask extends DefaultTask {
} }
private SourceSet getTestSourceSet() { private SourceSet getTestSourceSet() {
return Boilerplate.getJavaSourceSets(getProject()).findByName("test"); return GradleUtils.getJavaSourceSets(getProject()).findByName("test");
} }
} }

View File

@ -20,7 +20,7 @@ package org.elasticsearch.gradle.test.rest;
import org.elasticsearch.gradle.VersionProperties; import org.elasticsearch.gradle.VersionProperties;
import org.elasticsearch.gradle.info.BuildParams; import org.elasticsearch.gradle.info.BuildParams;
import org.elasticsearch.gradle.tool.Boilerplate; import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.DefaultTask; import org.gradle.api.DefaultTask;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.Configuration;
@ -146,6 +146,6 @@ public class CopyRestTestsTask extends DefaultTask {
} }
private SourceSet getTestSourceSet() { private SourceSet getTestSourceSet() {
return Boilerplate.getJavaSourceSets(getProject()).findByName("test"); return GradleUtils.getJavaSourceSets(getProject()).findByName("test");
} }
} }

View File

@ -1,6 +1,6 @@
package org.elasticsearch.gradle.testclusters; package org.elasticsearch.gradle.testclusters;
import org.elasticsearch.gradle.tool.Boilerplate; import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.provider.Provider; import org.gradle.api.provider.Provider;
import org.gradle.api.services.internal.BuildServiceRegistryInternal; import org.gradle.api.services.internal.BuildServiceRegistryInternal;
import org.gradle.api.tasks.CacheableTask; import org.gradle.api.tasks.CacheableTask;
@ -62,7 +62,7 @@ public class RestTestRunnerTask extends Test implements TestClustersAware {
public List<ResourceLock> getSharedResources() { public List<ResourceLock> getSharedResources() {
List<ResourceLock> locks = new ArrayList<>(super.getSharedResources()); List<ResourceLock> locks = new ArrayList<>(super.getSharedResources());
BuildServiceRegistryInternal serviceRegistry = getServices().get(BuildServiceRegistryInternal.class); BuildServiceRegistryInternal serviceRegistry = getServices().get(BuildServiceRegistryInternal.class);
Provider<TestClustersThrottle> throttleProvider = Boilerplate.getBuildService(serviceRegistry, THROTTLE_SERVICE_NAME); Provider<TestClustersThrottle> throttleProvider = GradleUtils.getBuildService(serviceRegistry, THROTTLE_SERVICE_NAME);
SharedResource resource = serviceRegistry.forService(throttleProvider); SharedResource resource = serviceRegistry.forService(throttleProvider);
int nodeCount = clusters.stream().mapToInt(cluster -> cluster.getNodes().size()).sum(); int nodeCount = clusters.stream().mapToInt(cluster -> cluster.getNodes().size()).sum();

View File

@ -25,7 +25,7 @@ import org.elasticsearch.gradle.JdkDownloadPlugin;
import org.elasticsearch.gradle.OS; import org.elasticsearch.gradle.OS;
import org.elasticsearch.gradle.ReaperPlugin; import org.elasticsearch.gradle.ReaperPlugin;
import org.elasticsearch.gradle.ReaperService; import org.elasticsearch.gradle.ReaperService;
import org.elasticsearch.gradle.tool.Boilerplate; import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.NamedDomainObjectContainer; import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.Plugin; import org.gradle.api.Plugin;
import org.gradle.api.Project; import org.gradle.api.Project;
@ -40,7 +40,7 @@ import org.gradle.api.tasks.TaskState;
import java.io.File; import java.io.File;
import static org.elasticsearch.gradle.tool.Boilerplate.noop; import static org.elasticsearch.gradle.util.GradleUtils.noop;
public class TestClustersPlugin implements Plugin<Project> { public class TestClustersPlugin implements Plugin<Project> {
@ -121,7 +121,7 @@ public class TestClustersPlugin implements Plugin<Project> {
throw new IllegalStateException(this.getClass().getName() + " can only be applied to the root project."); throw new IllegalStateException(this.getClass().getName() + " can only be applied to the root project.");
} }
Provider<TestClustersRegistry> registryProvider = Boilerplate.getBuildService( Provider<TestClustersRegistry> registryProvider = GradleUtils.getBuildService(
project.getGradle().getSharedServices(), project.getGradle().getSharedServices(),
REGISTRY_SERVICE_NAME REGISTRY_SERVICE_NAME
); );

View File

@ -29,7 +29,7 @@ import org.elasticsearch.gradle.docker.DockerSupportPlugin;
import org.elasticsearch.gradle.docker.DockerSupportService; import org.elasticsearch.gradle.docker.DockerSupportService;
import org.elasticsearch.gradle.info.BuildParams; import org.elasticsearch.gradle.info.BuildParams;
import org.elasticsearch.gradle.precommit.TestingConventionsTasks; import org.elasticsearch.gradle.precommit.TestingConventionsTasks;
import org.elasticsearch.gradle.tool.Boilerplate; import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.Action; import org.gradle.api.Action;
import org.gradle.api.DefaultTask; import org.gradle.api.DefaultTask;
import org.gradle.api.Plugin; import org.gradle.api.Plugin;
@ -67,7 +67,7 @@ public class TestFixturesPlugin implements Plugin<Project> {
.getSharedServices() .getSharedServices()
.registerIfAbsent(DOCKER_COMPOSE_THROTTLE, DockerComposeThrottle.class, spec -> spec.getMaxParallelUsages().set(1)); .registerIfAbsent(DOCKER_COMPOSE_THROTTLE, DockerComposeThrottle.class, spec -> spec.getMaxParallelUsages().set(1));
Provider<DockerSupportService> dockerSupport = Boilerplate.getBuildService( Provider<DockerSupportService> dockerSupport = GradleUtils.getBuildService(
project.getGradle().getSharedServices(), project.getGradle().getSharedServices(),
DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME
); );

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.elasticsearch.gradle.tool; package org.elasticsearch.gradle.util;
import org.gradle.api.Action; import org.gradle.api.Action;
import org.gradle.api.GradleException; import org.gradle.api.GradleException;
@ -36,7 +36,7 @@ import org.gradle.api.tasks.TaskProvider;
import java.util.Optional; import java.util.Optional;
public abstract class Boilerplate { public abstract class GradleUtils {
public static <T> Action<T> noop() { public static <T> Action<T> noop() {
return t -> {}; return t -> {};

View File

@ -7,7 +7,7 @@
* not use this file except in compliance with the License. * not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
@ -17,10 +17,15 @@
* under the License. * under the License.
*/ */
package org.elasticsearch.gradle; package org.elasticsearch.gradle.util;
import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin;
import org.gradle.api.GradleException; import org.gradle.api.GradleException;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.Locale; import java.util.Locale;
public class Util { public class Util {
@ -39,6 +44,24 @@ public class Util {
} }
} }
public static String getResourceContents(String resourcePath) {
try (
BufferedReader reader = new BufferedReader(new InputStreamReader(GlobalBuildInfoPlugin.class.getResourceAsStream(resourcePath)))
) {
StringBuilder b = new StringBuilder();
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
if (b.length() != 0) {
b.append('\n');
}
b.append(line);
}
return b.toString();
} catch (IOException e) {
throw new UncheckedIOException("Error trying to read classpath resource: " + resourcePath, e);
}
}
public static String capitalize(String s) { public static String capitalize(String s) {
return s.substring(0, 1).toUpperCase(Locale.ROOT) + s.substring(1); return s.substring(0, 1).toUpperCase(Locale.ROOT) + s.substring(1);
} }

View File

@ -23,7 +23,7 @@ import org.apache.commons.io.output.TeeOutputStream;
import org.elasticsearch.gradle.LoggedExec; import org.elasticsearch.gradle.LoggedExec;
import org.elasticsearch.gradle.LoggingOutputStream; import org.elasticsearch.gradle.LoggingOutputStream;
import org.elasticsearch.gradle.ReaperService; import org.elasticsearch.gradle.ReaperService;
import org.elasticsearch.gradle.Util; import org.elasticsearch.gradle.util.Util;
import org.gradle.api.Action; import org.gradle.api.Action;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.internal.logging.progress.ProgressLogger; import org.gradle.internal.logging.progress.ProgressLogger;

View File

@ -3,11 +3,6 @@ package org.elasticsearch.gradle.info;
import org.gradle.api.JavaVersion; import org.gradle.api.JavaVersion;
import java.io.File; import java.io.File;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.Arrays; import java.util.Arrays;
@ -75,12 +70,10 @@ public class BuildParams {
return value(gradleJavaVersion); return value(gradleJavaVersion);
} }
@ExecutionTime
public static JavaVersion getCompilerJavaVersion() { public static JavaVersion getCompilerJavaVersion() {
return value(compilerJavaVersion); return value(compilerJavaVersion);
} }
@ExecutionTime
public static JavaVersion getRuntimeJavaVersion() { public static JavaVersion getRuntimeJavaVersion() {
return value(runtimeJavaVersion); return value(runtimeJavaVersion);
} }
@ -120,22 +113,13 @@ public class BuildParams {
private static <T> T value(T object) { private static <T> T value(T object) {
if (object == null) { if (object == null) {
String callingMethod = Thread.currentThread().getStackTrace()[2].getMethodName(); String callingMethod = Thread.currentThread().getStackTrace()[2].getMethodName();
boolean executionTime;
try {
executionTime = BuildParams.class.getMethod(callingMethod).getAnnotation(ExecutionTime.class) != null;
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
String message = "Build parameter '" + propertyName(callingMethod) + "' has not been initialized. "; throw new IllegalStateException(
if (executionTime) { "Build parameter '"
message += "This property is initialized at execution time, " + propertyName(callingMethod)
+ "please ensure you are not attempting to access it during project configuration."; + "' has not been initialized.\n"
} else { + "Perhaps the plugin responsible for initializing this property has not been applied."
message += "Perhaps the plugin responsible for initializing this property has not been applied."; );
}
throw new IllegalStateException(message);
} }
return object; return object;
@ -236,14 +220,4 @@ public class BuildParams {
} }
} }
/**
* Indicates that a build parameter is initialized at task execution time and is not available at project configuration time.
* Attempts to read an uninitialized parameter wil result in an {@link IllegalStateException}.
*/
@Target({ ElementType.METHOD, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface ExecutionTime {
}
} }

View File

@ -1,35 +1,27 @@
package org.elasticsearch.gradle.info; package org.elasticsearch.gradle.info;
import org.gradle.api.tasks.Input; import org.gradle.api.provider.Provider;
import org.gradle.api.tasks.InputDirectory;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.PathSensitive;
import org.gradle.api.tasks.PathSensitivity;
import java.io.File; import java.io.File;
public class JavaHome { public class JavaHome {
private Integer version; private Integer version;
private File javaHome; private Provider<File> javaHome;
private JavaHome(int version, File javaHome) { private JavaHome(int version, Provider<File> javaHome) {
this.version = version; this.version = version;
this.javaHome = javaHome; this.javaHome = javaHome;
} }
public static JavaHome of(int version, File javaHome) { public static JavaHome of(int version, Provider<File> javaHome) {
return new JavaHome(version, javaHome); return new JavaHome(version, javaHome);
} }
@Input
public Integer getVersion() { public Integer getVersion() {
return version; return version;
} }
@InputDirectory public Provider<File> getJavaHome() {
@Optional
@PathSensitive(PathSensitivity.RELATIVE)
public File getJavaHome() {
return javaHome; return javaHome;
} }
} }

View File

@ -108,7 +108,7 @@ idea {
not use this file except in compliance with the License. not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an software distributed under the License is distributed on an

View File

@ -49,12 +49,10 @@ if (!isEclipse) {
} }
forbiddenApisJava9 { forbiddenApisJava9 {
rootProject.globalInfo.ready { if (BuildParams.runtimeJavaVersion < JavaVersion.VERSION_1_9) {
if (BuildParams.runtimeJavaVersion < JavaVersion.VERSION_1_9) { targetCompatibility = JavaVersion.VERSION_1_9.getMajorVersion()
targetCompatibility = JavaVersion.VERSION_1_9.getMajorVersion()
}
replaceSignatureFiles 'jdk-signatures'
} }
replaceSignatureFiles 'jdk-signatures'
} }
jar { jar {

View File

@ -53,7 +53,7 @@ dependencies {
compile 'org.codehaus.jackson:jackson-xc:1.9.2' compile 'org.codehaus.jackson:jackson-xc:1.9.2'
// HACK: javax.xml.bind was removed from default modules in java 9, so we pull the api in here, // HACK: javax.xml.bind was removed from default modules in java 9, so we pull the api in here,
// and whitelist this hack in JarHell // and whitelist this hack in JarHell
compile 'javax.xml.bind:jaxb-api:2.2.2' compile 'javax.xml.bind:jaxb-api:2.2.2'
} }
@ -142,121 +142,119 @@ thirdPartyAudit.ignoreMissingClasses(
) )
// jarhell with jdk (intentionally, because jaxb was removed from default modules in java 9) // jarhell with jdk (intentionally, because jaxb was removed from default modules in java 9)
rootProject.globalInfo.ready { if (BuildParams.runtimeJavaVersion <= JavaVersion.VERSION_1_8) {
if (BuildParams.runtimeJavaVersion <= JavaVersion.VERSION_1_8) { thirdPartyAudit.ignoreJarHellWithJDK(
thirdPartyAudit.ignoreJarHellWithJDK( 'javax.xml.bind.Binder',
'javax.xml.bind.Binder', 'javax.xml.bind.ContextFinder$1',
'javax.xml.bind.ContextFinder$1', 'javax.xml.bind.ContextFinder',
'javax.xml.bind.ContextFinder', 'javax.xml.bind.DataBindingException',
'javax.xml.bind.DataBindingException', 'javax.xml.bind.DatatypeConverter',
'javax.xml.bind.DatatypeConverter', 'javax.xml.bind.DatatypeConverterImpl$CalendarFormatter',
'javax.xml.bind.DatatypeConverterImpl$CalendarFormatter', 'javax.xml.bind.DatatypeConverterImpl',
'javax.xml.bind.DatatypeConverterImpl', 'javax.xml.bind.DatatypeConverterInterface',
'javax.xml.bind.DatatypeConverterInterface', 'javax.xml.bind.Element',
'javax.xml.bind.Element', 'javax.xml.bind.GetPropertyAction',
'javax.xml.bind.GetPropertyAction', 'javax.xml.bind.JAXB$Cache',
'javax.xml.bind.JAXB$Cache', 'javax.xml.bind.JAXB',
'javax.xml.bind.JAXB', 'javax.xml.bind.JAXBContext',
'javax.xml.bind.JAXBContext', 'javax.xml.bind.JAXBElement$GlobalScope',
'javax.xml.bind.JAXBElement$GlobalScope', 'javax.xml.bind.JAXBElement',
'javax.xml.bind.JAXBElement', 'javax.xml.bind.JAXBException',
'javax.xml.bind.JAXBException', 'javax.xml.bind.JAXBIntrospector',
'javax.xml.bind.JAXBIntrospector', 'javax.xml.bind.JAXBPermission',
'javax.xml.bind.JAXBPermission', 'javax.xml.bind.MarshalException',
'javax.xml.bind.MarshalException', 'javax.xml.bind.Marshaller$Listener',
'javax.xml.bind.Marshaller$Listener', 'javax.xml.bind.Marshaller',
'javax.xml.bind.Marshaller', 'javax.xml.bind.Messages',
'javax.xml.bind.Messages', 'javax.xml.bind.NotIdentifiableEvent',
'javax.xml.bind.NotIdentifiableEvent', 'javax.xml.bind.ParseConversionEvent',
'javax.xml.bind.ParseConversionEvent', 'javax.xml.bind.PrintConversionEvent',
'javax.xml.bind.PrintConversionEvent', 'javax.xml.bind.PropertyException',
'javax.xml.bind.PropertyException', 'javax.xml.bind.SchemaOutputResolver',
'javax.xml.bind.SchemaOutputResolver', 'javax.xml.bind.TypeConstraintException',
'javax.xml.bind.TypeConstraintException', 'javax.xml.bind.UnmarshalException',
'javax.xml.bind.UnmarshalException', 'javax.xml.bind.Unmarshaller$Listener',
'javax.xml.bind.Unmarshaller$Listener', 'javax.xml.bind.Unmarshaller',
'javax.xml.bind.Unmarshaller', 'javax.xml.bind.UnmarshallerHandler',
'javax.xml.bind.UnmarshallerHandler', 'javax.xml.bind.ValidationEvent',
'javax.xml.bind.ValidationEvent', 'javax.xml.bind.ValidationEventHandler',
'javax.xml.bind.ValidationEventHandler', 'javax.xml.bind.ValidationEventLocator',
'javax.xml.bind.ValidationEventLocator', 'javax.xml.bind.ValidationException',
'javax.xml.bind.ValidationException', 'javax.xml.bind.Validator',
'javax.xml.bind.Validator', 'javax.xml.bind.WhiteSpaceProcessor',
'javax.xml.bind.WhiteSpaceProcessor', 'javax.xml.bind.annotation.DomHandler',
'javax.xml.bind.annotation.DomHandler', 'javax.xml.bind.annotation.W3CDomHandler',
'javax.xml.bind.annotation.W3CDomHandler', 'javax.xml.bind.annotation.XmlAccessOrder',
'javax.xml.bind.annotation.XmlAccessOrder', 'javax.xml.bind.annotation.XmlAccessType',
'javax.xml.bind.annotation.XmlAccessType', 'javax.xml.bind.annotation.XmlAccessorOrder',
'javax.xml.bind.annotation.XmlAccessorOrder', 'javax.xml.bind.annotation.XmlAccessorType',
'javax.xml.bind.annotation.XmlAccessorType', 'javax.xml.bind.annotation.XmlAnyAttribute',
'javax.xml.bind.annotation.XmlAnyAttribute', 'javax.xml.bind.annotation.XmlAnyElement',
'javax.xml.bind.annotation.XmlAnyElement', 'javax.xml.bind.annotation.XmlAttachmentRef',
'javax.xml.bind.annotation.XmlAttachmentRef', 'javax.xml.bind.annotation.XmlAttribute',
'javax.xml.bind.annotation.XmlAttribute', 'javax.xml.bind.annotation.XmlElement$DEFAULT',
'javax.xml.bind.annotation.XmlElement$DEFAULT', 'javax.xml.bind.annotation.XmlElement',
'javax.xml.bind.annotation.XmlElement', 'javax.xml.bind.annotation.XmlElementDecl$GLOBAL',
'javax.xml.bind.annotation.XmlElementDecl$GLOBAL', 'javax.xml.bind.annotation.XmlElementDecl',
'javax.xml.bind.annotation.XmlElementDecl', 'javax.xml.bind.annotation.XmlElementRef$DEFAULT',
'javax.xml.bind.annotation.XmlElementRef$DEFAULT', 'javax.xml.bind.annotation.XmlElementRef',
'javax.xml.bind.annotation.XmlElementRef', 'javax.xml.bind.annotation.XmlElementRefs',
'javax.xml.bind.annotation.XmlElementRefs', 'javax.xml.bind.annotation.XmlElementWrapper',
'javax.xml.bind.annotation.XmlElementWrapper', 'javax.xml.bind.annotation.XmlElements',
'javax.xml.bind.annotation.XmlElements', 'javax.xml.bind.annotation.XmlEnum',
'javax.xml.bind.annotation.XmlEnum', 'javax.xml.bind.annotation.XmlEnumValue',
'javax.xml.bind.annotation.XmlEnumValue', 'javax.xml.bind.annotation.XmlID',
'javax.xml.bind.annotation.XmlID', 'javax.xml.bind.annotation.XmlIDREF',
'javax.xml.bind.annotation.XmlIDREF', 'javax.xml.bind.annotation.XmlInlineBinaryData',
'javax.xml.bind.annotation.XmlInlineBinaryData', 'javax.xml.bind.annotation.XmlList',
'javax.xml.bind.annotation.XmlList', 'javax.xml.bind.annotation.XmlMimeType',
'javax.xml.bind.annotation.XmlMimeType', 'javax.xml.bind.annotation.XmlMixed',
'javax.xml.bind.annotation.XmlMixed', 'javax.xml.bind.annotation.XmlNs',
'javax.xml.bind.annotation.XmlNs', 'javax.xml.bind.annotation.XmlNsForm',
'javax.xml.bind.annotation.XmlNsForm', 'javax.xml.bind.annotation.XmlRegistry',
'javax.xml.bind.annotation.XmlRegistry', 'javax.xml.bind.annotation.XmlRootElement',
'javax.xml.bind.annotation.XmlRootElement', 'javax.xml.bind.annotation.XmlSchema',
'javax.xml.bind.annotation.XmlSchema', 'javax.xml.bind.annotation.XmlSchemaType$DEFAULT',
'javax.xml.bind.annotation.XmlSchemaType$DEFAULT', 'javax.xml.bind.annotation.XmlSchemaType',
'javax.xml.bind.annotation.XmlSchemaType', 'javax.xml.bind.annotation.XmlSchemaTypes',
'javax.xml.bind.annotation.XmlSchemaTypes', 'javax.xml.bind.annotation.XmlSeeAlso',
'javax.xml.bind.annotation.XmlSeeAlso', 'javax.xml.bind.annotation.XmlTransient',
'javax.xml.bind.annotation.XmlTransient', 'javax.xml.bind.annotation.XmlType$DEFAULT',
'javax.xml.bind.annotation.XmlType$DEFAULT', 'javax.xml.bind.annotation.XmlType',
'javax.xml.bind.annotation.XmlType', 'javax.xml.bind.annotation.XmlValue',
'javax.xml.bind.annotation.XmlValue', 'javax.xml.bind.annotation.adapters.CollapsedStringAdapter',
'javax.xml.bind.annotation.adapters.CollapsedStringAdapter', 'javax.xml.bind.annotation.adapters.HexBinaryAdapter',
'javax.xml.bind.annotation.adapters.HexBinaryAdapter', 'javax.xml.bind.annotation.adapters.NormalizedStringAdapter',
'javax.xml.bind.annotation.adapters.NormalizedStringAdapter', 'javax.xml.bind.annotation.adapters.XmlAdapter',
'javax.xml.bind.annotation.adapters.XmlAdapter', 'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter$DEFAULT',
'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter$DEFAULT', 'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter',
'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter', 'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters',
'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters', 'javax.xml.bind.attachment.AttachmentMarshaller',
'javax.xml.bind.attachment.AttachmentMarshaller', 'javax.xml.bind.attachment.AttachmentUnmarshaller',
'javax.xml.bind.attachment.AttachmentUnmarshaller', 'javax.xml.bind.helpers.AbstractMarshallerImpl',
'javax.xml.bind.helpers.AbstractMarshallerImpl', 'javax.xml.bind.helpers.AbstractUnmarshallerImpl',
'javax.xml.bind.helpers.AbstractUnmarshallerImpl', 'javax.xml.bind.helpers.DefaultValidationEventHandler',
'javax.xml.bind.helpers.DefaultValidationEventHandler', 'javax.xml.bind.helpers.Messages',
'javax.xml.bind.helpers.Messages', 'javax.xml.bind.helpers.NotIdentifiableEventImpl',
'javax.xml.bind.helpers.NotIdentifiableEventImpl', 'javax.xml.bind.helpers.ParseConversionEventImpl',
'javax.xml.bind.helpers.ParseConversionEventImpl', 'javax.xml.bind.helpers.PrintConversionEventImpl',
'javax.xml.bind.helpers.PrintConversionEventImpl', 'javax.xml.bind.helpers.ValidationEventImpl',
'javax.xml.bind.helpers.ValidationEventImpl', 'javax.xml.bind.helpers.ValidationEventLocatorImpl',
'javax.xml.bind.helpers.ValidationEventLocatorImpl', 'javax.xml.bind.util.JAXBResult',
'javax.xml.bind.util.JAXBResult', 'javax.xml.bind.util.JAXBSource$1',
'javax.xml.bind.util.JAXBSource$1', 'javax.xml.bind.util.JAXBSource',
'javax.xml.bind.util.JAXBSource', 'javax.xml.bind.util.Messages',
'javax.xml.bind.util.Messages', 'javax.xml.bind.util.ValidationEventCollector'
'javax.xml.bind.util.ValidationEventCollector' )
) } else {
} else { thirdPartyAudit.ignoreMissingClasses(
thirdPartyAudit.ignoreMissingClasses( 'javax.activation.ActivationDataFlavor',
'javax.activation.ActivationDataFlavor', 'javax.activation.DataContentHandler',
'javax.activation.DataContentHandler', 'javax.activation.DataHandler',
'javax.activation.DataHandler', 'javax.activation.DataSource',
'javax.activation.DataSource', 'javax.activation.FileDataSource',
'javax.activation.FileDataSource', 'javax.activation.FileTypeMap',
'javax.activation.FileTypeMap', 'javax.activation.MimeType',
'javax.activation.MimeType', 'javax.activation.MimeTypeParseException',
'javax.activation.MimeTypeParseException', )
)
}
} }

View File

@ -117,11 +117,9 @@ thirdPartyAudit.ignoreMissingClasses(
'org.apache.log.Logger' 'org.apache.log.Logger'
) )
rootProject.globalInfo.ready { if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_1_8) {
if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_1_8) { thirdPartyAudit.ignoreMissingClasses(
thirdPartyAudit.ignoreMissingClasses( 'javax.xml.bind.DatatypeConverter',
'javax.xml.bind.DatatypeConverter', 'javax.xml.bind.JAXBContext'
'javax.xml.bind.JAXBContext' )
)
}
} }

View File

@ -114,10 +114,8 @@ for (String fixtureName : ['hdfsFixture', 'haHdfsFixture', 'secureHdfsFixture',
// If it's a secure fixture, then depend on Kerberos Fixture and principals + add the krb5conf to the JVM options // If it's a secure fixture, then depend on Kerberos Fixture and principals + add the krb5conf to the JVM options
if (fixtureName.equals('secureHdfsFixture') || fixtureName.equals('secureHaHdfsFixture')) { if (fixtureName.equals('secureHdfsFixture') || fixtureName.equals('secureHaHdfsFixture')) {
miniHDFSArgs.add("-Djava.security.krb5.conf=${project(':test:fixtures:krb5kdc-fixture').ext.krb5Conf("hdfs")}"); miniHDFSArgs.add("-Djava.security.krb5.conf=${project(':test:fixtures:krb5kdc-fixture').ext.krb5Conf("hdfs")}");
rootProject.globalInfo.ready { if (BuildParams.runtimeJavaVersion == JavaVersion.VERSION_1_9) {
if (BuildParams.runtimeJavaVersion == JavaVersion.VERSION_1_9) { miniHDFSArgs.add('--add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED')
miniHDFSArgs.add('--add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED')
}
} }
} }
// If it's an HA fixture, set a nameservice to use in the JVM options // If it's an HA fixture, set a nameservice to use in the JVM options

View File

@ -49,7 +49,7 @@ dependencies {
compile "joda-time:joda-time:${versions.joda}" compile "joda-time:joda-time:${versions.joda}"
// HACK: javax.xml.bind was removed from default modules in java 9, so we pull the api in here, // HACK: javax.xml.bind was removed from default modules in java 9, so we pull the api in here,
// and whitelist this hack in JarHell // and whitelist this hack in JarHell
compile 'javax.xml.bind:jaxb-api:2.2.2' compile 'javax.xml.bind:jaxb-api:2.2.2'
testCompile project(':test:fixtures:s3-fixture') testCompile project(':test:fixtures:s3-fixture')
@ -299,7 +299,7 @@ thirdPartyAudit.ignoreMissingClasses(
'software.amazon.ion.system.IonSystemBuilder', 'software.amazon.ion.system.IonSystemBuilder',
'software.amazon.ion.system.IonTextWriterBuilder', 'software.amazon.ion.system.IonTextWriterBuilder',
'software.amazon.ion.system.IonWriterBuilder', 'software.amazon.ion.system.IonWriterBuilder',
// We don't use the kms dependency // We don't use the kms dependency
'com.amazonaws.services.kms.AWSKMS', 'com.amazonaws.services.kms.AWSKMS',
'com.amazonaws.services.kms.AWSKMSClient', 'com.amazonaws.services.kms.AWSKMSClient',
'com.amazonaws.services.kms.model.DecryptRequest', 'com.amazonaws.services.kms.model.DecryptRequest',
@ -311,112 +311,110 @@ thirdPartyAudit.ignoreMissingClasses(
) )
// jarhell with jdk (intentionally, because jaxb was removed from default modules in java 9) // jarhell with jdk (intentionally, because jaxb was removed from default modules in java 9)
rootProject.globalInfo.ready { if (BuildParams.runtimeJavaVersion <= JavaVersion.VERSION_1_8) {
if (BuildParams.runtimeJavaVersion <= JavaVersion.VERSION_1_8) { thirdPartyAudit.ignoreJarHellWithJDK(
thirdPartyAudit.ignoreJarHellWithJDK( 'javax.xml.bind.Binder',
'javax.xml.bind.Binder', 'javax.xml.bind.ContextFinder$1',
'javax.xml.bind.ContextFinder$1', 'javax.xml.bind.ContextFinder',
'javax.xml.bind.ContextFinder', 'javax.xml.bind.DataBindingException',
'javax.xml.bind.DataBindingException', 'javax.xml.bind.DatatypeConverter',
'javax.xml.bind.DatatypeConverter', 'javax.xml.bind.DatatypeConverterImpl$CalendarFormatter',
'javax.xml.bind.DatatypeConverterImpl$CalendarFormatter', 'javax.xml.bind.DatatypeConverterImpl',
'javax.xml.bind.DatatypeConverterImpl', 'javax.xml.bind.DatatypeConverterInterface',
'javax.xml.bind.DatatypeConverterInterface', 'javax.xml.bind.Element',
'javax.xml.bind.Element', 'javax.xml.bind.GetPropertyAction',
'javax.xml.bind.GetPropertyAction', 'javax.xml.bind.JAXB$Cache',
'javax.xml.bind.JAXB$Cache', 'javax.xml.bind.JAXB',
'javax.xml.bind.JAXB', 'javax.xml.bind.JAXBContext',
'javax.xml.bind.JAXBContext', 'javax.xml.bind.JAXBElement$GlobalScope',
'javax.xml.bind.JAXBElement$GlobalScope', 'javax.xml.bind.JAXBElement',
'javax.xml.bind.JAXBElement', 'javax.xml.bind.JAXBException',
'javax.xml.bind.JAXBException', 'javax.xml.bind.JAXBIntrospector',
'javax.xml.bind.JAXBIntrospector', 'javax.xml.bind.JAXBPermission',
'javax.xml.bind.JAXBPermission', 'javax.xml.bind.MarshalException',
'javax.xml.bind.MarshalException', 'javax.xml.bind.Marshaller$Listener',
'javax.xml.bind.Marshaller$Listener', 'javax.xml.bind.Marshaller',
'javax.xml.bind.Marshaller', 'javax.xml.bind.Messages',
'javax.xml.bind.Messages', 'javax.xml.bind.NotIdentifiableEvent',
'javax.xml.bind.NotIdentifiableEvent', 'javax.xml.bind.ParseConversionEvent',
'javax.xml.bind.ParseConversionEvent', 'javax.xml.bind.PrintConversionEvent',
'javax.xml.bind.PrintConversionEvent', 'javax.xml.bind.PropertyException',
'javax.xml.bind.PropertyException', 'javax.xml.bind.SchemaOutputResolver',
'javax.xml.bind.SchemaOutputResolver', 'javax.xml.bind.TypeConstraintException',
'javax.xml.bind.TypeConstraintException', 'javax.xml.bind.UnmarshalException',
'javax.xml.bind.UnmarshalException', 'javax.xml.bind.Unmarshaller$Listener',
'javax.xml.bind.Unmarshaller$Listener', 'javax.xml.bind.Unmarshaller',
'javax.xml.bind.Unmarshaller', 'javax.xml.bind.UnmarshallerHandler',
'javax.xml.bind.UnmarshallerHandler', 'javax.xml.bind.ValidationEvent',
'javax.xml.bind.ValidationEvent', 'javax.xml.bind.ValidationEventHandler',
'javax.xml.bind.ValidationEventHandler', 'javax.xml.bind.ValidationEventLocator',
'javax.xml.bind.ValidationEventLocator', 'javax.xml.bind.ValidationException',
'javax.xml.bind.ValidationException', 'javax.xml.bind.Validator',
'javax.xml.bind.Validator', 'javax.xml.bind.WhiteSpaceProcessor',
'javax.xml.bind.WhiteSpaceProcessor', 'javax.xml.bind.annotation.DomHandler',
'javax.xml.bind.annotation.DomHandler', 'javax.xml.bind.annotation.W3CDomHandler',
'javax.xml.bind.annotation.W3CDomHandler', 'javax.xml.bind.annotation.XmlAccessOrder',
'javax.xml.bind.annotation.XmlAccessOrder', 'javax.xml.bind.annotation.XmlAccessType',
'javax.xml.bind.annotation.XmlAccessType', 'javax.xml.bind.annotation.XmlAccessorOrder',
'javax.xml.bind.annotation.XmlAccessorOrder', 'javax.xml.bind.annotation.XmlAccessorType',
'javax.xml.bind.annotation.XmlAccessorType', 'javax.xml.bind.annotation.XmlAnyAttribute',
'javax.xml.bind.annotation.XmlAnyAttribute', 'javax.xml.bind.annotation.XmlAnyElement',
'javax.xml.bind.annotation.XmlAnyElement', 'javax.xml.bind.annotation.XmlAttachmentRef',
'javax.xml.bind.annotation.XmlAttachmentRef', 'javax.xml.bind.annotation.XmlAttribute',
'javax.xml.bind.annotation.XmlAttribute', 'javax.xml.bind.annotation.XmlElement$DEFAULT',
'javax.xml.bind.annotation.XmlElement$DEFAULT', 'javax.xml.bind.annotation.XmlElement',
'javax.xml.bind.annotation.XmlElement', 'javax.xml.bind.annotation.XmlElementDecl$GLOBAL',
'javax.xml.bind.annotation.XmlElementDecl$GLOBAL', 'javax.xml.bind.annotation.XmlElementDecl',
'javax.xml.bind.annotation.XmlElementDecl', 'javax.xml.bind.annotation.XmlElementRef$DEFAULT',
'javax.xml.bind.annotation.XmlElementRef$DEFAULT', 'javax.xml.bind.annotation.XmlElementRef',
'javax.xml.bind.annotation.XmlElementRef', 'javax.xml.bind.annotation.XmlElementRefs',
'javax.xml.bind.annotation.XmlElementRefs', 'javax.xml.bind.annotation.XmlElementWrapper',
'javax.xml.bind.annotation.XmlElementWrapper', 'javax.xml.bind.annotation.XmlElements',
'javax.xml.bind.annotation.XmlElements', 'javax.xml.bind.annotation.XmlEnum',
'javax.xml.bind.annotation.XmlEnum', 'javax.xml.bind.annotation.XmlEnumValue',
'javax.xml.bind.annotation.XmlEnumValue', 'javax.xml.bind.annotation.XmlID',
'javax.xml.bind.annotation.XmlID', 'javax.xml.bind.annotation.XmlIDREF',
'javax.xml.bind.annotation.XmlIDREF', 'javax.xml.bind.annotation.XmlInlineBinaryData',
'javax.xml.bind.annotation.XmlInlineBinaryData', 'javax.xml.bind.annotation.XmlList',
'javax.xml.bind.annotation.XmlList', 'javax.xml.bind.annotation.XmlMimeType',
'javax.xml.bind.annotation.XmlMimeType', 'javax.xml.bind.annotation.XmlMixed',
'javax.xml.bind.annotation.XmlMixed', 'javax.xml.bind.annotation.XmlNs',
'javax.xml.bind.annotation.XmlNs', 'javax.xml.bind.annotation.XmlNsForm',
'javax.xml.bind.annotation.XmlNsForm', 'javax.xml.bind.annotation.XmlRegistry',
'javax.xml.bind.annotation.XmlRegistry', 'javax.xml.bind.annotation.XmlRootElement',
'javax.xml.bind.annotation.XmlRootElement', 'javax.xml.bind.annotation.XmlSchema',
'javax.xml.bind.annotation.XmlSchema', 'javax.xml.bind.annotation.XmlSchemaType$DEFAULT',
'javax.xml.bind.annotation.XmlSchemaType$DEFAULT', 'javax.xml.bind.annotation.XmlSchemaType',
'javax.xml.bind.annotation.XmlSchemaType', 'javax.xml.bind.annotation.XmlSchemaTypes',
'javax.xml.bind.annotation.XmlSchemaTypes', 'javax.xml.bind.annotation.XmlSeeAlso',
'javax.xml.bind.annotation.XmlSeeAlso', 'javax.xml.bind.annotation.XmlTransient',
'javax.xml.bind.annotation.XmlTransient', 'javax.xml.bind.annotation.XmlType$DEFAULT',
'javax.xml.bind.annotation.XmlType$DEFAULT', 'javax.xml.bind.annotation.XmlType',
'javax.xml.bind.annotation.XmlType', 'javax.xml.bind.annotation.XmlValue',
'javax.xml.bind.annotation.XmlValue', 'javax.xml.bind.annotation.adapters.CollapsedStringAdapter',
'javax.xml.bind.annotation.adapters.CollapsedStringAdapter', 'javax.xml.bind.annotation.adapters.HexBinaryAdapter',
'javax.xml.bind.annotation.adapters.HexBinaryAdapter', 'javax.xml.bind.annotation.adapters.NormalizedStringAdapter',
'javax.xml.bind.annotation.adapters.NormalizedStringAdapter', 'javax.xml.bind.annotation.adapters.XmlAdapter',
'javax.xml.bind.annotation.adapters.XmlAdapter', 'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter$DEFAULT',
'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter$DEFAULT', 'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter',
'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter', 'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters',
'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters', 'javax.xml.bind.attachment.AttachmentMarshaller',
'javax.xml.bind.attachment.AttachmentMarshaller', 'javax.xml.bind.attachment.AttachmentUnmarshaller',
'javax.xml.bind.attachment.AttachmentUnmarshaller', 'javax.xml.bind.helpers.AbstractMarshallerImpl',
'javax.xml.bind.helpers.AbstractMarshallerImpl', 'javax.xml.bind.helpers.AbstractUnmarshallerImpl',
'javax.xml.bind.helpers.AbstractUnmarshallerImpl', 'javax.xml.bind.helpers.DefaultValidationEventHandler',
'javax.xml.bind.helpers.DefaultValidationEventHandler', 'javax.xml.bind.helpers.Messages',
'javax.xml.bind.helpers.Messages', 'javax.xml.bind.helpers.NotIdentifiableEventImpl',
'javax.xml.bind.helpers.NotIdentifiableEventImpl', 'javax.xml.bind.helpers.ParseConversionEventImpl',
'javax.xml.bind.helpers.ParseConversionEventImpl', 'javax.xml.bind.helpers.PrintConversionEventImpl',
'javax.xml.bind.helpers.PrintConversionEventImpl', 'javax.xml.bind.helpers.ValidationEventImpl',
'javax.xml.bind.helpers.ValidationEventImpl', 'javax.xml.bind.helpers.ValidationEventLocatorImpl',
'javax.xml.bind.helpers.ValidationEventLocatorImpl', 'javax.xml.bind.util.JAXBResult',
'javax.xml.bind.util.JAXBResult', 'javax.xml.bind.util.JAXBSource$1',
'javax.xml.bind.util.JAXBSource$1', 'javax.xml.bind.util.JAXBSource',
'javax.xml.bind.util.JAXBSource', 'javax.xml.bind.util.Messages',
'javax.xml.bind.util.Messages', 'javax.xml.bind.util.ValidationEventCollector'
'javax.xml.bind.util.ValidationEventCollector' )
) } else {
} else { thirdPartyAudit.ignoreMissingClasses 'javax.activation.DataHandler'
thirdPartyAudit.ignoreMissingClasses 'javax.activation.DataHandler'
}
} }

View File

@ -317,10 +317,8 @@ thirdPartyAudit.ignoreMissingClasses(
'com.google.common.geometry.S2LatLng' 'com.google.common.geometry.S2LatLng'
) )
rootProject.globalInfo.ready { if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_1_8) {
if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_1_8) { thirdPartyAudit.ignoreMissingClasses 'javax.xml.bind.DatatypeConverter'
thirdPartyAudit.ignoreMissingClasses 'javax.xml.bind.DatatypeConverter'
}
} }
dependencyLicenses { dependencyLicenses {

View File

@ -455,22 +455,20 @@ thirdPartyAudit {
) )
} }
rootProject.globalInfo.ready { if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_1_8) {
if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_1_8) { thirdPartyAudit.ignoreMissingClasses(
thirdPartyAudit.ignoreMissingClasses( 'javax.xml.bind.JAXBContext',
'javax.xml.bind.JAXBContext', 'javax.xml.bind.JAXBElement',
'javax.xml.bind.JAXBElement', 'javax.xml.bind.JAXBException',
'javax.xml.bind.JAXBException', 'javax.xml.bind.Unmarshaller',
'javax.xml.bind.Unmarshaller', 'javax.xml.bind.UnmarshallerHandler',
'javax.xml.bind.UnmarshallerHandler', 'javax.activation.ActivationDataFlavor',
'javax.activation.ActivationDataFlavor', 'javax.activation.DataContentHandler',
'javax.activation.DataContentHandler', 'javax.activation.DataHandler',
'javax.activation.DataHandler', 'javax.activation.DataSource',
'javax.activation.DataSource', 'javax.activation.FileDataSource',
'javax.activation.FileDataSource', 'javax.activation.FileTypeMap'
'javax.activation.FileTypeMap' )
)
}
} }
test { test {

View File

@ -84,47 +84,45 @@ forbiddenPatterns {
} }
// pulled in as external dependency to work on java 9 // pulled in as external dependency to work on java 9
rootProject.globalInfo.ready { if (BuildParams.runtimeJavaVersion <= JavaVersion.VERSION_1_8) {
if (BuildParams.runtimeJavaVersion <= JavaVersion.VERSION_1_8) { thirdPartyAudit.ignoreJarHellWithJDK(
thirdPartyAudit.ignoreJarHellWithJDK( // pulled in as external dependency to work on java 9
// pulled in as external dependency to work on java 9 'com.sun.activation.registries.LineTokenizer',
'com.sun.activation.registries.LineTokenizer', 'com.sun.activation.registries.LogSupport',
'com.sun.activation.registries.LogSupport', 'com.sun.activation.registries.MailcapFile',
'com.sun.activation.registries.MailcapFile', 'com.sun.activation.registries.MailcapTokenizer',
'com.sun.activation.registries.MailcapTokenizer', 'com.sun.activation.registries.MimeTypeEntry',
'com.sun.activation.registries.MimeTypeEntry', 'com.sun.activation.registries.MimeTypeFile',
'com.sun.activation.registries.MimeTypeFile', 'javax.activation.MailcapCommandMap',
'javax.activation.MailcapCommandMap', 'javax.activation.MimetypesFileTypeMap',
'javax.activation.MimetypesFileTypeMap',
'com.sun.activation.registries.MailcapParseException', 'com.sun.activation.registries.MailcapParseException',
'javax.activation.ActivationDataFlavor', 'javax.activation.ActivationDataFlavor',
'javax.activation.CommandInfo', 'javax.activation.CommandInfo',
'javax.activation.CommandMap', 'javax.activation.CommandMap',
'javax.activation.CommandObject', 'javax.activation.CommandObject',
'javax.activation.DataContentHandler', 'javax.activation.DataContentHandler',
'javax.activation.DataContentHandlerFactory', 'javax.activation.DataContentHandlerFactory',
'javax.activation.DataHandler$1', 'javax.activation.DataHandler$1',
'javax.activation.DataHandler', 'javax.activation.DataHandler',
'javax.activation.DataHandlerDataSource', 'javax.activation.DataHandlerDataSource',
'javax.activation.DataSource', 'javax.activation.DataSource',
'javax.activation.DataSourceDataContentHandler', 'javax.activation.DataSourceDataContentHandler',
'javax.activation.FileDataSource', 'javax.activation.FileDataSource',
'javax.activation.FileTypeMap', 'javax.activation.FileTypeMap',
'javax.activation.MimeType', 'javax.activation.MimeType',
'javax.activation.MimeTypeParameterList', 'javax.activation.MimeTypeParameterList',
'javax.activation.MimeTypeParseException', 'javax.activation.MimeTypeParseException',
'javax.activation.ObjectDataContentHandler', 'javax.activation.ObjectDataContentHandler',
'javax.activation.SecuritySupport$1', 'javax.activation.SecuritySupport$1',
'javax.activation.SecuritySupport$2', 'javax.activation.SecuritySupport$2',
'javax.activation.SecuritySupport$3', 'javax.activation.SecuritySupport$3',
'javax.activation.SecuritySupport$4', 'javax.activation.SecuritySupport$4',
'javax.activation.SecuritySupport$5', 'javax.activation.SecuritySupport$5',
'javax.activation.SecuritySupport', 'javax.activation.SecuritySupport',
'javax.activation.URLDataSource', 'javax.activation.URLDataSource',
'javax.activation.UnsupportedDataTypeException' 'javax.activation.UnsupportedDataTypeException'
) )
}
} }
test { test {

View File

@ -39,10 +39,8 @@ testClusters.integTest {
setting 'reindex.ssl.truststore.password', 'password' setting 'reindex.ssl.truststore.password', 'password'
// Workaround for JDK-8212885 // Workaround for JDK-8212885
rootProject.globalInfo.ready { if (BuildParams.runtimeJavaVersion.isJava12Compatible() == false) {
if (BuildParams.runtimeJavaVersion.isJava12Compatible() == false) { setting 'reindex.ssl.supported_protocols', 'TLSv1.2'
setting 'reindex.ssl.supported_protocols', 'TLSv1.2'
}
} }
extraConfigFile 'roles.yml', file('roles.yml') extraConfigFile 'roles.yml', file('roles.yml')

View File

@ -181,114 +181,112 @@ thirdPartyAudit.ignoreMissingClasses(
'javax.servlet.ServletContextListener' 'javax.servlet.ServletContextListener'
) )
rootProject.globalInfo.ready { if (BuildParams.runtimeJavaVersion <= JavaVersion.VERSION_1_8) {
if (BuildParams.runtimeJavaVersion <= JavaVersion.VERSION_1_8) { thirdPartyAudit.ignoreJarHellWithJDK(
thirdPartyAudit.ignoreJarHellWithJDK( 'javax.xml.bind.Binder',
'javax.xml.bind.Binder', 'javax.xml.bind.ContextFinder$1',
'javax.xml.bind.ContextFinder$1', 'javax.xml.bind.ContextFinder',
'javax.xml.bind.ContextFinder', 'javax.xml.bind.DataBindingException',
'javax.xml.bind.DataBindingException', 'javax.xml.bind.DatatypeConverter',
'javax.xml.bind.DatatypeConverter', 'javax.xml.bind.DatatypeConverterImpl$CalendarFormatter',
'javax.xml.bind.DatatypeConverterImpl$CalendarFormatter', 'javax.xml.bind.DatatypeConverterImpl',
'javax.xml.bind.DatatypeConverterImpl', 'javax.xml.bind.DatatypeConverterInterface',
'javax.xml.bind.DatatypeConverterInterface', 'javax.xml.bind.Element',
'javax.xml.bind.Element', 'javax.xml.bind.GetPropertyAction',
'javax.xml.bind.GetPropertyAction', 'javax.xml.bind.JAXB$Cache',
'javax.xml.bind.JAXB$Cache', 'javax.xml.bind.JAXB',
'javax.xml.bind.JAXB', 'javax.xml.bind.JAXBContext',
'javax.xml.bind.JAXBContext', 'javax.xml.bind.JAXBElement$GlobalScope',
'javax.xml.bind.JAXBElement$GlobalScope', 'javax.xml.bind.JAXBElement',
'javax.xml.bind.JAXBElement', 'javax.xml.bind.JAXBException',
'javax.xml.bind.JAXBException', 'javax.xml.bind.JAXBIntrospector',
'javax.xml.bind.JAXBIntrospector', 'javax.xml.bind.JAXBPermission',
'javax.xml.bind.JAXBPermission', 'javax.xml.bind.MarshalException',
'javax.xml.bind.MarshalException', 'javax.xml.bind.Marshaller$Listener',
'javax.xml.bind.Marshaller$Listener', 'javax.xml.bind.Marshaller',
'javax.xml.bind.Marshaller', 'javax.xml.bind.Messages',
'javax.xml.bind.Messages', 'javax.xml.bind.NotIdentifiableEvent',
'javax.xml.bind.NotIdentifiableEvent', 'javax.xml.bind.ParseConversionEvent',
'javax.xml.bind.ParseConversionEvent', 'javax.xml.bind.PrintConversionEvent',
'javax.xml.bind.PrintConversionEvent', 'javax.xml.bind.PropertyException',
'javax.xml.bind.PropertyException', 'javax.xml.bind.SchemaOutputResolver',
'javax.xml.bind.SchemaOutputResolver', 'javax.xml.bind.TypeConstraintException',
'javax.xml.bind.TypeConstraintException', 'javax.xml.bind.UnmarshalException',
'javax.xml.bind.UnmarshalException', 'javax.xml.bind.Unmarshaller$Listener',
'javax.xml.bind.Unmarshaller$Listener', 'javax.xml.bind.Unmarshaller',
'javax.xml.bind.Unmarshaller', 'javax.xml.bind.UnmarshallerHandler',
'javax.xml.bind.UnmarshallerHandler', 'javax.xml.bind.ValidationEvent',
'javax.xml.bind.ValidationEvent', 'javax.xml.bind.ValidationEventHandler',
'javax.xml.bind.ValidationEventHandler', 'javax.xml.bind.ValidationEventLocator',
'javax.xml.bind.ValidationEventLocator', 'javax.xml.bind.ValidationException',
'javax.xml.bind.ValidationException', 'javax.xml.bind.Validator',
'javax.xml.bind.Validator', 'javax.xml.bind.WhiteSpaceProcessor',
'javax.xml.bind.WhiteSpaceProcessor', 'javax.xml.bind.annotation.DomHandler',
'javax.xml.bind.annotation.DomHandler', 'javax.xml.bind.annotation.W3CDomHandler',
'javax.xml.bind.annotation.W3CDomHandler', 'javax.xml.bind.annotation.XmlAccessOrder',
'javax.xml.bind.annotation.XmlAccessOrder', 'javax.xml.bind.annotation.XmlAccessType',
'javax.xml.bind.annotation.XmlAccessType', 'javax.xml.bind.annotation.XmlAccessorOrder',
'javax.xml.bind.annotation.XmlAccessorOrder', 'javax.xml.bind.annotation.XmlAccessorType',
'javax.xml.bind.annotation.XmlAccessorType', 'javax.xml.bind.annotation.XmlAnyAttribute',
'javax.xml.bind.annotation.XmlAnyAttribute', 'javax.xml.bind.annotation.XmlAnyElement',
'javax.xml.bind.annotation.XmlAnyElement', 'javax.xml.bind.annotation.XmlAttachmentRef',
'javax.xml.bind.annotation.XmlAttachmentRef', 'javax.xml.bind.annotation.XmlAttribute',
'javax.xml.bind.annotation.XmlAttribute', 'javax.xml.bind.annotation.XmlElement$DEFAULT',
'javax.xml.bind.annotation.XmlElement$DEFAULT', 'javax.xml.bind.annotation.XmlElement',
'javax.xml.bind.annotation.XmlElement', 'javax.xml.bind.annotation.XmlElementDecl$GLOBAL',
'javax.xml.bind.annotation.XmlElementDecl$GLOBAL', 'javax.xml.bind.annotation.XmlElementDecl',
'javax.xml.bind.annotation.XmlElementDecl', 'javax.xml.bind.annotation.XmlElementRef$DEFAULT',
'javax.xml.bind.annotation.XmlElementRef$DEFAULT', 'javax.xml.bind.annotation.XmlElementRef',
'javax.xml.bind.annotation.XmlElementRef', 'javax.xml.bind.annotation.XmlElementRefs',
'javax.xml.bind.annotation.XmlElementRefs', 'javax.xml.bind.annotation.XmlElementWrapper',
'javax.xml.bind.annotation.XmlElementWrapper', 'javax.xml.bind.annotation.XmlElements',
'javax.xml.bind.annotation.XmlElements', 'javax.xml.bind.annotation.XmlEnum',
'javax.xml.bind.annotation.XmlEnum', 'javax.xml.bind.annotation.XmlEnumValue',
'javax.xml.bind.annotation.XmlEnumValue', 'javax.xml.bind.annotation.XmlID',
'javax.xml.bind.annotation.XmlID', 'javax.xml.bind.annotation.XmlIDREF',
'javax.xml.bind.annotation.XmlIDREF', 'javax.xml.bind.annotation.XmlInlineBinaryData',
'javax.xml.bind.annotation.XmlInlineBinaryData', 'javax.xml.bind.annotation.XmlList',
'javax.xml.bind.annotation.XmlList', 'javax.xml.bind.annotation.XmlMimeType',
'javax.xml.bind.annotation.XmlMimeType', 'javax.xml.bind.annotation.XmlMixed',
'javax.xml.bind.annotation.XmlMixed', 'javax.xml.bind.annotation.XmlNs',
'javax.xml.bind.annotation.XmlNs', 'javax.xml.bind.annotation.XmlNsForm',
'javax.xml.bind.annotation.XmlNsForm', 'javax.xml.bind.annotation.XmlRegistry',
'javax.xml.bind.annotation.XmlRegistry', 'javax.xml.bind.annotation.XmlRootElement',
'javax.xml.bind.annotation.XmlRootElement', 'javax.xml.bind.annotation.XmlSchema',
'javax.xml.bind.annotation.XmlSchema', 'javax.xml.bind.annotation.XmlSchemaType$DEFAULT',
'javax.xml.bind.annotation.XmlSchemaType$DEFAULT', 'javax.xml.bind.annotation.XmlSchemaType',
'javax.xml.bind.annotation.XmlSchemaType', 'javax.xml.bind.annotation.XmlSchemaTypes',
'javax.xml.bind.annotation.XmlSchemaTypes', 'javax.xml.bind.annotation.XmlSeeAlso',
'javax.xml.bind.annotation.XmlSeeAlso', 'javax.xml.bind.annotation.XmlTransient',
'javax.xml.bind.annotation.XmlTransient', 'javax.xml.bind.annotation.XmlType$DEFAULT',
'javax.xml.bind.annotation.XmlType$DEFAULT', 'javax.xml.bind.annotation.XmlType',
'javax.xml.bind.annotation.XmlType', 'javax.xml.bind.annotation.XmlValue',
'javax.xml.bind.annotation.XmlValue', 'javax.xml.bind.annotation.adapters.CollapsedStringAdapter',
'javax.xml.bind.annotation.adapters.CollapsedStringAdapter', 'javax.xml.bind.annotation.adapters.HexBinaryAdapter',
'javax.xml.bind.annotation.adapters.HexBinaryAdapter', 'javax.xml.bind.annotation.adapters.NormalizedStringAdapter',
'javax.xml.bind.annotation.adapters.NormalizedStringAdapter', 'javax.xml.bind.annotation.adapters.XmlAdapter',
'javax.xml.bind.annotation.adapters.XmlAdapter', 'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter$DEFAULT',
'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter$DEFAULT', 'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter',
'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter', 'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters',
'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters', 'javax.xml.bind.attachment.AttachmentMarshaller',
'javax.xml.bind.attachment.AttachmentMarshaller', 'javax.xml.bind.attachment.AttachmentUnmarshaller',
'javax.xml.bind.attachment.AttachmentUnmarshaller', 'javax.xml.bind.helpers.AbstractMarshallerImpl',
'javax.xml.bind.helpers.AbstractMarshallerImpl', 'javax.xml.bind.helpers.AbstractUnmarshallerImpl',
'javax.xml.bind.helpers.AbstractUnmarshallerImpl', 'javax.xml.bind.helpers.DefaultValidationEventHandler',
'javax.xml.bind.helpers.DefaultValidationEventHandler', 'javax.xml.bind.helpers.Messages',
'javax.xml.bind.helpers.Messages', 'javax.xml.bind.helpers.NotIdentifiableEventImpl',
'javax.xml.bind.helpers.NotIdentifiableEventImpl', 'javax.xml.bind.helpers.ParseConversionEventImpl',
'javax.xml.bind.helpers.ParseConversionEventImpl', 'javax.xml.bind.helpers.PrintConversionEventImpl',
'javax.xml.bind.helpers.PrintConversionEventImpl', 'javax.xml.bind.helpers.ValidationEventImpl',
'javax.xml.bind.helpers.ValidationEventImpl', 'javax.xml.bind.helpers.ValidationEventLocatorImpl',
'javax.xml.bind.helpers.ValidationEventLocatorImpl', 'javax.xml.bind.util.JAXBResult',
'javax.xml.bind.util.JAXBResult', 'javax.xml.bind.util.JAXBSource$1',
'javax.xml.bind.util.JAXBSource$1', 'javax.xml.bind.util.JAXBSource',
'javax.xml.bind.util.JAXBSource', 'javax.xml.bind.util.Messages',
'javax.xml.bind.util.Messages', 'javax.xml.bind.util.ValidationEventCollector'
'javax.xml.bind.util.ValidationEventCollector' )
) } else {
} else { thirdPartyAudit.ignoreMissingClasses 'javax.activation.DataHandler'
thirdPartyAudit.ignoreMissingClasses 'javax.activation.DataHandler'
}
} }
thirdPartyAudit.ignoreViolations( thirdPartyAudit.ignoreViolations(