[ant] 01/01: adjust source/target in more cases
Chris West
faux-guest at moszumanska.debian.org
Fri Sep 8 17:52:25 UTC 2017
This is an automated email from the git hooks/post-receive script.
faux-guest pushed a commit to branch master
in repository ant.
commit 7bfdc48778a265250a5ac9987273ac2e3f00acad
Author: Chris West (Faux) <git at goeswhere.com>
Date: Fri Sep 8 16:04:45 2017 +0100
adjust source/target in more cases
---
debian/changelog | 8 +++
debian/patches/0013-auto-adjust-target.patch | 91 ++++++++++++++++++++++++----
2 files changed, 86 insertions(+), 13 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 6fedd85..5866af6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+ant (1.9.9-5) UNRELEASED; urgency=medium
+
+ * Adjust source/target level in Debian builds in more cases:
+ - when ant.build.javac.source is set (Closes: #873969)
+ - for javadoc (Closes: #873977)
+
+ -- Chris West (Faux) <debian at fau.xxx> Fri, 08 Sep 2017 15:58:49 +0100
+
ant (1.9.9-4) unstable; urgency=medium
* Team upload.
diff --git a/debian/patches/0013-auto-adjust-target.patch b/debian/patches/0013-auto-adjust-target.patch
index e685efe..d839ec3 100644
--- a/debian/patches/0013-auto-adjust-target.patch
+++ b/debian/patches/0013-auto-adjust-target.patch
@@ -1,25 +1,90 @@
Description: Adjust the source/target level automatically for Debian builds with Java 9
Author: Emmanuel Bourg <ebourg at apache.org>
Forwarded: no
+
--- a/src/main/org/apache/tools/ant/taskdefs/Javac.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Javac.java
-@@ -1109,6 +1109,19 @@
+@@ -207,7 +207,10 @@
+ */
+ public String getSource() {
+ return source != null
+- ? source : getProject().getProperty(MagicNames.BUILD_JAVAC_SOURCE);
++ ? source : washPlatformVersion(
++ getProject().getProperty(MagicNames.BUILD_JAVAC_SOURCE),
++ MagicNames.BUILD_JAVAC_SOURCE,
++ this);
+ }
+
+ /**
+@@ -786,7 +789,10 @@
+ public String getTarget() {
+ return targetAttribute != null
+ ? targetAttribute
+- : getProject().getProperty(MagicNames.BUILD_JAVAC_TARGET);
++ : washPlatformVersion(
++ getProject().getProperty(MagicNames.BUILD_JAVAC_TARGET),
++ MagicNames.BUILD_JAVAC_TARGET,
++ this);
+ }
+
+ /**
+@@ -1109,6 +1115,9 @@
checkParameters();
resetFileLists();
-+ if (JAVAC9.equals(assumedJavaVersion()) && System.getenv("DEB_BUILD_ARCH") != null) {
-+ // adjust the source/target level automatically for Debian builds with Java 9
-+ List<String> unsupportedLanguageLevels = java.util.Arrays.asList(new String[]{"1.1", "1.2", "1.3", "1.4", "1.5", "5"});
-+ if (unsupportedLanguageLevels.contains(source)) {
-+ log("Use of a source " + source + " is no longer supported, switching to 1.6", Project.MSG_WARN);
-+ source = "1.6";
-+ }
-+ if (unsupportedLanguageLevels.contains(targetAttribute)) {
-+ log("Use of a target " + targetAttribute + " is no longer supported, switching to 1.6", Project.MSG_WARN);
-+ targetAttribute = "1.6";
-+ }
-+ }
++ source = washPlatformVersion(source, "javac -source", this);
++ targetAttribute = washPlatformVersion(targetAttribute, "javac -target", this);
+
// scan source directories and dest directory to build up
// compile list
if (hasPath(src)) {
+@@ -1721,4 +1730,38 @@
+ 0x00, 0x00, 0x00, 0x02, 0x00, 0x04
+ };
+
++ /// adjust the source/target level automatically for Debian builds with Java >=9
++ static String washPlatformVersion(String original, String location, org.apache.tools.ant.Task logTo) {
++ if (null == original) {
++ return original;
++ }
++
++ if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_4)
++ || JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_5)
++ || JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_6)
++ || JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_7)
++ || JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_8)) {
++
++ // no need to do anything on pre-Java 9 JDKs
++ return original;
++ }
++
++ if (System.getenv("DEB_BUILD_ARCH") == null) {
++
++ // only do this is it's a Debian package build
++ return original;
++ }
++
++ List<String> unsupportedLanguageLevels = java.util.Arrays.asList(new String[]{"1.1", "1.2", "1.3", "1.4", "1.5", "5"});
++
++ if (!unsupportedLanguageLevels.contains(original)) {
++ return original;
++ }
++
++ if (logTo != null) {
++ logTo.log("Using " + location + " " + original + " is no longer supported, switching to 1.6", Project.MSG_WARN);
++ }
++
++ return "1.6";
++ }
+ }
+--- a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
++++ b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
+@@ -2203,7 +2203,7 @@
+ : getProject().getProperty(MagicNames.BUILD_JAVAC_SOURCE);
+ if (sourceArg != null) {
+ toExecute.createArgument().setValue("-source");
+- toExecute.createArgument().setValue(sourceArg);
++ toExecute.createArgument().setValue(Javac.washPlatformVersion(sourceArg, "javadoc -source", this));
+ }
+
+ if (linksource && doclet == null) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/ant.git
More information about the pkg-java-commits
mailing list