mirror of https://github.com/apache/lucene.git
31 lines
1.1 KiB
Groovy
31 lines
1.1 KiB
Groovy
// This checks that we're running the desired version of Gradle and
|
|
// that the JVM is supported.
|
|
|
|
import org.gradle.util.GradleVersion
|
|
|
|
configure(rootProject) {
|
|
ext {
|
|
expectedGradleVersion = '5.6.4'
|
|
expectedJavaVersion = JavaVersion.VERSION_11
|
|
}
|
|
|
|
wrapper {
|
|
distributionType = Wrapper.DistributionType.ALL
|
|
gradleVersion = expectedGradleVersion
|
|
}
|
|
|
|
def currentJavaVersion = JavaVersion.current()
|
|
if (currentJavaVersion < expectedJavaVersion) {
|
|
throw new GradleException("Java version ${expectedJavaVersion} is required: this Java is ${currentJavaVersion} "
|
|
+ "[${System.getProperty('java.vm.name')} ${System.getProperty('java.vm.version')}]")
|
|
}
|
|
|
|
// If we're regenerating the wrapper, skip the check.
|
|
if (!gradle.startParameter.taskNames.contains("wrapper")) {
|
|
def currentGradleVersion = GradleVersion.current()
|
|
if (currentGradleVersion != GradleVersion.version(expectedGradleVersion)) {
|
|
throw new GradleException("Gradle ${expectedGradleVersion} is required (hint: use the gradlew script): this gradle is ${currentGradleVersion}")
|
|
}
|
|
}
|
|
}
|