Adapt to compile and runtime Java home distinction

We now separate the compiler Java home from the time runtime Java home
(the one that is used to compile class files versus the one that is used
to run tests). This commit adapts x-pack-elasticsearch to this change.

Relates elastic/x-pack-elasticsearch#3477

Original commit: elastic/x-pack-elasticsearch@bdb096e21c
This commit is contained in:
Jason Tedor 2018-01-16 13:45:42 -05:00 committed by GitHub
parent 368c4fff56
commit 8a0a14b9a3
3 changed files with 19 additions and 13 deletions

View File

@ -224,7 +224,7 @@ task createNodeKeyStore(type: LoggedExec) {
delete nodeKeystore
}
}
executable = new File(project.javaHome, 'bin/keytool')
executable = new File(project.runtimeJavaHome, 'bin/keytool')
standardInput = new ByteArrayInputStream('FirstName LastName\nUnit\nOrganization\nCity\nState\nNL\nyes\n\n'.getBytes('UTF-8'))
args '-genkey',
'-alias', 'test-node',

View File

@ -186,25 +186,31 @@ subprojects {
task buildBwcVersion(type: Exec) {
dependsOn checkoutXPackBwcBranch, checkoutElasticsearchBwcBranch, writeElasticsearchBuildMetadata, writeXPackBuildMetadata
workingDir = xpackCheckoutDir
if (project.rootProject.ext.runtimeJavaVersion == JavaVersion.VERSION_1_8 && ["5.6", "6.0", "6.1"].contains(bwcBranch)) {
/*
* If runtime Java home is set to JDK 8 and we are building branches that are officially built with JDK 8, push this to JAVA_HOME for
* these builds.
*/
environment('JAVA_HOME', System.getenv('RUNTIME_JAVA_HOME'))
}
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
executable 'cmd'
args '/C', 'call', new File(xpackCheckoutDir, 'gradlew').toString()
} else {
executable = new File(xpackCheckoutDir, 'gradlew').toString()
executable new File(xpackCheckoutDir, 'gradlew').toString()
}
final ArrayList<String> commandLineArgs = [":x-pack-elasticsearch:plugin:assemble", "-Dbuild.snapshot=${System.getProperty('build.snapshot') ?: 'true'}"]
args ":x-pack-elasticsearch:plugin:assemble", "-Dbuild.snapshot=${System.getProperty('build.snapshot') ?: 'true'}"
final LogLevel logLevel = gradle.startParameter.logLevel
if ([LogLevel.QUIET, LogLevel.WARN, LogLevel.INFO, LogLevel.DEBUG].contains(logLevel)) {
commandLineArgs << "--${logLevel.name().toLowerCase(Locale.ENGLISH)}"
args "--${logLevel.name().toLowerCase(Locale.ENGLISH)}"
}
final String showStacktraceName = gradle.startParameter.showStacktrace.name()
assert ["INTERNAL_EXCEPTIONS", "ALWAYS", "ALWAYS_FULL"].contains(showStacktraceName)
if (showStacktraceName.equals("ALWAYS")) {
commandLineArgs << "--stacktrace"
args "--stacktrace"
} else if (showStacktraceName.equals("ALWAYS_FULL")) {
commandLineArgs << "--full-stacktrace"
args "--full-stacktrace"
}
args commandLineArgs
}
artifacts {

View File

@ -42,7 +42,7 @@ task createNodeKeyStore(type: LoggedExec) {
delete nodeKeystore
}
}
executable = new File(project.javaHome, 'bin/keytool')
executable = new File(project.runtimeJavaHome, 'bin/keytool')
standardInput = new ByteArrayInputStream('FirstName LastName\nUnit\nOrganization\nCity\nState\nNL\nyes\n\n'.getBytes('UTF-8'))
args '-genkey',
'-alias', 'test-node',
@ -67,7 +67,7 @@ task createClientKeyStore(type: LoggedExec) {
delete clientKeyStore
}
}
executable = new File(project.javaHome, 'bin/keytool')
executable = new File(project.runtimeJavaHome, 'bin/keytool')
standardInput = new ByteArrayInputStream('FirstName LastName\nUnit\nOrganization\nCity\nState\nNL\nyes\n\n'.getBytes('UTF-8'))
args '-genkey',
'-alias', 'test-client',
@ -92,7 +92,7 @@ task exportNodeCertificate(type: LoggedExec) {
delete nodeCertificate
}
}
executable = new File(project.javaHome, 'bin/keytool')
executable = new File(project.runtimeJavaHome, 'bin/keytool')
args '-export',
'-alias', 'test-node',
'-keystore', nodeKeystore,
@ -103,7 +103,7 @@ task exportNodeCertificate(type: LoggedExec) {
// Import the node certificate in the client's keystore
task importNodeCertificateInClientKeyStore(type: LoggedExec) {
dependsOn exportNodeCertificate
executable = new File(project.javaHome, 'bin/keytool')
executable = new File(project.runtimeJavaHome, 'bin/keytool')
args '-import',
'-alias', 'test-node',
'-keystore', clientKeyStore,
@ -123,7 +123,7 @@ task exportClientCertificate(type: LoggedExec) {
delete clientCertificate
}
}
executable = new File(project.javaHome, 'bin/keytool')
executable = new File(project.runtimeJavaHome, 'bin/keytool')
args '-export',
'-alias', 'test-client',
'-keystore', clientKeyStore,
@ -134,7 +134,7 @@ task exportClientCertificate(type: LoggedExec) {
// Import the client certificate in the node's keystore
task importClientCertificateInNodeKeyStore(type: LoggedExec) {
dependsOn exportClientCertificate
executable = new File(project.javaHome, 'bin/keytool')
executable = new File(project.runtimeJavaHome, 'bin/keytool')
args '-import',
'-alias', 'test-client',
'-keystore', nodeKeystore,