[Git][java-team/ant][master] 4 commits: Adjust the source/target level to 7 when using Java 12 or later

Emmanuel Bourg gitlab at salsa.debian.org
Thu Jan 21 11:39:54 GMT 2021



Emmanuel Bourg pushed to branch master at Debian Java Maintainers / ant


Commits:
04340184 by Emmanuel Bourg at 2021-01-21T12:32:10+01:00
Adjust the source/target level to 7 when using Java 12 or later

- - - - -
22074b30 by Emmanuel Bourg at 2021-01-21T12:35:40+01:00
Standards-Version updated to 4.5.1

- - - - -
6f6fbb21 by Emmanuel Bourg at 2021-01-21T12:35:43+01:00
Switch to debhelper level 13

- - - - -
c983ae5a by Emmanuel Bourg at 2021-01-21T12:39:30+01:00
Upload to unstable

- - - - -


4 changed files:

- debian/changelog
- debian/control
- debian/patches/0013-auto-adjust-target.patch
- debian/patches/0015-javadoc-ignore-source-errors.patch


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+ant (1.10.9-2) unstable; urgency=medium
+
+  * Adjust the source/target level to 7 when using Java 12 or later
+  * Standards-Version updated to 4.5.1
+  * Switch to debhelper level 13
+
+ -- Emmanuel Bourg <ebourg at apache.org>  Thu, 21 Jan 2021 12:39:24 +0100
+
 ant (1.10.9-1) unstable; urgency=medium
 
   * New upstream release


=====================================
debian/control
=====================================
@@ -6,7 +6,7 @@ Uploaders: Matthias Klose <doko at debian.org>,
            James Page <james.page at canonical.com>,
            Emmanuel Bourg <ebourg at apache.org>
 Build-Depends: antlr,
-               debhelper-compat (= 12),
+               debhelper-compat (= 13),
                default-jdk,
                junit,
                junit4 (>= 4.11),
@@ -25,7 +25,7 @@ Build-Depends: antlr,
                libxml-commons-resolver1.1-java (>= 1.2-7~),
                libxz-java,
                maven-repo-helper (>> 1.0)
-Standards-Version: 4.5.0
+Standards-Version: 4.5.1
 Vcs-Git: https://salsa.debian.org/java-team/ant.git
 Vcs-Browser: https://salsa.debian.org/java-team/ant
 Homepage: http://ant.apache.org


=====================================
debian/patches/0013-auto-adjust-target.patch
=====================================
@@ -55,10 +55,10 @@ Forwarded: no
  
 --- /dev/null
 +++ b/src/main/org/apache/tools/ant/taskdefs/LanguageLevel.java
-@@ -0,0 +1,62 @@
+@@ -0,0 +1,76 @@
 +package org.apache.tools.ant.taskdefs;
 +
-+import java.util.Arrays;
++import java.util.ArrayList;
 +import java.util.List;
 +import org.apache.tools.ant.Project;
 +import org.apache.tools.ant.Task;
@@ -66,23 +66,41 @@ Forwarded: no
 +
 +class LanguageLevel {
 +
-+    /** The minimum language level supported by the current javac */
-+    private static final String MIN_LEVEL = "6";
-+
-+    /** The list of language levels no longer supported by the current javac */
-+    private static final List<String> UNSUPPORTED_LEVELS = Arrays.asList(new String[]{"1.1", "1.2", "1.3", "1.4", "1.5", "5"});
-+
 +    /** Detect if a Debian build is in process */
 +    static boolean isDebianBuild() {
 +        return System.getenv("DEB_BUILD_ARCH") != null;
 +    }
 +
-+    /** Detect if we're running on an older JVM */
-+    static boolean isPreJava9() {
-+        return JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_5)
-+                || JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_6)
-+                || JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_7)
-+                || JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_8);
++    /**
++     * Tells if the specified language level is supported by the current javac.
++     */
++    static boolean isLevelSupported(String level) {
++        List<String> unsupportedLevels = new ArrayList<>();
++        if (JavaEnvUtils.isAtLeastJavaVersion("9")) {
++            unsupportedLevels.add("1.1");
++            unsupportedLevels.add("1.2");
++            unsupportedLevels.add("1.3");
++            unsupportedLevels.add("1.4");
++            unsupportedLevels.add("1.5");
++            unsupportedLevels.add("5");
++        }
++        if (JavaEnvUtils.isAtLeastJavaVersion("12")) {
++            unsupportedLevels.add("1.6");
++            unsupportedLevels.add("6");
++        }
++
++        return !unsupportedLevels.contains(level);
++    }
++
++    /**
++     * Returns the minimum language level supported by the current javac.
++     */
++    static String getMinimumLevel() {
++        if (JavaEnvUtils.isAtLeastJavaVersion("12")) {
++            return "7";
++        }
++
++        return "6";
 +    }
 +
 +    /**
@@ -102,19 +120,15 @@ Forwarded: no
 +            return level;
 +        }
 +
-+        if (isPreJava9()) {
-+            // no need to do anything on pre-Java 9 JDKs
-+            return level;
-+        }
-+
-+        if (!UNSUPPORTED_LEVELS.contains(level)) {
++        if (isLevelSupported(level)) {
 +            return level;
 +        }
 +
++	String minLevel = getMinimumLevel();
 +        if (logger != null) {
-+            logger.log("Using " + location + " "  + level + " is no longer supported, switching to " + MIN_LEVEL, Project.MSG_WARN);
++            logger.log("Using " + location + " "  + level + " is no longer supported, switching to " + minLevel, Project.MSG_WARN);
 +        }
 +
-+        return MIN_LEVEL;
++        return minLevel;
 +    }
 +}


=====================================
debian/patches/0015-javadoc-ignore-source-errors.patch
=====================================
@@ -8,7 +8,7 @@ Forwarded: no
          doTags(toExecute);
          doSource(toExecute);
 +
-+        if (doclet == null && LanguageLevel.isDebianBuild() && !LanguageLevel.isPreJava9()) {
++        if (doclet == null && LanguageLevel.isDebianBuild() && JavaEnvUtils.isAtLeastJavaVersion("9")) {
 +            toExecute.createArgument().setValue("--ignore-source-errors");
 +            log("Debian build on Java 9+ detected: Adding the --ignore-source-errors option");
 +        }



View it on GitLab: https://salsa.debian.org/java-team/ant/-/compare/ac290c20e1c12717550ac0a5d6891a83d23b5885...c983ae5af983203e8bb4ba8927c44215e8aee134

-- 
View it on GitLab: https://salsa.debian.org/java-team/ant/-/compare/ac290c20e1c12717550ac0a5d6891a83d23b5885...c983ae5af983203e8bb4ba8927c44215e8aee134
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20210121/d746a94b/attachment.html>


More information about the pkg-java-commits mailing list