mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2024-11-19 01:40:26 +01:00
build.gradle, settings.gradle: simplify Gradle version comparisons
This commit is contained in:
parent
20b739c578
commit
e0c20f2bb0
@ -39,7 +39,7 @@ test {
|
||||
|
||||
def gradleVersionToolchains = GradleVersion.version("6.7")
|
||||
|
||||
if (GradleVersion.current().compareTo(gradleVersionToolchains) > 0) {
|
||||
if (GradleVersion.current() > gradleVersionToolchains) {
|
||||
// If the Gradle Java Toolchains feature is available, run tests on older JDKs
|
||||
System.err.println "Adding 'testOnJdk8' task, because ${GradleVersion.current()}"
|
||||
|
||||
@ -69,7 +69,7 @@ jar {
|
||||
def minGradleArchiveClassifierVersion = GradleVersion.version("5.0")
|
||||
|
||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
if (GradleVersion.current().compareTo(minGradleArchiveClassifierVersion) > 0) {
|
||||
if (GradleVersion.current() > minGradleArchiveClassifierVersion) {
|
||||
archiveClassifier.set('javadoc')
|
||||
} else {
|
||||
classifier = 'javadoc'
|
||||
@ -78,7 +78,7 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||
if (GradleVersion.current().compareTo(minGradleArchiveClassifierVersion) > 0) {
|
||||
if (GradleVersion.current() > minGradleArchiveClassifierVersion) {
|
||||
archiveClassifier.set('sources')
|
||||
} else {
|
||||
classifier = 'sources'
|
||||
|
@ -5,7 +5,7 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
// If using Gradle 7, use the compatible protobuf plugin, else use the one that works with oldest supported Gradle
|
||||
boolean isGradle7 = GradleVersion.current().compareTo(GradleVersion.version("7.0")) >= 0
|
||||
boolean isGradle7 = GradleVersion.current() >= GradleVersion.version("7.0")
|
||||
def gradleProtobufVersion = isGradle7 ? "0.9.4" : "0.8.10"
|
||||
if (isGradle7) {
|
||||
System.err.println "Warning: Using com.google.protobuf:protobuf-gradle-plugin:${gradleProtobufVersion} because ${GradleVersion.current()}"
|
||||
|
@ -28,7 +28,7 @@ dependencies {
|
||||
|
||||
// Prevent newer Gradle from switching to JRE version of Guava
|
||||
def gradleVersionTargetJVM = GradleVersion.version("7.0")
|
||||
if (GradleVersion.current().compareTo(gradleVersionTargetJVM) > 0) {
|
||||
if (GradleVersion.current() > gradleVersionTargetJVM) {
|
||||
dependencies.constraints {
|
||||
implementation("com.google.guava:guava") {
|
||||
attributes {
|
||||
@ -82,7 +82,7 @@ test {
|
||||
|
||||
def gradleVersionToolchains = GradleVersion.version("6.7")
|
||||
|
||||
if (GradleVersion.current().compareTo(gradleVersionToolchains) > 0) {
|
||||
if (GradleVersion.current() > gradleVersionToolchains) {
|
||||
// If the Gradle Java Toolchains feature is available, run tests on older JDKs
|
||||
System.err.println "Adding 'testOnJdk8' task, because ${GradleVersion.current()}"
|
||||
|
||||
@ -112,7 +112,7 @@ jar {
|
||||
def minGradleArchiveClassifierVersion = GradleVersion.version("5.0")
|
||||
|
||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
if (GradleVersion.current().compareTo(minGradleArchiveClassifierVersion) > 0) {
|
||||
if (GradleVersion.current() > minGradleArchiveClassifierVersion) {
|
||||
archiveClassifier.set('javadoc')
|
||||
} else {
|
||||
classifier = 'javadoc'
|
||||
@ -121,7 +121,7 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||
if (GradleVersion.current().compareTo(minGradleArchiveClassifierVersion) > 0) {
|
||||
if (GradleVersion.current() > minGradleArchiveClassifierVersion) {
|
||||
archiveClassifier.set('sources')
|
||||
} else {
|
||||
classifier = 'sources'
|
||||
|
@ -8,7 +8,7 @@ import org.gradle.util.GradleVersion
|
||||
// required Gradle version for build
|
||||
def gradleVersion = GradleVersion.version("4.4.1")
|
||||
|
||||
if (GradleVersion.current().compareTo(gradleVersion) != 0) {
|
||||
if (GradleVersion.current() != gradleVersion) {
|
||||
throw new GradleScriptException("bitcoinj build requires Debian Gradle ${gradleVersion.version}", null)
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ def minGradleVersion = GradleVersion.version("7.3")
|
||||
|
||||
rootProject.name = 'bitcoinj-parent'
|
||||
|
||||
if (GradleVersion.current().compareTo(minGradleVersion) < 0) {
|
||||
if (GradleVersion.current() < minGradleVersion) {
|
||||
throw new GradleScriptException("bitcoinj build requires Gradle ${minGradleVersion.version} or later", null)
|
||||
}
|
||||
if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
|
||||
|
@ -8,12 +8,12 @@ plugins {
|
||||
}
|
||||
|
||||
def annotationProcessorMinVersion = GradleVersion.version("4.6")
|
||||
boolean hasAnnotationProcessor = (GradleVersion.current().compareTo(annotationProcessorMinVersion) >= 0)
|
||||
boolean hasAnnotationProcessor = GradleVersion.current() >= annotationProcessorMinVersion
|
||||
def junit5MinVersion = GradleVersion.version("4.6")
|
||||
boolean hasJunit5 = (GradleVersion.current().compareTo(junit5MinVersion) >= 0)
|
||||
boolean hasJunit5 = GradleVersion.current() >= junit5MinVersion
|
||||
|
||||
def graalVMMinVersion = GradleVersion.version("7.4") // Toolchains with selection by vendor
|
||||
boolean hasGraalVM = (GradleVersion.current().compareTo(graalVMMinVersion) >= 0)
|
||||
boolean hasGraalVM = GradleVersion.current() >= graalVMMinVersion
|
||||
|
||||
dependencies {
|
||||
implementation project(':bitcoinj-core')
|
||||
|
Loading…
Reference in New Issue
Block a user