Bug#895616: gradle: fix support for openjdk-9 --release flag

2018-07-03 Thread Emmanuel Bourg
Control: tags -1 + wontfix
Control: close -1

Tagging as 'wontfix' since the experiment with Ant and Maven didn't work
well (cf #895619 and #902895). The release flag makes the internal Java
APIs unavailable at compile time, this breaks many packages.



Bug#895616: gradle: fix support for openjdk-9 --release flag

2018-04-13 Thread Tiago Daitx
Please consider the attached debdiff for fixing this bug.

thanks

-- 
Tiago Stürmer Daitx
Software Engineer
tiago.da...@canonical.com

PGP Key: 4096R/F5B213BE (hkp://keyserver.ubuntu.com)
Fingerprint = 45D0 FE5A 8109 1E91 866E  8CA4 1931 8D5E F5B2 13BE
diff -Nru gradle-3.4.1/debian/changelog gradle-3.4.1/debian/changelog
--- gradle-3.4.1/debian/changelog	2018-04-11 18:19:46.0 -0300
+++ gradle-3.4.1/debian/changelog	2018-04-12 18:01:31.0 -0300
@@ -1,3 +1,10 @@
+gradle (3.4.1-8) UNRELEASED; urgency=medium
+
+  * d/p/gnu-style-release-flag-jdk9.patch: Use GNU-style release flag for
+Java 9 compiler.
+
+ -- Tiago Stürmer Daitx   Thu, 12 Apr 2018 21:01:31 +
+
 gradle (3.4.1-7) unstable; urgency=medium
 
   * Team upload.
diff -Nru gradle-3.4.1/debian/patches/gnu-style-release-flag-jdk9.patch gradle-3.4.1/debian/patches/gnu-style-release-flag-jdk9.patch
--- gradle-3.4.1/debian/patches/gnu-style-release-flag-jdk9.patch	1969-12-31 21:00:00.0 -0300
+++ gradle-3.4.1/debian/patches/gnu-style-release-flag-jdk9.patch	2018-04-12 18:01:22.0 -0300
@@ -0,0 +1,97 @@
+Description: Use GNU-style release flag for Java 9 compiler
+ Since JDK 9 b135, only the new GNU-style option with double-dashes is
+ supported for the "--release" flag (see
+ https://bugs.openjdk.java.net/browse/JDK-8160851).
+Author: Yannick Welsch 
+Origin: upstream, https://github.com/gradle/gradle/commit/142f2f5233e77ba33146efe3815cd3b4b1245993
+Bug-Debian: https://bugs.debian.org/895616
+Forwarded: not-needed
+Applied-Upstream: https://github.com/gradle/gradle/commit/142f2f5233e77ba33146efe3815cd3b4b1245993
+Reviewed-by: Tiago Stürmer Daitx 
+Last-Update: 2018-04-12
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+
+From 142f2f5233e77ba33146efe3815cd3b4b1245993 Mon Sep 17 00:00:00 2001
+From: Yannick Welsch 
+Date: Mon, 17 Jul 2017 15:53:17 +0200
+Subject: [PATCH] Use GNU-style release flag for Java 9 compiler (#2474)
+
+Since JDK 9 b135, only the new GNU-style option with double-dashes is supported for the "--release" flag
+(see https://bugs.openjdk.java.net/browse/JDK-8160851).
+---
+ design-docs/jdk9-support.md | 6 +++---
+ .../api/internal/tasks/compile/JavaCompilerArgumentsBuilder.java| 2 +-
+ .../src/main/java/org/gradle/api/tasks/compile/CompileOptions.java  | 6 +++---
+ .../internal/tasks/compile/JavaCompilerArgumentsBuilderTest.groovy  | 6 +++---
+ .../org/gradle/java/compile/BasicJavaCompilerIntegrationSpec.groovy | 4 ++--
+ 5 files changed, 12 insertions(+), 12 deletions(-)
+
+
+--- a/subprojects/language-java/src/main/java/org/gradle/api/internal/tasks/compile/JavaCompilerArgumentsBuilder.java
 b/subprojects/language-java/src/main/java/org/gradle/api/internal/tasks/compile/JavaCompilerArgumentsBuilder.java
+@@ -227,7 +227,7 @@ public class JavaCompilerArgumentsBuilde
+ }
+ 
+ private boolean releaseOptionIsSet(List compilerArgs) {
+-return compilerArgs != null && compilerArgs.contains("-release");
++return compilerArgs != null && compilerArgs.contains("--release");
+ }
+ 
+ private void addClasspath() {
+--- a/subprojects/language-java/src/main/java/org/gradle/api/tasks/compile/CompileOptions.java
 b/subprojects/language-java/src/main/java/org/gradle/api/tasks/compile/CompileOptions.java
+@@ -315,10 +315,10 @@ public class CompileOptions extends Abst
+  * Defaults to the empty list.
+  *
+  * Compiler arguments not supported by the DSL can be added here. For example, it is possible
+- * to pass the {@code -release} option of JDK 9:
+- * compilerArgs.addAll(['-release', '7'])
++ * to pass the {@code --release} option of JDK 9:
++ * compilerArgs.addAll(['--release', '7'])
+  *
+- * Note that if {@code -release} is added then {@code -target} and {@code -source}
++ * Note that if {@code --release} is added then {@code -target} and {@code -source}
+  * are ignored.
+  */
+ @Input
+--- a/subprojects/language-java/src/test/groovy/org/gradle/api/internal/tasks/compile/JavaCompilerArgumentsBuilderTest.groovy
 b/subprojects/language-java/src/test/groovy/org/gradle/api/internal/tasks/compile/JavaCompilerArgumentsBuilderTest.groovy
+@@ -79,14 +79,14 @@ class JavaCompilerArgumentsBuilderTest e
+ builder.build() == ["-target", "1.4"] + defaultOptions
+ }
+ 
+-def "removes -source and -target option if -release is present"() {
++def "removes -source and -target option if --release is present"() {
+ when:
+-spec.compileOptions.compilerArgs += ['-release', '7']
++spec.compileOptions.compilerArgs += ['--release', '7']
+ spec.sourceCompatibility = '1.7'
+ spec.targetCompatibility = '1.7'
+ 
+ then:
+-builder.build() == defaultOptions + ['-release', '7']
++builder.build() == defaultOptions + 

Bug#895616: gradle: fix support for openjdk-9 --release flag

2018-04-13 Thread Tiago Stürmer Daitx
Source: gradle
Version: 3.4.1-7
Severity: normal

Dear Maintainer,

gradle 3.4.1 still detects and relies on the '-release' compiler
argument, but newer openjdk-9 has moved to a '--release' gnu-style
argument.

Upstream has fixed that on commit
https://github.com/gradle/gradle/commit/142f2f5233e77ba33146efe3815cd3b4b1245993

Please consider applying the patch. A debdiff will follow shortly (need
the bug # for the DEP-3 header).

thanks

-- System Information:
Debian Release: buster/sid
  APT prefers bionic
  APT policy: (500, 'bionic'), (400, 'bionic-proposed')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.15.0-13-generic (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US 
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled