Bug 499717 - Update to Ant 1.10.1
Change-Id: I79e242914bbaccbab3f1b971c29450833c7c3786
diff --git a/ant/org.eclipse.ant.core/META-INF/MANIFEST.MF b/ant/org.eclipse.ant.core/META-INF/MANIFEST.MF
index 734477f..b2eaa75 100644
--- a/ant/org.eclipse.ant.core/META-INF/MANIFEST.MF
+++ b/ant/org.eclipse.ant.core/META-INF/MANIFEST.MF
@@ -15,7 +15,8 @@
org.eclipse.ant.internal.core.ant;x-friends:="org.eclipse.ant.launching",
org.eclipse.ant.internal.core.contentDescriber;x-internal:=true
Require-Bundle: org.eclipse.core.variables;bundle-version="[3.1.0,4.0.0)",
- org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)"
+ org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
+ org.apache.ant
Bundle-ActivationPolicy: lazy;exclude:="org.eclipse.ant.internal.core.contentDescriber"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ClassPath: .
diff --git a/ant/org.eclipse.ant.core/build.properties b/ant/org.eclipse.ant.core/build.properties
index aa4c163..bba6492 100644
--- a/ant/org.eclipse.ant.core/build.properties
+++ b/ant/org.eclipse.ant.core/build.properties
@@ -23,5 +23,4 @@
about_files/,\
lib/antsupportlib.jar
jars.compile.order = .,lib/antsupportlib.jar
-jars.extra.classpath = platform:/plugin/org.apache.ant/lib/ant.jar,platform:/plugin/org.apache.ant/lib/ant-launcher.jar
javacWarnings..=-unavoidableGenericProblems
diff --git a/ant/org.eclipse.ant.core/src_ant/org/eclipse/ant/internal/core/ant/InternalAntRunner.java b/ant/org.eclipse.ant.core/src_ant/org/eclipse/ant/internal/core/ant/InternalAntRunner.java
index d517ec8..7f13cd8 100644
--- a/ant/org.eclipse.ant.core/src_ant/org/eclipse/ant/internal/core/ant/InternalAntRunner.java
+++ b/ant/org.eclipse.ant.core/src_ant/org/eclipse/ant/internal/core/ant/InternalAntRunner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -71,6 +71,7 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.core.variables.VariablesPlugin;
import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
/**
* Eclipse application entry point into Ant. Derived from the original Ant Main class to ensure that the functionality is equivalent when running in
@@ -1017,7 +1018,9 @@
*/
protected boolean isVersionCompatible(String comparison) {
String version = getAntVersionNumber();
- return version.compareTo(comparison) >= 0;
+ Version osgiVersion = new Version(version);
+ Version osgiComparison = new Version(comparison);
+ return osgiVersion.compareTo(osgiComparison) >= 0;
}
/**
diff --git a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/InternalAntRunner.java b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/InternalAntRunner.java
index e3e6588..0daf973 100644
--- a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/InternalAntRunner.java
+++ b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/InternalAntRunner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* Portions Copyright 2000-2005 The Apache Software Foundation
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Apache Software License v2.0 which
@@ -29,7 +29,9 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.NoSuchElementException;
import java.util.Properties;
+import java.util.StringTokenizer;
import java.util.Vector;
import org.apache.tools.ant.AntTypeDefinition;
@@ -691,7 +693,93 @@
*/
private boolean isVersionCompatible(String comparison) {
String version = getAntVersionNumber();
- return version.compareTo(comparison) >= 0;
+ Version osgiVersion = new Version(version);
+ Version osgiComparison = new Version(comparison);
+ return osgiVersion.compareTo(osgiComparison) >= 0;
+ }
+
+ class Version {
+ private final int major;
+ private final int minor;
+ private final int micro;
+ private final String qualifier;
+ private static final String SEPARATOR = "."; //$NON-NLS-1$
+
+ public int compareTo(Version other) {
+ if (other == this) { // quick test
+ return 0;
+ }
+
+ int result = major - other.major;
+ if (result != 0) {
+ return result;
+ }
+
+ result = minor - other.minor;
+ if (result != 0) {
+ return result;
+ }
+
+ result = micro - other.micro;
+ if (result != 0) {
+ return result;
+ }
+
+ return qualifier.compareTo(other.qualifier);
+ }
+
+ public Version(String version) {
+ int maj = 0;
+ int min = 0;
+ int mic = 0;
+ String qual = ""; //$NON-NLS-1$
+
+ try {
+ StringTokenizer st = new StringTokenizer(version, SEPARATOR, true);
+ maj = parseInt(st.nextToken(), version);
+
+ if (st.hasMoreTokens()) { // minor
+ st.nextToken(); // consume delimiter
+ min = parseInt(st.nextToken(), version);
+
+ if (st.hasMoreTokens()) { // micro
+ st.nextToken(); // consume delimiter
+ mic = parseInt(st.nextToken(), version);
+
+ if (st.hasMoreTokens()) { // qualifier separator
+ st.nextToken(); // consume delimiter
+ qual = st.nextToken(""); // remaining string //$NON-NLS-1$
+
+ if (st.hasMoreTokens()) { // fail safe
+ throw new IllegalArgumentException("invalid version \"" + version + "\": invalid format"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ }
+ }
+ }
+ catch (NoSuchElementException e) {
+ IllegalArgumentException iae = new IllegalArgumentException("invalid version \"" + version + "\": invalid format");//$NON-NLS-1$ //$NON-NLS-2$
+ iae.initCause(e);
+ throw iae;
+ }
+
+ major = maj;
+ minor = min;
+ micro = mic;
+ qualifier = qual;
+ // validate();
+ }
+
+ private int parseInt(String value, String version) {
+ try {
+ return Integer.parseInt(value);
+ }
+ catch (NumberFormatException e) {
+ IllegalArgumentException iae = new IllegalArgumentException("invalid version \"" + version + "\": non-numeric \"" + value + "\""); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ iae.initCause(e);
+ throw iae;
+ }
+ }
}
@SuppressWarnings("unused")
diff --git a/ant/org.eclipse.ant.tests.core/tests/org/eclipse/ant/tests/core/tests/OptionTests.java b/ant/org.eclipse.ant.tests.core/tests/org/eclipse/ant/tests/core/tests/OptionTests.java
index cb0ff51..853440e 100644
--- a/ant/org.eclipse.ant.tests.core/tests/org/eclipse/ant/tests/core/tests/OptionTests.java
+++ b/ant/org.eclipse.ant.tests.core/tests/org/eclipse/ant/tests/core/tests/OptionTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,8 +26,8 @@
protected static final String UNKNOWN_ARG = "Unknown argument: "; //$NON-NLS-1$
protected static final String START_OF_HELP = "ant [options] [target [target2 [target3] ...]]"; //$NON-NLS-1$
- protected static final String VERSION = "Apache Ant(TM) version 1.9.6"; //$NON-NLS-1$
- protected static final String PLUGIN_VERSION = "org.apache.ant_1.9.6"; //$NON-NLS-1$
+ protected static final String VERSION = "Apache Ant(TM) version 1.10.1"; //$NON-NLS-1$
+ protected static final String PLUGIN_VERSION = "org.apache.ant_1.10.1"; //$NON-NLS-1$
public OptionTests(String name) {
super(name);
diff --git a/ant/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/PropertyTests.java b/ant/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/PropertyTests.java
index 970bccd..8f51224 100644
--- a/ant/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/PropertyTests.java
+++ b/ant/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/PropertyTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,7 +24,7 @@
public class PropertyTests extends AbstractAntDebugTest {
- private static final String ANT_VERSION = "Apache Ant(TM) version 1.9.6"; //$NON-NLS-1$
+ private static final String ANT_VERSION = "Apache Ant(TM) version 1.10.1"; //$NON-NLS-1$
public PropertyTests(String name) {
super(name);
diff --git a/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/separateVM/SeparateVMTests.java b/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/separateVM/SeparateVMTests.java
index 113acfb..cfe6e56 100644
--- a/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/separateVM/SeparateVMTests.java
+++ b/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/separateVM/SeparateVMTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2015 IBM Corporation and others.
+ * Copyright (c) 2004, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,9 +17,6 @@
import java.util.List;
import java.util.Map;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.eclipse.ant.internal.ui.AntUIPlugin;
import org.eclipse.ant.internal.ui.IAntUIConstants;
import org.eclipse.ant.internal.ui.IAntUIPreferenceConstants;
@@ -38,9 +35,12 @@
import org.eclipse.swt.graphics.Color;
import org.eclipse.ui.console.IHyperlink;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
public class SeparateVMTests extends AbstractAntUIBuildTest {
- protected static final String PLUGIN_VERSION = "org.apache.ant_1.9.6"; //$NON-NLS-1$
+ protected static final String PLUGIN_VERSION = "org.apache.ant_1.10.1"; //$NON-NLS-1$
public SeparateVMTests(String name) {
super(name);