Skip to content

Commit 5f2c614

Browse files
jasontedorjbaiera
authored andcommitted
Adapt to upstream for type safe build globals (#1388)
This commit adapts the elasticsearch-hadoop build to an upstream change to make some build globals type safe. In particular, we adapt the usage of Java versions.
1 parent 9ed0616 commit 5f2c614

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

buildSrc/src/main/groovy/org/elasticsearch/hadoop/gradle/BuildPlugin.groovy

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ class BuildPlugin implements Plugin<Project> {
9393

9494
// We snap the runtime to java 8 since Hadoop needs to see some significant
9595
// upgrades to support any runtime higher than that
96-
List<JavaHome> javaVersions = project.rootProject.ext.javaVersions as List<JavaHome>
97-
JavaHome esHadoopRuntimeJava = javaVersions.find { it.version == 8 }
96+
JavaHome esHadoopRuntimeJava = BuildParams.javaVersions.find { it.version == 8 }
9897
if (esHadoopRuntimeJava == null) {
9998
throw new GradleException(
10099
'$JAVA8_HOME must be set to build ES-Hadoop. ' +
@@ -202,17 +201,19 @@ class BuildPlugin implements Plugin<Project> {
202201
project.rootProject.ext.revHash = gitHash(gitHead)
203202
project.rootProject.ext.settingsConfigured = true
204203

204+
// TODO: Still needed?
205205
String inFipsJvmScript = 'print(java.security.Security.getProviders()[0].name.toLowerCase().contains("fips"));'
206206
project.rootProject.ext.inFipsJvm = Boolean.parseBoolean(runJavascript(project, javaHome, inFipsJvmScript))
207207

208208
BuildParams.init { params ->
209209
params.setInFipsJvm(project.rootProject.ext.inFipsJvm)
210210
params.setIsRutimeJavaHomeSet(project.rootProject.ext.isRuntimeJavaHomeSet)
211211
}
212+
// End Section
212213
}
213214
project.ext.gitHead = project.rootProject.ext.gitHead
214215
project.ext.revHash = project.rootProject.ext.revHash
215-
project.ext.javaVersions = project.rootProject.ext.javaVersions
216+
project.ext.javaVersions = BuildParams.javaVersions
216217
project.ext.isRuntimeJavaHomeSet = project.rootProject.ext.isRuntimeJavaHomeSet
217218
}
218219

buildSrc/src/main/groovy/org/elasticsearch/hadoop/gradle/fixture/hadoop/InstanceInfo.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
package org.elasticsearch.hadoop.gradle.fixture.hadoop
2121

2222
import org.apache.tools.ant.taskdefs.condition.Os
23+
import org.elasticsearch.gradle.info.BuildParams
2324
import org.elasticsearch.hadoop.gradle.util.WaitForURL
2425
import org.elasticsearch.hadoop.gradle.fixture.hadoop.conf.InstanceConfiguration
2526
import org.gradle.api.GradleException
@@ -236,7 +237,7 @@ class InstanceInfo {
236237

237238
/** Return the java home used by this node. */
238239
String getJavaHome() {
239-
return javaVersion == null ? project.runtimeJavaHome : project.javaVersions.find { it.version == javaVersion }.javaHome.absolutePath
240+
return javaVersion == null ? project.runtimeJavaHome : BuildParams.javaVersions.find { it.version == javaVersion }.javaHome.absolutePath
240241
}
241242

242243
/** Returns debug string for the command that started this node. */

0 commit comments

Comments
 (0)