From bd0759d943a7717e43d1d774afc4c3e1cb2bc04c Mon Sep 17 00:00:00 2001
From: Stefan Bodewig
Date: Wed, 29 Nov 2017 16:17:34 +0100
Subject: [PATCH] try to adapt to Java10+ rapidly changing major versions
---
WHATSNEW | 1 +
build.xml | 3 +
manual/Tasks/conditions.html | 39 ++++
manual/Tasks/javac.html | 9 +-
src/main/org/apache/tools/ant/antlib.xml | 2 +
.../org/apache/tools/ant/taskdefs/Javac.java | 16 +-
.../compilers/CompilerAdapterFactory.java | 3 +-
.../compilers/DefaultCompilerAdapter.java | 23 ++-
.../ant/taskdefs/condition/JavaVersion.java | 115 +++++++++++
.../tools/ant/types/conditions/antlib.xml | 2 +
.../apache/tools/ant/util/JavaEnvUtils.java | 178 +++++++++---------
src/tests/antunit/antunit-base.xml | 3 +
.../taskdefs/condition/javaversion-test.xml | 40 ++++
src/tests/antunit/taskdefs/javac-test.xml | 9 +-
14 files changed, 337 insertions(+), 106 deletions(-)
create mode 100644 src/main/org/apache/tools/ant/taskdefs/condition/JavaVersion.java
create mode 100644 src/tests/antunit/taskdefs/condition/javaversion-test.xml
diff --git a/WHATSNEW b/WHATSNEW
index e331033a6..79fb177bc 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -48,6 +48,7 @@ Other changes:
upgraded to 0.1.54. Jsch is the library behind the sshexec
and scp Ant tasks.
+ * Added a new condition.
Changes from Ant 1.9.8 TO Ant 1.9.9
===================================
diff --git a/build.xml b/build.xml
index d20cdd33e..ffa86f1b8 100644
--- a/build.xml
+++ b/build.xml
@@ -379,6 +379,9 @@
+
+
+
diff --git a/manual/Tasks/conditions.html b/manual/Tasks/conditions.html
index 08d0bccec..35216cdff 100644
--- a/manual/Tasks/conditions.html
+++ b/manual/Tasks/conditions.html
@@ -1090,5 +1090,44 @@ is redundant and will be ignored.
<file file="${file}"/>
</resourceexists>
+
+
+
+Tests the version of the JVM executing Ant. Since Ant
+1.9.10
+
+
+
+ Attribute |
+ Description |
+ Required |
+
+
+ atleast |
+ The version that this JVM is at least.
+ The format is major.minor.point. Starting with Java9 really
+ only the major number is determined. |
+ No |
+ One of these. |
+
+
+ exactly |
+ The version that this JVM is exactly.
+ The format is major.minor.point. Starting with Java9 really
+ only the major number is determined. |
+ No |
+
+
+
+
+ An example:
+
+
+
+<javaversion atleast="9"/>
+
+
+will evaluate to true if the current JVM is Java9 or above.
+