[gradle] 01/04: apply Tiago's patches to build with Java 9 (see Debian bug #873227)
tony mancill
tmancill at debian.org
Sun Mar 25 05:29:00 BST 2018
This is an automated email from the git hooks/post-receive script.
tmancill pushed a commit to branch experimental
in repository gradle.
commit 7526914e153231c4f1651e48335691b061e4c192
Author: tony mancill <tmancill at debian.org>
Date: Sat Mar 24 16:39:10 2018 -0700
apply Tiago's patches to build with Java 9 (see Debian bug #873227)
---
debian/changelog | 9 ++
...dd-test-case-for-10-internal_c1fe5e40a76b.patch | 21 +++
.../patches/cast-estimated-runtime-to-long.patch | 22 +++
debian/patches/series | 4 +
...ort-running-gradle-on-jdk-10-500485df3a18.patch | 173 +++++++++++++++++++++
...support-zulu9-version-number_d9c35cf9d74c.patch | 68 ++++++++
6 files changed, 297 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 4581422..da0c424 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,18 @@
gradle (3.4.1-3) UNRELEASED; urgency=medium
+ [ Emmanuel Bourg ]
* Team upload.
* Removed the build dependency on libwagon2-java
* Standards-Version updated to 4.1.2
+ [ Tiago Daitx ]
+ * d/p/cast-estimated-runtime-to-long.patch: fix FTBFS due to missing cast.
+ (Closes: #893487)
+ * d/p/support-running-gradle-on-jdk-10-500485df3a18.patch,
+ d/p/add-test-case-for-10-internal_c1fe5e40a76b.patch,
+ d/p/support-zulu9-version-number_d9c35cf9d74c.patch: prevent failures when
+ building projects with openjdk 9.
+
-- Emmanuel Bourg <ebourg at apache.org> Mon, 11 Dec 2017 16:02:51 +0100
gradle (3.4.1-2) experimental; urgency=medium
diff --git a/debian/patches/add-test-case-for-10-internal_c1fe5e40a76b.patch b/debian/patches/add-test-case-for-10-internal_c1fe5e40a76b.patch
new file mode 100644
index 0000000..0a24d2d
--- /dev/null
+++ b/debian/patches/add-test-case-for-10-internal_c1fe5e40a76b.patch
@@ -0,0 +1,21 @@
+From c1fe5e40a76b79a98e8916c2ce3b4e1e6ed3f343 Mon Sep 17 00:00:00 2001
+From: Cedric Champeau <cedric at gradle.com>
+Date: Thu, 13 Jul 2017 16:16:46 +0200
+Subject: [PATCH] Add test case for `10-internal`
+
+---
+ .../base-services/src/test/groovy/org/gradle/api/JavaVersionSpec.groovy | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/subprojects/base-services/src/test/groovy/org/gradle/api/JavaVersionSpec.groovy b/subprojects/base-services/src/test/groovy/org/gradle/api/JavaVersionSpec.groovy
+index 75459ed3f06..fbb243ba992 100644
+--- a/subprojects/base-services/src/test/groovy/org/gradle/api/JavaVersionSpec.groovy
++++ b/subprojects/base-services/src/test/groovy/org/gradle/api/JavaVersionSpec.groovy
+@@ -65,6 +65,7 @@ public class JavaVersionSpec extends Specification {
+ JavaVersion.toVersion("9-ea") == JavaVersion.VERSION_1_9
+
+ JavaVersion.toVersion("10-ea") == JavaVersion.VERSION_1_10
++ JavaVersion.toVersion("10-internal") == JavaVersion.VERSION_1_10
+ }
+
+ def convertClassVersionToJavaVersion() {
diff --git a/debian/patches/cast-estimated-runtime-to-long.patch b/debian/patches/cast-estimated-runtime-to-long.patch
new file mode 100644
index 0000000..405e2cc
--- /dev/null
+++ b/debian/patches/cast-estimated-runtime-to-long.patch
@@ -0,0 +1,22 @@
+Description: gradle 3.4.1 FTBFS with a missing cast to long
+ estimatedRuntime must be cast to long otherwise gradle 3.4.1 FTBFS with
+ buildSrc/src/main/groovy/org/gradle/testing/DistributedPerformanceTest.groovy:
+ 134: [Static type checking] - Cannot assign value of type java.math.BigDecimal
+ to variable of type long.
+Author: Tiago Stürmer Daitx <tiago.daitx at ubuntu.com>
+Bug-Debian: https://bugs.debian.org/893487
+Forwarded: no
+Last-Update: 2018-03-19
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/buildSrc/src/main/groovy/org/gradle/testing/DistributedPerformanceTest.groovy
++++ b/buildSrc/src/main/groovy/org/gradle/testing/DistributedPerformanceTest.groovy
+@@ -131,7 +131,7 @@ class DistributedPerformanceTest extends
+ def scenarios = scenarioList.readLines()
+ .collect { line ->
+ def parts = Splitter.on(';').split(line).toList()
+- new Scenario(id : parts[0], estimatedRuntime: new BigDecimal(parts[1]), templates: parts.subList(2, parts.size()))
++ new Scenario(id : parts[0], estimatedRuntime: new BigDecimal(parts[1]) as long, templates: parts.subList(2, parts.size()))
+ }
+ .sort{ -it.estimatedRuntime }
+
diff --git a/debian/patches/series b/debian/patches/series
index ed8cc6f..e93162e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -23,3 +23,7 @@ remove-timestamps.patch
use-local-artifacts.patch
jansi.patch
commons-io.patch
+cast-estimated-runtime-to-long.patch
+support-running-gradle-on-jdk-10-500485df3a18.patch
+add-test-case-for-10-internal_c1fe5e40a76b.patch
+support-zulu9-version-number_d9c35cf9d74c.patch
diff --git a/debian/patches/support-running-gradle-on-jdk-10-500485df3a18.patch b/debian/patches/support-running-gradle-on-jdk-10-500485df3a18.patch
new file mode 100644
index 0000000..3683e2f
--- /dev/null
+++ b/debian/patches/support-running-gradle-on-jdk-10-500485df3a18.patch
@@ -0,0 +1,173 @@
+From 500485df3a1898d4637bfa42b73e356941b4af91 Mon Sep 17 00:00:00 2001
+From: Cedric Champeau <cedric at gradle.com>
+Date: Thu, 13 Jul 2017 10:08:33 +0200
+Subject: [PATCH] Support running Gradle on JDK 10
+
+This commit adds support for `JavaVersion.1_10` (yes, this is awkward naming, blame versioning scheme change).
+Note that there are 2 different aspects of Java 10 detection:
+
+1. given a string representation of a version number, return the appropriate `JavaVersion` enum value
+2. given the current runtime, return the appropriate `JavaVersion` enum value
+
+This commit fixes 1, but didn't change anything in the way 2 works. In particular, 2 still uses the `java.version`
+property, which is then parsed and we follow the process of 1. However, since Java 9, a new `Runtime#getVersion`
+method exists, that we should use instead of relying on parsing the version number returned by `java.version`.
+The reason we don't do this yet is that Gradle needs to run on older JDKs, so we cannot statically link to this
+method, which involves either the use of reflection or method handles to get a hand on the result of the invocation.
+Since the invocation returns a complex object (not just a `String`), we're deferring this work (PRs welcome!).
+---
+ .../src/main/java/org/gradle/api/JavaVersion.java | 16 ++++++++--
+ .../groovy/org/gradle/api/JavaVersionSpec.groovy | 34 ++++++++++++++++++++--
+ 2 files changed, 44 insertions(+), 6 deletions(-)
+
+diff --git a/subprojects/base-services/src/main/java/org/gradle/api/JavaVersion.java b/subprojects/base-services/src/main/java/org/gradle/api/JavaVersion.java
+index 3b9a7280c14..4a2195a5b0b 100644
+--- a/subprojects/base-services/src/main/java/org/gradle/api/JavaVersion.java
++++ b/subprojects/base-services/src/main/java/org/gradle/api/JavaVersion.java
+@@ -24,7 +24,9 @@
+ * An enumeration of Java versions.
+ */
+ public enum JavaVersion {
+- VERSION_1_1(false), VERSION_1_2(false), VERSION_1_3(false), VERSION_1_4(false), VERSION_1_5(true), VERSION_1_6(true), VERSION_1_7(true), VERSION_1_8(true), VERSION_1_9(true);
++ VERSION_1_1(false), VERSION_1_2(false), VERSION_1_3(false), VERSION_1_4(false),
++ // starting from here versions are 1_ but their official name is "Java 6", "Java 7", ...
++ VERSION_1_5(true), VERSION_1_6(true), VERSION_1_7(true), VERSION_1_8(true), VERSION_1_9(true), VERSION_1_10(true);
+ private static JavaVersion currentJavaVersion;
+ private final boolean hasMajorVersion;
+ private final String versionName;
+@@ -52,7 +54,7 @@ public static JavaVersion toVersion(Object value) throws IllegalArgumentExceptio
+ }
+
+ String name = value.toString();
+- Matcher matcher = Pattern.compile("(\\d)(-.+)?").matcher(name);
++ Matcher matcher = Pattern.compile("(\\d{1,2})(-.+)?").matcher(name);
+ if (matcher.matches()) {
+ int index = Integer.parseInt(matcher.group(1)) - 1;
+ if (index < values().length && values()[index].hasMajorVersion) {
+@@ -60,7 +62,7 @@ public static JavaVersion toVersion(Object value) throws IllegalArgumentExceptio
+ }
+ }
+
+- matcher = Pattern.compile("1\\.(\\d)(\\D.+)?").matcher(name);
++ matcher = Pattern.compile("1\\.(\\d{1,2})(\\D.+)?").matcher(name);
+ if (matcher.matches()) {
+ int versionIdx = Integer.parseInt(matcher.group(1)) - 1;
+ if (versionIdx >= 0 && versionIdx < values().length) {
+@@ -122,6 +124,10 @@ private boolean isJava9() {
+ return this == VERSION_1_9;
+ }
+
++ private boolean isJava10() {
++ return this == VERSION_1_10;
++ }
++
+ public boolean isJava5Compatible() {
+ return this.compareTo(VERSION_1_5) >= 0;
+ }
+@@ -142,6 +148,10 @@ public boolean isJava9Compatible() {
+ return this.compareTo(VERSION_1_9) >= 0;
+ }
+
++ public boolean isJava10Compatible() {
++ return this.compareTo(VERSION_1_10) >= 0;
++ }
++
+ @Override
+ public String toString() {
+ return getName();
+diff --git a/subprojects/base-services/src/test/groovy/org/gradle/api/JavaVersionSpec.groovy b/subprojects/base-services/src/test/groovy/org/gradle/api/JavaVersionSpec.groovy
+index fab8be67274..75459ed3f06 100644
+--- a/subprojects/base-services/src/test/groovy/org/gradle/api/JavaVersionSpec.groovy
++++ b/subprojects/base-services/src/test/groovy/org/gradle/api/JavaVersionSpec.groovy
+@@ -41,6 +41,7 @@ public class JavaVersionSpec extends Specification {
+ JavaVersion.VERSION_1_7.toString() == "1.7"
+ JavaVersion.VERSION_1_8.toString() == "1.8"
+ JavaVersion.VERSION_1_9.toString() == "1.9"
++ JavaVersion.VERSION_1_10.toString() == "1.10"
+ }
+
+ def convertsStringToVersion() {
+@@ -57,10 +58,13 @@ public class JavaVersionSpec extends Specification {
+ JavaVersion.toVersion("7") == JavaVersion.VERSION_1_7
+ JavaVersion.toVersion("8") == JavaVersion.VERSION_1_8
+ JavaVersion.toVersion("9") == JavaVersion.VERSION_1_9
++ JavaVersion.toVersion("10") == JavaVersion.VERSION_1_10
+
+ JavaVersion.toVersion("1.9.0-internal") == JavaVersion.VERSION_1_9
+ JavaVersion.toVersion("1.9.0-ea") == JavaVersion.VERSION_1_9
+ JavaVersion.toVersion("9-ea") == JavaVersion.VERSION_1_9
++
++ JavaVersion.toVersion("10-ea") == JavaVersion.VERSION_1_10
+ }
+
+ def convertClassVersionToJavaVersion() {
+@@ -74,6 +78,7 @@ public class JavaVersionSpec extends Specification {
+ JavaVersion.forClassVersion(51) == JavaVersion.VERSION_1_7
+ JavaVersion.forClassVersion(52) == JavaVersion.VERSION_1_8
+ JavaVersion.forClassVersion(53) == JavaVersion.VERSION_1_9
++ JavaVersion.forClassVersion(54) == JavaVersion.VERSION_1_10
+ }
+
+ def failsToConvertStringToVersionForUnknownVersion() {
+@@ -81,7 +86,6 @@ public class JavaVersionSpec extends Specification {
+ conversionFails("1");
+ conversionFails("2");
+
+- conversionFails("10");
+ conversionFails("17");
+
+ conversionFails("a");
+@@ -91,7 +95,6 @@ public class JavaVersionSpec extends Specification {
+
+ conversionFails("0.1");
+ conversionFails("1.54");
+- conversionFails("1.10");
+ conversionFails("2.0");
+ conversionFails("1_4");
+ conversionFails("8.1");
+@@ -100,7 +103,7 @@ public class JavaVersionSpec extends Specification {
+ conversionFails("10.1.2");
+
+ conversionFails("9-");
+- conversionFails("10-ea");
++ conversionFails("11-ea");
+ }
+
+ def convertsVersionToVersion() {
+@@ -118,6 +121,8 @@ public class JavaVersionSpec extends Specification {
+ JavaVersion.toVersion(1.7) == JavaVersion.VERSION_1_7
+ JavaVersion.toVersion(1.8) == JavaVersion.VERSION_1_8
+ JavaVersion.toVersion(1.9) == JavaVersion.VERSION_1_9
++ JavaVersion.toVersion(9) == JavaVersion.VERSION_1_9
++ JavaVersion.toVersion(10) == JavaVersion.VERSION_1_10
+ }
+
+ def failsToConvertNumberToVersionForUnknownVersion() {
+@@ -233,4 +238,27 @@ public class JavaVersionSpec extends Specification {
+ where:
+ javaVersion << ['1.9', '9-ea']
+ }
++
++ def "uses system property to determine if compatible with Java 10"() {
++ System.properties['java.version'] = javaVersion
++
++ expect:
++ !JavaVersion.current().java5
++ !JavaVersion.current().java6
++ !JavaVersion.current().java7
++ !JavaVersion.current().java8
++ !JavaVersion.current().java9
++ JavaVersion.current().java10
++
++ and:
++ JavaVersion.current().java5Compatible
++ JavaVersion.current().java6Compatible
++ JavaVersion.current().java7Compatible
++ JavaVersion.current().java8Compatible
++ JavaVersion.current().java9Compatible
++ JavaVersion.current().java10Compatible
++
++ where:
++ javaVersion << ['1.10', '10-ea']
++ }
+ }
diff --git a/debian/patches/support-zulu9-version-number_d9c35cf9d74c.patch b/debian/patches/support-zulu9-version-number_d9c35cf9d74c.patch
new file mode 100644
index 0000000..73970a4
--- /dev/null
+++ b/debian/patches/support-zulu9-version-number_d9c35cf9d74c.patch
@@ -0,0 +1,68 @@
+From d9c35cf9d74c102641fcfe0bb7bf622791a96caf Mon Sep 17 00:00:00 2001
+From: Bo Zhang <bo at gradle.com>
+Date: Mon, 25 Sep 2017 04:05:42 -0500
+Subject: [PATCH] Support zulu9 version number(#2992) (#2994)
+
+https://github.com/gradle/gradle/issues/2992
+zulu JDK 9 introduces version number format '9.0.0.15' which
+can't be recognized by Gradle. This fix adjusts the recognition
+pattern.
+---
+ .../base-services/src/main/java/org/gradle/api/JavaVersion.java | 6 +++---
+ .../src/test/groovy/org/gradle/api/JavaVersionSpec.groovy | 9 +++++----
+ 2 files changed, 8 insertions(+), 7 deletions(-)
+
+diff --git a/subprojects/base-services/src/main/java/org/gradle/api/JavaVersion.java b/subprojects/base-services/src/main/java/org/gradle/api/JavaVersion.java
+index b3219645099..04d8671cd5f 100644
+--- a/subprojects/base-services/src/main/java/org/gradle/api/JavaVersion.java
++++ b/subprojects/base-services/src/main/java/org/gradle/api/JavaVersion.java
+@@ -54,10 +54,10 @@ public static JavaVersion toVersion(Object value) throws IllegalArgumentExceptio
+ }
+
+ String name = value.toString();
+- Matcher matcher = Pattern.compile("(\\d{1,2})(-.+)?").matcher(name);
++ Matcher matcher = Pattern.compile("(\\d{1,2})(\\D.+)?").matcher(name);
+ if (matcher.matches()) {
+ int index = Integer.parseInt(matcher.group(1)) - 1;
+- if (index < values().length && values()[index].hasMajorVersion) {
++ if (index > 0 && index < values().length && values()[index].hasMajorVersion) {
+ return values()[index];
+ }
+ }
+@@ -98,7 +98,7 @@ public static JavaVersion forClassVersion(int classVersion) {
+ }
+
+ public static JavaVersion forClass(byte[] classData) {
+- if (classData.length<8) {
++ if (classData.length < 8) {
+ throw new IllegalArgumentException("Invalid class format. Should contain at least 8 bytes");
+ }
+ return forClassVersion(classData[7] & 0xFF);
+diff --git a/subprojects/base-services/src/test/groovy/org/gradle/api/JavaVersionSpec.groovy b/subprojects/base-services/src/test/groovy/org/gradle/api/JavaVersionSpec.groovy
+index fbb243ba992..17dc3956118 100644
+--- a/subprojects/base-services/src/test/groovy/org/gradle/api/JavaVersionSpec.groovy
++++ b/subprojects/base-services/src/test/groovy/org/gradle/api/JavaVersionSpec.groovy
+@@ -63,7 +63,12 @@ public class JavaVersionSpec extends Specification {
+ JavaVersion.toVersion("1.9.0-internal") == JavaVersion.VERSION_1_9
+ JavaVersion.toVersion("1.9.0-ea") == JavaVersion.VERSION_1_9
+ JavaVersion.toVersion("9-ea") == JavaVersion.VERSION_1_9
++ JavaVersion.toVersion("9.0.0.15") == JavaVersion.VERSION_1_9
++ JavaVersion.toVersion("9.0.1") == JavaVersion.VERSION_1_9
++ JavaVersion.toVersion("9.1") == JavaVersion.VERSION_1_9
+
++ JavaVersion.toVersion("10.1") == JavaVersion.VERSION_1_10
++ JavaVersion.toVersion("10.1.2") == JavaVersion.VERSION_1_10
+ JavaVersion.toVersion("10-ea") == JavaVersion.VERSION_1_10
+ JavaVersion.toVersion("10-internal") == JavaVersion.VERSION_1_10
+ }
+@@ -98,10 +103,6 @@ public class JavaVersionSpec extends Specification {
+ conversionFails("1.54");
+ conversionFails("2.0");
+ conversionFails("1_4");
+- conversionFails("8.1");
+- conversionFails("9.1");
+- conversionFails("9.0.0");
+- conversionFails("10.1.2");
+
+ conversionFails("9-");
+ conversionFails("11-ea");
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/gradle.git
More information about the pkg-java-commits
mailing list