Skip to content

Commit 6c6e25e

Browse files
authored
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 f54c5e8 commit 6c6e25e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.elasticsearch.hadoop.gradle
22

33
import org.apache.tools.ant.taskdefs.condition.Os
4+
import org.elasticsearch.gradle.info.BuildParams
45
import org.elasticsearch.gradle.info.GenerateGlobalBuildInfoTask
56
import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin
67
import org.elasticsearch.gradle.info.JavaHome
@@ -91,8 +92,7 @@ class BuildPlugin implements Plugin<Project> {
9192

9293
// We snap the runtime to java 8 since Hadoop needs to see some significant
9394
// upgrades to support any runtime higher than that
94-
List<JavaHome> javaVersions = project.rootProject.ext.javaVersions as List<JavaHome>
95-
JavaHome esHadoopRuntimeJava = javaVersions.find { it.version == 8 }
95+
JavaHome esHadoopRuntimeJava = BuildParams.javaVersions.find { it.version == 8 }
9696
if (esHadoopRuntimeJava == null) {
9797
throw new GradleException(
9898
'$JAVA8_HOME must be set to build ES-Hadoop. ' +
@@ -202,7 +202,7 @@ class BuildPlugin implements Plugin<Project> {
202202
}
203203
project.ext.gitHead = project.rootProject.ext.gitHead
204204
project.ext.revHash = project.rootProject.ext.revHash
205-
project.ext.javaVersions = project.rootProject.ext.javaVersions
205+
project.ext.javaVersions = BuildParams.javaVersions
206206
project.ext.isRuntimeJavaHomeSet = project.rootProject.ext.isRuntimeJavaHomeSet
207207
}
208208

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)