Build: Simplify where min java version is specified
This moves the min java version used by elasticsearch to one place, a constant in BuildPlugin. For me on java 9, this fixed my jar to have the correct target/source versions. closes #14702
This commit is contained in:
parent
c2aec53b46
commit
505a4d9e09
|
@ -90,10 +90,6 @@ if (hasProperty('projectsPrefix') == false) {
|
||||||
allprojects {
|
allprojects {
|
||||||
// injecting groovy property variables into all projects
|
// injecting groovy property variables into all projects
|
||||||
project.ext {
|
project.ext {
|
||||||
// minimum java 8
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility = sourceCompatibility
|
|
||||||
|
|
||||||
// for eclipse hacks...
|
// for eclipse hacks...
|
||||||
isEclipse = System.getProperty("eclipse.launcher") != null || gradle.startParameter.taskNames.contains('eclipse') || gradle.startParameter.taskNames.contains('cleanEclipse')
|
isEclipse = System.getProperty("eclipse.launcher") != null || gradle.startParameter.taskNames.contains('eclipse') || gradle.startParameter.taskNames.contains('cleanEclipse')
|
||||||
}
|
}
|
||||||
|
@ -136,7 +132,7 @@ allprojects {
|
||||||
if (projectsPrefix.isEmpty()) {
|
if (projectsPrefix.isEmpty()) {
|
||||||
idea {
|
idea {
|
||||||
project {
|
project {
|
||||||
languageLevel = sourceCompatibility
|
languageLevel = org.elasticsearch.gradle.BuildPlugin.minimumJava
|
||||||
vcs = 'Git'
|
vcs = 'Git'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,10 +35,10 @@ import org.gradle.util.GradleVersion
|
||||||
*/
|
*/
|
||||||
class BuildPlugin implements Plugin<Project> {
|
class BuildPlugin implements Plugin<Project> {
|
||||||
|
|
||||||
|
static final JavaVersion minimumJava = JavaVersion.VERSION_1_8
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void apply(Project project) {
|
void apply(Project project) {
|
||||||
globalBuildInfo(project)
|
|
||||||
configureRepositories(project)
|
|
||||||
project.pluginManager.apply('java')
|
project.pluginManager.apply('java')
|
||||||
project.pluginManager.apply('carrotsearch.randomized-testing')
|
project.pluginManager.apply('carrotsearch.randomized-testing')
|
||||||
// these plugins add lots of info to our jars
|
// these plugins add lots of info to our jars
|
||||||
|
@ -48,6 +48,8 @@ class BuildPlugin implements Plugin<Project> {
|
||||||
project.pluginManager.apply('nebula.info-scm')
|
project.pluginManager.apply('nebula.info-scm')
|
||||||
project.pluginManager.apply('nebula.info-jar')
|
project.pluginManager.apply('nebula.info-jar')
|
||||||
|
|
||||||
|
globalBuildInfo(project)
|
||||||
|
configureRepositories(project)
|
||||||
configureConfigurations(project)
|
configureConfigurations(project)
|
||||||
project.ext.versions = VersionProperties.versions
|
project.ext.versions = VersionProperties.versions
|
||||||
configureCompile(project)
|
configureCompile(project)
|
||||||
|
@ -73,12 +75,14 @@ class BuildPlugin implements Plugin<Project> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// enforce Java version
|
// enforce Java version
|
||||||
if (!JavaVersion.current().isJava8Compatible()) {
|
if (JavaVersion.current() < minimumJava) {
|
||||||
throw new GradleException('Java 8 or above is required to build Elasticsearch')
|
throw new GradleException("Java ${minimumJava} or above is required to build Elasticsearch")
|
||||||
}
|
}
|
||||||
|
|
||||||
project.rootProject.ext.buildChecksDone = true
|
project.rootProject.ext.buildChecksDone = true
|
||||||
}
|
}
|
||||||
|
project.targetCompatibility = minimumJava
|
||||||
|
project.sourceCompatibility = minimumJava
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Makes dependencies non-transitive by default */
|
/** Makes dependencies non-transitive by default */
|
||||||
|
|
Loading…
Reference in New Issue