cleanup:
- clean up error messages for meaningfulness
- add additional debug logging
- add some syntax checks to close loopholes
- Add new pertinent tests for selectBundle
- migrate test.xml into build.xml
- add execution of Tester (Version testing class) into
build.xml
- Add new pertinent tests to Tester
- delete old test.xml
Version:
- additionally check for and trim leading or trailing
white-space from version.
- remove object-String value comparisons
(would require parsing and evaluating string. No use-case)
- fix object-object value comparisons
SelectBundle:
- update matchCriteria() to use object-object comparisons
diff --git a/ant_customizations.jar b/ant_customizations.jar
index e8e9542..850a4c7 100644
--- a/ant_customizations.jar
+++ b/ant_customizations.jar
Binary files differ
diff --git a/ant_customizations/.externalToolBuilders/New_Builder.launch b/ant_customizations/.externalToolBuilders/New_Builder.launch
new file mode 100644
index 0000000..420bf30
--- /dev/null
+++ b/ant_customizations/.externalToolBuilders/New_Builder.launch
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
+<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
+<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="AntCustomizations"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/AntCustomizations/antbuild.xml}"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-verbose"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/AntCustomizations}"/>
+</launchConfiguration>
diff --git a/ant_customizations/.project b/ant_customizations/.project
new file mode 100644
index 0000000..2aaf7be
--- /dev/null
+++ b/ant_customizations/.project
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>AntCustomizations</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ <dictionary>
+ <key>LaunchConfigHandle</key>
+ <value><project>/.externalToolBuilders/New_Builder.launch</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
diff --git a/ant_customizations/antbuild.xml b/ant_customizations/antbuild.xml
index 3934f3a..53df3e9 100644
--- a/ant_customizations/antbuild.xml
+++ b/ant_customizations/antbuild.xml
@@ -1,5 +1,6 @@
<project name="Ant Customizations" default="all">
- <target name="all" depends="build, publish"/>
+ <target name="all" depends="build, publish, test"/>
+ <target name="stage" depends="build, publish"/>
<target name="build" depends="jar"/>
<target name="init">
@@ -10,13 +11,45 @@
<pathelement location="${ant.dir_temp}"/>
</path>
</pathconvert>
- <property name="publish.dir" value=".."/>
- <property name="project.dir" value="."/>
- <property name="output.dir" value="${project.dir}/output"/>
- <property name="src.dir" value="${project.dir}/src"/>
+ <dirname property="ant_customizations.build.location_temp" file="${ant.file.ant_customizations}"/>
+ <pathconvert targetos="unix" property="ant_customizations.build.location">
+ <path>
+ <pathelement location="${ant_customizations.build.location_temp}"/>
+ </path>
+ </pathconvert>
+ <property file="${user.home}/build.properties"/>
+ <!-- ant_customizations.2.base.dir needs to be explicit (not relative) for antcall usage -->
+ <!-- (I think the selectbundle call reverts to calling dir - despite the antcall "dir=") -->
+ <property name="ant_customizations.2.base.dir" value="${ant_customizations.build.location}/../.."/>
+ <property name="ant_customizations.2.common.plugins.dir" value="${ant_customizations.2.base.dir}/plugins"/>
+ <property name="ant_customizations.2.jpa.plugins.dir" value="${ant_customizations.2.base.dir}/jpa/plugins"/>
+ <property name="ant_customizations.2.sdo.plugins.dir" value="${ant_customizations.2.base.dir}/sdo/plugins"/>
+ <property name="ant_customizations.2.util.plugins.dir" value="${ant_customizations.2.base.dir}/utils/plugins"/>
+
+ <echo message="ant.project.name ='${ant.project.name}'"/>
+ <echo message="basedir ='${basedir}'"/>
+ <echo message="ant_customizations.build.location ='${ant_customizations.build.location}'"/>
+ <echo message="ant_customizations.2.base.dir ='${ant_customizations.2.base.dir}'"/>
+ <echo message="ant_customizations.2.common.plugins.dir ='${ant_customizations.2.common.plugins.dir}'"/>
+ <echo message="ant_customizations.2.jpa.plugins.dir ='${ant_customizations.2.jpa.plugins.dir}'"/>
+ <echo message="ant_customizations.2.sdo.plugins.dir ='${ant_customizations.2.sdo.plugins.dir}'"/>
+ <echo message="ant_customizations.2.util.plugins.dir ='${ant_customizations.2.util.plugins.dir}'"/>
+ <echo message=" ---"/>
+
+ <property name="publish.dir" value="${ant_customizations.build.location}/.."/>
+ <property name="output.dir" value="${ant_customizations.build.location}/output"/>
+ <property name="src.dir" value="${ant_customizations.build.location}/src"/>
<property name="classes.dir" value="${output.dir}/classes"/>
<property name="custom.jar" value="ant_customizations.jar"/>
<property name="custom.lib" value="${output.dir}/${custom.jar}"/>
+
+ <echo message="publish.dir ='${publish.dir}'"/>
+ <echo message="output.dir ='${output.dir}'"/>
+ <echo message="src.dir ='${src.dir}'"/>
+ <echo message="classes.dir ='${classes.dir}'"/>
+ <echo message="custom.jar ='${custom.jar}'"/>
+ <echo message="custom.lib ='${custom.lib}'"/>
+
<tstamp/>
<echo message="ant.dir = '${ant.dir}'"/>
<available file="${ant.dir}" type="dir" property="ant.exists"/>
@@ -53,9 +86,6 @@
</jar>
</target>
- <target name="test">
- </target>
-
<target name="archive-old" if="pub.jar.exists">
<move file="${publish.dir}/${custom.jar}" tofile="${publish.dir}/ant_customizations_bak_on_${DSTAMP}${TSTAMP}.jar"/>
</target>
@@ -63,4 +93,202 @@
<target name="publish" depends="init, pub_init, archive-old">
<copy file="${custom.lib}" todir="${publish.dir}"/>
</target>
+
+ <!-- TESTING TARGETS -->
+ <target name="test" depends="test-init, test-version-class, test-selectbundle, test-cleanRevision"/>
+
+ <target name="test-init" depends="init">
+ <property name="custom.tasks.lib" value="${publish.dir}/ant_customizations.jar"/>
+ <property name="custom.echo.task.class" value="org.eclipse.persistence.buildtools.ant.taskdefs.Say"/>
+ <property name="custom.selectbundle.task.class" value="org.eclipse.persistence.buildtools.ant.taskdefs.SelectBundle"/>
+ <property name="custom.cleanrev.task.class" value="org.eclipse.persistence.buildtools.ant.taskdefs.CleanRevision"/>
+
+ <echo message="custom.tasks.lib = '${custom.tasks.lib}'"/>
+ <available file="${custom.tasks.lib}" property="antcustomizations.lib.exist"/>
+ <fail message="Ant customizations file not found!" unless="antcustomizations.lib.exist"/>
+
+ <taskdef name="say" classname="${custom.echo.task.class}" classpath="${custom.tasks.lib}"/>
+ <taskdef name="selectbundle" classname="${custom.selectbundle.task.class}" classpath="${custom.tasks.lib}"/>
+ <taskdef name="cleanRevision" classname="${custom.cleanrev.task.class}" classpath="${custom.tasks.lib}"/>
+
+ <say message=" First test is passed. Customizations found and 'say' works!" if="antcustomizations.lib.exist"/>
+ </target>
+
+ <target name="test-version-class" depends="test-init">
+ <say message=" "/>
+ <say message="Running Version Tester class..."/>
+ <java classname="org.eclipse.persistence.buildtools.helper.Tester">
+ <classpath>
+ <pathelement location="${publish.dir}/${custom.jar}"/>
+ </classpath>
+ </java>
+ <say message="Done."/>
+ </target>
+
+ <target name="test-selectbundle" depends="test-init">
+ <condition property="bnd.search.dir" value="${ant_customizations.2.base.dir}/../extension.lib.external"
+ else="${ant_customizations.2.common.plugins.dir}">
+ <available file="${ant_customizations.2.base.dir}/../extension.lib.external" type="dir"/>
+ </condition>
+ <echo message="bnd.search.dir = '${bnd.search.dir}'"/>
+ <property name="plugin.dir" value="${ant_customizations.2.common.plugins.dir}"/>
+
+ <property name="bnd.prefix" value="bnd"/>
+ <property name="bnd.separator" value="-"/>
+ <property name="bnd.criteria" value="[0.0.350, 0.1.0)"/>
+ <property name="bnd.property" value="selected.bnd.jar"/>
+ <property name="bnd.property2" value="selected.bnd.lib"/>
+
+ <property name="xmlbind.prefix" value="javax.xml.bind"/>
+ <property name="xmlbind.criteria" value="[2.0, 3.0)"/>
+ <property name="xmlbind.property" value="selected.xmlbind.jar"/>
+
+ <property name="ant.prefix" value="org.apache.ant"/>
+ <property name="ant.criteria" value="[1.7, 1.8)"/>
+ <property name="ant.property" value="selected.ant.jar"/>
+ <property name="ant.version.property" value="selected.ant.version"/>
+
+ <property name="jpa.prefix" value="javax.persistence"/>
+ <property name="jpa.criteria" value="[1.0, 2.2)"/>
+ <property name="jpa.property" value="selected.jpa.jar"/>
+
+ <property name="validation.prefix" value="javax.validation"/>
+ <property name="validation.criteria" value="[1.0, 2.2)"/>
+ <property name="validation.property" value="selected.validation.jar"/>
+
+ <say message=" "/>
+ <say message="Test basic find of bnd (using - separator)..."/>
+ <selectbundle
+ criterion="${bnd.criteria}"
+ basename="${bnd.prefix}"
+ directory="${bnd.search.dir}"
+ property="${bnd.property}"
+ separator="${bnd.separator}"
+ />
+ <say message="selected file: '${selected.bnd.jar}'" if="${bnd.property}"/>
+ <say message="Bnd (${bnd.prefix}) bundle not found in '${bnd.search.dir}'!" unless="${bnd.property}"/>
+
+ <say message=" "/>
+ <selectbundle
+ criterion="${bnd.criteria}"
+ basename="${bnd.prefix}"
+ directory=".."
+ property="${bnd.property}"
+ separator="${bnd.separator}"
+ />
+ <say message="selected file: '${selected.bnd.jar}'" if="${bnd.property}"/>
+ <say message="Bnd (${bnd.prefix}) bundle not found in '${bnd.search.dir}'!" unless="${bnd.property}"/>
+ <say message="If not found bdn.property was overwritten by second search in '..'"/>
+
+ <say message=" "/>
+ <say message="Test includepath flag using bnd..."/>
+ <selectbundle
+ includepath="true"
+ criterion="${bnd.criteria}"
+ basename="${bnd.prefix}"
+ directory="${bnd.search.dir}"
+ property="${bnd.property2}"
+ separator="${bnd.separator}"
+ />
+ <say message="selected file: '${selected.bnd.lib}'" if="${bnd.property2}"/>
+ <say message="Bnd (${bnd.prefix}) bundle not found in '${bnd.search.dir}'!" unless="${bnd.property2}"/>
+
+ <say message=" "/>
+ <say message="Test finding ${xmlbind.prefix} (using default separator)..."/>
+ <selectbundle
+ criterion="${xmlbind.criteria}"
+ basename="${xmlbind.prefix}"
+ directory="${ant_customizations.2.common.plugins.dir}"
+ property="${xmlbind.property}"
+ />
+ <say message="selected file: '${selected.xmlbind.jar}'" if="${xmlbind.property}"/>
+ <say message="Javax.xml.bind (${xmlbind.prefix}) bundle not found in '${ant_customizations.2.common.plugins.dir}'!" unless="${xmlbind.property}"/>
+
+ <say message=" "/>
+ <say message="Test finding ${ant.prefix} (using default separator)..."/>
+ <selectbundle
+ criterion="${ant.criteria}"
+ basename="${ant.prefix}"
+ directory="${ant_customizations.2.common.plugins.dir}"
+ property="${ant.property}"
+ suffix="zip"
+ />
+ <say message="selected file: '${selected.ant.jar}'" if="${ant.property}"/>
+ <say message="Ant (${ant.prefix}) bundle not found in '${ant_customizations.2.common.plugins.dir}'!" unless="${ant.property}"/>
+
+ <say message="Test finding ${ant.prefix} (using default separator, and specifying a 'zip' suffix) (version only)..."/>
+ <selectbundle
+ versiononly="true"
+ criterion="${ant.criteria}"
+ basename="${ant.prefix}"
+ directory="${ant_customizations.2.common.plugins.dir}"
+ property="${ant.version.property}"
+ suffix="zip"
+ />
+ <say message="selected file: '${selected.ant.version}'" if="${ant.version.property}"/>
+ <say message="Ant (${ant.prefix}) bundle not found in '${ant_customizations.2.common.plugins.dir}'!" unless="${ant.version.property}"/>
+
+ <say message=" "/>
+ <say message="Test finding ${jpa.prefix} (using default separator)..."/>
+ <selectbundle
+ criterion="${jpa.criteria}"
+ basename="${jpa.prefix}"
+ directory="${ant_customizations.2.common.plugins.dir}"
+ property="selected.jpa1.jar"
+ />
+ <say message="selected file: '${selected.jpa1.jar}'" if="selected.jpa1.jar"/>
+ <say message="JPA (${jpa.prefix}) bundle not found in '${ant_customizations.2.common.plugins.dir}'!" unless="selected.jpa1.jar"/>
+
+ <say message=" "/>
+ <say message="Test finding ${jpa.prefix} (using default separator)..."/>
+ <selectbundle
+ criterion="${jpa.criteria}"
+ basename="${jpa.prefix}"
+ directory="${ant_customizations.2.jpa.plugins.dir}"
+ property="${jpa.property}"
+ />
+ <say message="selected file: '${selected.jpa.jar}'" if="${jpa.property}"/>
+ <say message="JPA (${jpa.prefix}) bundle not found in '${ant_customizations.2.jpa.plugins.dir}'!" unless="${jpa.property}"/>
+
+ <say message=" "/>
+ <say message="Test finding ${validation.prefix} (using default separator)..."/>
+ <selectbundle
+ criterion="${validation.criteria}"
+ basename="${validation.prefix}"
+ directory="${ant_customizations.2.jpa.plugins.dir}"
+ property="${validation.property}"
+ />
+ <say message="selected file: '${selected.validation.jar}'" if="${validation.property}"/>
+ <say message="JPA (${validation.prefix}) bundle not found in '${ant_customizations.2.jpa.plugins.dir}'!" unless="${validation.property}"/>
+ </target>
+
+ <target name="test-cleanRevision" depends="test-init">
+ <property name="svn.exec" value="svn"/>
+ <property name="branch.name" value=""/>
+ <property name="branch.dir" value="${branch.name}trunk"/>
+ <property name="svn.r.protocol" value="http:"/>
+ <property name="svn.rw.protocol" value="svn+ssh:"/>
+ <property name="osvn.server.name" value="egwin@eldev"/>
+ <property name="svn.server.name" value="dev.eclipse.org"/>
+ <property name="svn.base.urlpath" value="//${svn.server.name}/svnroot/rt/org.eclipse.persistence"/>
+ <property name="svn.base.url" value="${svn.r.protocol}${svn.base.urlpath}"/>
+ <property name="svn.branch.url" value="${svn.base.url}/${branch.dir}"/>
+
+ <exec outputproperty="svn.revision"
+ failonerror="false"
+ failifexecutionfails="false"
+ errorproperty="svnversion.failed"
+ logError="true"
+ executable="${svn.exec}">
+ <arg value="info"/>
+ <arg value="--revision"/>
+ <arg value="HEAD"/>
+ <arg value="${svn.branch.url}"/>
+ </exec>
+ <say message="SVN log command failed!" if="svnversion.failed"/>
+ <say message="b:svn.revision = '${svn.revision}'"/>
+ <cleanRevision input="${svn.revision}" property="svn.revision"/>
+ <say message="a:svn.revision = '${svn.revision}'"/>
+ </target>
+
</project>
diff --git a/ant_customizations/src/org/eclipse/persistence/buildtools/ant/taskdefs/SelectBundle.java b/ant_customizations/src/org/eclipse/persistence/buildtools/ant/taskdefs/SelectBundle.java
index a8398f1..8219527 100644
--- a/ant_customizations/src/org/eclipse/persistence/buildtools/ant/taskdefs/SelectBundle.java
+++ b/ant_customizations/src/org/eclipse/persistence/buildtools/ant/taskdefs/SelectBundle.java
@@ -8,10 +8,12 @@
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SelectBundle
- * property to set
- * basename (bnd, org.eclipse.equinox) required
- * separator (-,_) default to _
- * criterion OSGi selection criteria [1.0,2.0) required
+ * basename (bnd, org.eclipse.equinox) : required
+ * criterion OSGi version selection criteria [1.0,2.0) : required
+ * separator separator used between basename and version in filename (such as - or _) : defaults to _
+ * property propety to set : required
+ * includepath boolean flag, if set will include path and filename in "property" : defaults to 'false'
+ * versiononly boolean flag, if set will only set full version of bundle in "property" : defaults to 'false'
*
* Contributors:
* egwin - initial conception and implementation
@@ -25,6 +27,7 @@
import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException;
import org.eclipse.persistence.buildtools.helper.Version;
+import org.eclipse.persistence.buildtools.helper.VersionException;
public class SelectBundle extends Task {
private boolean includepath = false; // whether to include the path (directory property) in the value of property if selection is successful (default: no)
@@ -36,11 +39,12 @@
private String separator = "_"; // the separator used to differentiate basename and jarversion
private String suffix = "jar"; // suffix of file to find (default: jar)
- private boolean minInclusive = false; // local: whether the 'floor' version is inclusive or not "("=true "["=false
- private boolean maxInclusive = false; // local: whether the 'ceiling' version is inclusive or not "("=true "["=false
+ private boolean minInclusive = false; // local: whether the 'floor' version is inclusive or not "["=true "("=false
+ private boolean maxInclusive = false; // local: whether the 'ceiling' version is inclusive or not "]"=true ")"=false
private Version minVersion = null; // local: the value of the "floor" version
private Version maxVersion = null; // local: the value of the "ceiling" version
- private String version = ""; // the 'version' component of the "bestmatch" string
+ private Version bestVersion = null; // the 'version' component of the "bestmatch" string
+ private Version version = null; // the 'version' currently being evaluated
private void evaluateCriteria() throws BuildException {
// ()= includes
@@ -62,12 +66,19 @@
// validate end of string
if ( !( maxSquareBracket || maxRoundBracket || endInt ) )
throw new BuildException("The criterion attribute must end with ),], or a number.", getLocation());
- // validate basic syntax
+ // validate basic syntax (should add check for multiple ",")
if((initInt && !endInt) || (!initInt && endInt) || (!initInt && !commapresent) || (initInt && commapresent) )
throw new BuildException("The criterion attribute must be a valid OSGi version range string", getLocation());
- // determine "floor" version
+ // validate range syntax (add check for multiple ",")
+ if(commapresent) {
+ // if multiple comma present
+ if( criterion.substring(criterion.indexOf(',')+1,endIndex).contains(",") )
+ throw new BuildException("The criterion attribute must be a valid OSGi version range string: multiple comma(,) detected.", getLocation());
+ }
+ // set "inclusion" status
minInclusive = (minSquareBracket || initInt);
maxInclusive = (maxSquareBracket || endInt);
+ // determine "floor" version
//singleton version
if(initInt) {
log("evaluateCriteria: Singleton detected", Project.MSG_VERBOSE);
@@ -108,13 +119,15 @@
}
private String matchCriteria() {
- String bestMatch = null; //filename of file selected
+ String bestMatch = null; //filename of file selected
String[] filelist = getListOfFiles(directory);
-
+
+ bestVersion = minVersion; //Start search with bestVersion set to minimum acceptable
+ log("matchCriteria: bestVersion.getIdentifier='" + bestVersion.getIdentifier() + "'", Project.MSG_VERBOSE);
log("matchCriteria: basename.length='" + Integer.toString(basename.length()) + "'", Project.MSG_VERBOSE);
log("matchCriteria: separator.length='" + Integer.toString(separator.length()) + "'", Project.MSG_VERBOSE);
int relativeVersionIndex = basename.length() + separator.length();
- log("matchCriteria: relativeVersionIndex(" + Integer.toString(relativeVersionIndex) + ")", Project.MSG_VERBOSE);
+ log("matchCriteria: relativeVersionIndex='" + Integer.toString(relativeVersionIndex) + "' (Should be '" + Integer.toString(basename.length()+separator.length()) + "')", Project.MSG_VERBOSE);
if( filelist != null ) {
log("matchCriteria: filelist.length='" + Integer.toString(filelist.length) + "'", Project.MSG_VERBOSE);
for ( int i=0; i<filelist.length; i++ )
@@ -123,28 +136,61 @@
log("matchCriteria: versionEndIndex(" + Integer.toString(versionEndIndex)+")", Project.MSG_VERBOSE);
log("matchCriteria: filelist["+ Integer.toString(i) + "](" + filelist[i] + ")", Project.MSG_VERBOSE);
// Should add try block to test for version exception
- version = filelist[i].substring(relativeVersionIndex,versionEndIndex);
-
- log("matchCriteria: version string of found file(" + version + ")", Project.MSG_VERBOSE);
- if(version.length()>0){
+ try {
+ version = new Version( filelist[i].substring(relativeVersionIndex,versionEndIndex) );
+ } catch ( VersionException e){
+ log("matchCriteria: Exception detected -> " + e, Project.MSG_VERBOSE);
+ }
+
+ log("matchCriteria: version string of found file(" + version.getIdentifier() + ")", Project.MSG_VERBOSE);
+ if(!version.empty()) {
if(minInclusive && maxInclusive) {
+ log("matchCriteria: Test: " + minVersion.getIdentifier() + " <= " + version.getIdentifier() + " <= " + maxVersion.getIdentifier(), Project.MSG_VERBOSE);
if(minVersion.le(version) && maxVersion.ge(version) ){
- bestMatch = filelist[i];
+ log("matchCriteria: Pass", Project.MSG_VERBOSE);
+ if( bestVersion.lt(version) ){
+ log("matchCriteria: " + bestVersion.getIdentifier() + " < " + version.getIdentifier(), Project.MSG_VERBOSE);
+ bestMatch = filelist[i];
+ bestVersion = version;
+ } else
+ log("matchCriteria: ! " + bestVersion.getIdentifier() + " < " + version.getIdentifier(), Project.MSG_VERBOSE);
}
}
else if (minInclusive && !maxInclusive){
+ log("matchCriteria: Test: " + minVersion.getIdentifier() + " <= " + version.getIdentifier() + " < " + maxVersion.getIdentifier(), Project.MSG_VERBOSE);
+ log("matchCriteria: Result: " + Boolean.toString(minVersion.le(version)) + " && " + Boolean.toString(maxVersion.gt(version)), Project.MSG_VERBOSE);
if(minVersion.le(version) && maxVersion.gt(version) ){
- bestMatch = filelist[i];
+ log("matchCriteria: Pass", Project.MSG_VERBOSE);
+ if( bestVersion.lt(version) ){
+ log("matchCriteria: " + bestVersion.getIdentifier() + " < " + version.getIdentifier(), Project.MSG_VERBOSE);
+ bestMatch = filelist[i];
+ bestVersion = version;
+ } else
+ log("matchCriteria: ! " + bestVersion.getIdentifier() + " < " + version.getIdentifier(), Project.MSG_VERBOSE);
}
}
else if (!minInclusive && maxInclusive){
+ log("matchCriteria: Test: " + minVersion.getIdentifier() + " < " + version.getIdentifier() + " <= " + maxVersion.getIdentifier(), Project.MSG_VERBOSE);
if(minVersion.lt(version) && maxVersion.ge(version) ){
- bestMatch = filelist[i];
+ log("matchCriteria: Pass", Project.MSG_VERBOSE);
+ if( bestVersion.lt(version) ){
+ log("matchCriteria: " + bestVersion.getIdentifier() + " < " + version.getIdentifier(), Project.MSG_VERBOSE);
+ bestMatch = filelist[i];
+ bestVersion = version;
+ } else
+ log("matchCriteria: ! " + bestVersion.getIdentifier() + " < " + version.getIdentifier(), Project.MSG_VERBOSE);
}
}
else if (!minInclusive && !maxInclusive ){
+ log("matchCriteria: Test: " + minVersion.getIdentifier() + " < " + version.getIdentifier() + " < " + maxVersion.getIdentifier(), Project.MSG_VERBOSE);
if(minVersion.lt(version) && maxVersion.gt(version) ){
- bestMatch = filelist[i];
+ log("matchCriteria: Pass", Project.MSG_VERBOSE);
+ if( bestVersion.lt(version) ){
+ log("matchCriteria: " + bestVersion.getIdentifier() + " < " + version.getIdentifier(), Project.MSG_VERBOSE);
+ bestMatch = filelist[i];
+ bestVersion = version;
+ } else
+ log("matchCriteria: ! " + bestVersion.getIdentifier() + " < " + version.getIdentifier(), Project.MSG_VERBOSE);
}
}
log("matchCriteria: Best Match so far(" + bestMatch + ")", Project.MSG_VERBOSE);
@@ -192,7 +238,7 @@
getProject().setNewProperty(property, directory+"/"+file);
else {
if (versiononly)
- getProject().setNewProperty(property, version);
+ getProject().setNewProperty(property, bestVersion.getIdentifier() );
else
getProject().setNewProperty(property, file);
}
diff --git a/ant_customizations/src/org/eclipse/persistence/buildtools/helper/Tester.java b/ant_customizations/src/org/eclipse/persistence/buildtools/helper/Tester.java
index 490b06b..4a9dda5 100644
--- a/ant_customizations/src/org/eclipse/persistence/buildtools/helper/Tester.java
+++ b/ant_customizations/src/org/eclipse/persistence/buildtools/helper/Tester.java
@@ -5,11 +5,22 @@
public class Tester {
public static void main(String[] args) {
- Version testversion = null;
+ Version testversion = null;
+ Version testversion2 = null;
+ int testnum = 0;
+ String testVersion;
+
+ System.out.println("Constructor Testing: *** Expected failure testing...");
+
+ // Test version empty
try {
- testversion = new Version(".9.7");
- System.out.println("test4 Version: '" + testversion.getIdentifier() + "'.");
+ testVersion = "";
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test initial token missing");
+ System.out.println("Test" + testnum + " versionString='" + testVersion + "':");
+ testversion = new Version(testVersion);
} catch ( VersionException e){
System.out.println("Error: " + e);
System.out.println("-------------------------");
@@ -20,24 +31,16 @@
System.out.println("-------------------------");
e.printStackTrace();
}
+ System.out.println("=========================");
+ // Test initial token missing
try {
- testversion = new Version("5.");
- System.out.println("test4 Version: '" + testversion.getIdentifier() + "'.");
- } catch ( VersionException e){
- System.out.println("Error: " + e);
- }
-
- try {
- testversion = new Version("56.98.0.34.001");
- System.out.println("test4 Version: '" + testversion.getIdentifier() + "'.");
- } catch ( VersionException e){
- System.out.println("Error: " + e);
- }
-
- try {
- testversion = new Version("s6.6y98.0r.0p01");
- System.out.println("test4 Version: '" + testversion.getIdentifier() + "'.");
+ testVersion = ".9.7";
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test initial token missing");
+ System.out.println("Test" + testnum + " versionString='" + testVersion + "':");
+ testversion = new Version(testVersion);
} catch ( VersionException e){
System.out.println("Error: " + e);
System.out.println("-------------------------");
@@ -48,55 +51,369 @@
System.out.println("-------------------------");
e.printStackTrace();
}
+ System.out.println("=========================");
+ // Test expected token missing
try {
- testversion = new Version("6.y98.0r.0p01");
- System.out.println("test4 Version: '" + testversion.getIdentifier() + "'.");
+ testVersion = "5.";
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test expected token missing");
+ System.out.println("Test" + testnum + " versionString='" + testVersion + "':");
+ testversion = new Version(testVersion);
+ System.out.println("Test" + testnum + " Version: '" + testversion.getIdentifier() + "'.");
} catch ( VersionException e){
System.out.println("Error: " + e);
}
+ System.out.println("=========================");
+ // Test exceed max tokens
try {
- testversion = new Version("6.98.0r.0p01");
- System.out.println("test4 Version: '" + testversion.getIdentifier() + "'.");
+ testVersion = "56.98.0.34.001";
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test exceed max tokens");
+ System.out.println("Test" + testnum + " versionString='" + testVersion + "':");
+ testversion = new Version(testVersion);
+ System.out.println("Test" + testnum + " Version: '" + testversion.getIdentifier() + "'.");
} catch ( VersionException e){
System.out.println("Error: " + e);
}
+ System.out.println("=========================");
+ // Test invalid numeric tokens
try {
- testversion = new Version("6.98.0.0p01");
- System.out.println("test4 Version: '" + testversion.getIdentifier() + "'.");
+ testVersion = "s6.6y98.0r.0p01";
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test invalid numeric tokens");
+ System.out.println("Test" + testnum + " versionString='" + testVersion + "':");
+ testversion = new Version(testVersion);
+ System.out.println("Test" + testnum + " Version: '" + testversion.getIdentifier() + "'.");
+ } catch ( VersionException e){
+ System.out.println("Error: " + e);
+ System.out.println("-------------------------");
+ Throwable t=e.getCause();
+ System.out.println("cause: '" + t + "'");
+ t=e.getException();
+ System.out.println("exception: '" + t + "'");
+ System.out.println("-------------------------");
+ e.printStackTrace();
+ }
+ System.out.println("=========================");
+
+ // Test invalid numeric tokens
+ try {
+ testVersion = "6x.698.0.0p01";
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test invalid numeric tokens");
+ System.out.println("Test" + testnum + " versionString='" + testVersion + "':");
+ testversion = new Version(testVersion);
+ System.out.println("Test" + testnum + " Version: '" + testversion.getIdentifier() + "'.");
+ } catch ( VersionException e){
+ System.out.println("Error: " + e);
+ System.out.println("-------------------------");
+ Throwable t=e.getCause();
+ System.out.println("cause: '" + t + "'");
+ t=e.getException();
+ System.out.println("exception: '" + t + "'");
+ System.out.println("-------------------------");
+ e.printStackTrace();
+ }
+ System.out.println("=========================");
+
+ // Test invalid numeric tokens
+ try {
+ testVersion = "7.6x98.0.0p01";
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test invalid numeric tokens");
+ System.out.println("Test" + testnum + " versionString='" + testVersion + "':");
+ testversion = new Version(testVersion);
+ System.out.println("Test" + testnum + " Version: '" + testversion.getIdentifier() + "'.");
+ } catch ( VersionException e){
+ System.out.println("Error: " + e);
+ System.out.println("-------------------------");
+ Throwable t=e.getCause();
+ System.out.println("cause: '" + t + "'");
+ t=e.getException();
+ System.out.println("exception: '" + t + "'");
+ System.out.println("-------------------------");
+ e.printStackTrace();
+ }
+ System.out.println("=========================");
+
+ // Test invalid numeric tokens
+ try {
+ testVersion = "8.0698.0x00.0p01";
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test invalid numeric tokens");
+ System.out.println("Test" + testnum + " versionString='" + testVersion + "':");
+ testversion = new Version(testVersion);
+ System.out.println("Test" + testnum + " Version: '" + testversion.getIdentifier() + "'.");
+ } catch ( VersionException e){
+ System.out.println("Error: " + e);
+ System.out.println("-------------------------");
+ Throwable t=e.getCause();
+ System.out.println("cause: '" + t + "'");
+ t=e.getException();
+ System.out.println("exception: '" + t + "'");
+ System.out.println("-------------------------");
+ e.printStackTrace();
+ }
+ System.out.println("=========================");
+
+ // Test space as version
+ try {
+ testVersion = " ";
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test space as version");
+ System.out.println("Test" + testnum + " versionString='" + testVersion + "':");
+ testversion = new Version(testVersion);
+ System.out.println("Test" + testnum + " Version: '" + testversion.getIdentifier() + "'.");
} catch ( VersionException e){
System.out.println("Error: " + e);
}
+ System.out.println("=========================");
+ // Test space in version (failure)
try {
- testversion = new Version("0.0.350");
- System.out.println("test Version : '" + testversion.getIdentifier() + "'.");
+ testVersion = "3. 3.0 ";
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test space as version");
+ System.out.println("Test" + testnum + " versionString='" + testVersion + "':");
+ testversion = new Version(testVersion);
+ System.out.println("Test" + testnum + " Version: '" + testversion.getIdentifier() + "'.");
} catch ( VersionException e){
System.out.println("Error: " + e);
}
+ System.out.println("=========================");
+ System.out.println("Constructor Testing: *** Expected Success testing...");
+ // Test initial and trailing spaces in version
try {
- testversion = new Version("1.16.4");
- System.out.println("test2 Version: '" + testversion.getIdentifier() + "'.");
+ testVersion = " 1.1.3 ";
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test initial and trailing spaces in version");
+ System.out.println("Test" + testnum + " versionString='" + testVersion + "':");
+ testversion = new Version(testVersion);
+ System.out.println("Test" + testnum + " Version: '" + testversion.getIdentifier() + "'.");
} catch ( VersionException e){
System.out.println("Error: " + e);
}
+ System.out.println("=========================");
+ // Test initial and trailing tabs in version
try {
- testversion = new Version("3.00");
- System.out.println("test4 Version: '" + testversion.getIdentifier() + "'.");
+ testVersion = " 1.1.3 ";
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test initial and trailing tabs in version");
+ System.out.println("Test" + testnum + " versionString='" + testVersion + "':");
+ testversion = new Version(testVersion);
+ System.out.println("Test" + testnum + " Version: '" + testversion.getIdentifier() + "'.");
} catch ( VersionException e){
System.out.println("Error: " + e);
}
+ System.out.println("=========================");
+ // Test mixed initial and trailing tabs and spaces in version
try {
- testversion = new Version("90.828.04.HooYah");
- System.out.println("test3 Version: '" + testversion.getIdentifier() + "'.");
+ testVersion = " 1.1.3 ";
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test mixed initial and trailing tabs and spaces in version");
+ System.out.println("Test" + testnum + " versionString='" + testVersion + "':");
+ testversion = new Version(testVersion);
+ System.out.println("Test" + testnum + " Version: '" + testversion.getIdentifier() + "'.");
} catch ( VersionException e){
System.out.println("Error: " + e);
}
+ System.out.println("=========================");
+
+ // Test Micro as double 0 and fourth token as string ok
+ try {
+ testVersion = "6.98.00.0p01";
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test Micro as double 0 and fourth token as string ok");
+ System.out.println("Test" + testnum + " versionString='" + testVersion + "':");
+ testversion = new Version(testVersion);
+ System.out.println("Test" + testnum + " Version: '" + testversion.getIdentifier() + "'.");
+ } catch ( VersionException e){
+ System.out.println("Error: " + e);
+ }
+ System.out.println("=========================");
+
+ // Test whole number version
+ try {
+ testVersion = "2";
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test whole number version");
+ System.out.println("Test" + testnum + " versionString='" + testVersion + "':");
+ testversion = new Version(testVersion);
+ System.out.println("Test" + testnum + " Version: '" + testversion.getIdentifier() + "'.");
+ } catch ( VersionException e){
+ System.out.println("Error: " + e);
+ }
+ System.out.println("=========================");
+
+ // Test 'normal' version
+ try {
+ testVersion = "1.16.4";
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test 'normal' version");
+ System.out.println("Test" + testnum + " versionString='" + testVersion + "':");
+ testversion = new Version(testVersion);
+ System.out.println("Test" + testnum + " Version: '" + testversion.getIdentifier() + "'.");
+ } catch ( VersionException e){
+ System.out.println("Error: " + e);
+ }
+ System.out.println("=========================");
+
+ // Test initial 0 in Major and Minor version
+ try {
+ testVersion = "0.0.350";
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test initial 0 in Major and Minor version");
+ System.out.println("Test" + testnum + " versionString='" + testVersion + "':");
+ testversion = new Version(testVersion);
+ System.out.println("Test" + testnum + " Version: '" + testversion.getIdentifier() + "'.");
+ } catch ( VersionException e){
+ System.out.println("Error: " + e);
+ }
+ System.out.println("=========================");
+
+ // Test 00 in Minor and no micro version
+ try {
+ testVersion = "3.00";
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test 00 in Minor and no micro version");
+ System.out.println("Test" + testnum + " versionString='" + testVersion + "':");
+ testversion = new Version(testVersion);
+ System.out.println("Test" + testnum + " Version: '" + testversion.getIdentifier() + "'.");
+ } catch ( VersionException e){
+ System.out.println("Error: " + e);
+ }
+ System.out.println("=========================");
+
+ // Test leading 0s in version
+ try {
+ testVersion = "090.0828.04.HooYah";
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test leading 0s in version");
+ System.out.println("Test" + testnum + " versionString='" + testVersion + "':");
+ testversion = new Version(testVersion);
+ System.out.println("Test" + testnum + " Version: '" + testversion.getIdentifier() + "'.");
+ } catch ( VersionException e){
+ System.out.println("Error: " + e);
+ }
+ System.out.println("=========================");
+
+ // Test 0 in Minor and decimal digit retention in micro version
+ try {
+ testVersion = "2.0.100.v201202140850";
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test 0 in Minor and decimal digit retention in micro version");
+ System.out.println("Test" + testnum + " versionString='" + testVersion + "':");
+ testversion = new Version(testVersion);
+ System.out.println("Test" + testnum + " Version: '" + testversion.getIdentifier() + "'.");
+ } catch ( VersionException e){
+ System.out.println("Error: " + e);
+ }
+ System.out.println("=========================");
+
+ System.out.println("Equivilency Testing: *** Expected Success testing...");
+ // Setup
+ try {
+ testVersion = "2.0.100.v201202140850";
+ String testVersion2 = "2.0.4.v201110091424";
+ testversion = new Version(testVersion);
+ testversion2 = new Version(testVersion2);
+ } catch ( VersionException e){
+ System.out.println("Error: " + e);
+ }
+ // Test lt
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test lt with objects");
+ System.out.println("Test" + testnum + " versionObject(" + testversion.getIdentifier() + ") < versionObject(" + testversion2.getIdentifier() + ")");
+ if( testversion.lt(testversion2) )
+ System.out.println(" True.");
+ else
+ System.out.println(" False.");
+ System.out.println(" versionObject(" + testversion2.getIdentifier() + ") < versionObject(" + testversion.getIdentifier() + ")");
+ if( testversion2.lt(testversion) )
+ System.out.println(" True.");
+ else
+ System.out.println(" False.");
+ System.out.println("=========================");
+ // Test le
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test le with objects");
+ System.out.println("Test" + testnum + " versionObject(" + testversion.getIdentifier() + ") <= versionObject(" + testversion2.getIdentifier() + ")");
+ if( testversion.le(testversion2) )
+ System.out.println(" True.");
+ else
+ System.out.println(" False.");
+ System.out.println(" versionObject(" + testversion2.getIdentifier() + ") <= versionObject(" + testversion.getIdentifier() + ")");
+ if( testversion2.le(testversion) )
+ System.out.println(" True.");
+ else
+ System.out.println(" False.");
+ System.out.println("=========================");
+ // Test gt
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test gt with objects");
+ System.out.println("Test" + testnum + " versionObject(" + testversion.getIdentifier() + ") > versionObject(" + testversion2.getIdentifier() + ")");
+ if( testversion.gt(testversion2) )
+ System.out.println(" True.");
+ else
+ System.out.println(" False.");
+ System.out.println(" versionObject(" + testversion2.getIdentifier() + ") > versionObject(" + testversion.getIdentifier() + ")");
+ if( testversion2.gt(testversion) )
+ System.out.println(" True.");
+ else
+ System.out.println(" False.");
+ System.out.println("=========================");
+ // Test ge
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test ge with objects");
+ System.out.println("Test" + testnum + " versionObject(" + testversion.getIdentifier() + ") >= versionObject(" + testversion2.getIdentifier() + ")");
+ if( testversion.ge(testversion2) )
+ System.out.println(" True.");
+ else
+ System.out.println(" False.");
+ System.out.println(" versionObject(" + testversion2.getIdentifier() + ") >= versionObject(" + testversion.getIdentifier() + ")");
+ if( testversion2.ge(testversion) )
+ System.out.println(" True.");
+ else
+ System.out.println(" False.");
+ System.out.println("=========================");
+ // Test eq
+ testnum+=1;
+ System.out.println("=========================");
+ System.out.println("= Test eq with objects");
+ System.out.println("Test" + testnum + " versionObject(" + testversion.getIdentifier() + ") < versionObject(" + testversion2.getIdentifier() + ")");
+ if( testversion.eq(testversion2) )
+ System.out.println(" True.");
+ else
+ System.out.println(" False.");
+ System.out.println("=========================");
+
}
-
}
diff --git a/ant_customizations/src/org/eclipse/persistence/buildtools/helper/Version.java b/ant_customizations/src/org/eclipse/persistence/buildtools/helper/Version.java
index 800b10b..ed3da71 100644
--- a/ant_customizations/src/org/eclipse/persistence/buildtools/helper/Version.java
+++ b/ant_customizations/src/org/eclipse/persistence/buildtools/helper/Version.java
@@ -36,12 +36,19 @@
String validated=identifier;
boolean error=false;
+ // clear leading whitespace
+ while ( validated.startsWith(" ") || validated.startsWith("\t") )
+ validated=validated.substring(1);
+ // clear trailing whitespace
+ while ( validated.endsWith(" ") || validated.endsWith("\t") )
+ validated=validated.substring(0,validated.length() - 1);
+
if ( validated.startsWith(".") ) {
- throw new VersionException("Initial '.' invalids version");
+ throw new VersionException("Initial version tokenizer found (.): Invalid version string '" + validated + "'.");
}
else {
if( validated.endsWith(".") ) {
- throw new VersionException("Terminating '.' invalids version");
+ throw new VersionException("Terminating version tokenizer found (.): Invalid version string '" + validated + "'.");
}
else {
int index = 0;
@@ -50,7 +57,7 @@
int maxindex = validated.lastIndexOf(".");
while( !error && ( (subindex = validated.substring(index).indexOf(".")) >0 || index<maxindex )) {
if(count>2 && subindex>0)
- throw new VersionException("Maximum tokens (4) exceeded.");
+ throw new VersionException("Maximum (4) tokens exceeded: Invalid version string '" + validated + "'.");
else {
index += subindex;
indexList[count] = index;
@@ -99,7 +106,7 @@
setMajor(Integer.valueOf(identifier));
}
} catch ( NumberFormatException e){
- throw new VersionException("A numeric version token is invalid. " + e.getMessage() + " in \"" + identifier + "\".", e);
+ throw new VersionException("Major.Minor.Micro tokens expected to be numeric. One or more is invalid. " + e.getMessage() + " in \"" + identifier + "\".", e);
}
String validIdentifier = getMajorStr() + "." + getMinorStr() + "." + getMicroStr();
if(getQualifier() != null && getQualifier() != "" ) {
@@ -151,15 +158,27 @@
public boolean gt( Version comp ) {
boolean result=false;
- if(this.identifier.compareTo(comp.getIdentifier()) > 0) {
- result = true;
- }
+ if(this.major > comp.getMajorInt()) result = true;
+ else if ( (this.major == comp.getMajorInt()) && (this.minor > comp.getMinorInt()) ) result = true;
+ else if ( (this.major == comp.getMajorInt()) && (this.minor == comp.getMinorInt()) && (this.micro > comp.getMicroInt()) ) result=true;
+ else if ( (this.major == comp.getMajorInt()) && (this.minor == comp.getMinorInt()) && (this.micro == comp.getMicroInt()) && (this.qualifier.compareTo(comp.getQualifier()) > 0) ) result=true;
+
return result;
}
public boolean lt( Version comp ) {
boolean result=false;
- if(this.identifier.compareTo(comp.getIdentifier()) < 0) {
+ if(this.major < comp.getMajorInt()) result = true;
+ else if ( (this.major == comp.getMajorInt()) && (this.minor < comp.getMinorInt()) ) result = true;
+ else if ( (this.major == comp.getMajorInt()) && (this.minor == comp.getMinorInt()) && (this.micro < comp.getMicroInt()) ) result=true;
+ else if ( (this.major == comp.getMajorInt()) && (this.minor == comp.getMinorInt()) && (this.micro == comp.getMicroInt()) && (this.qualifier.compareTo(comp.getQualifier()) < 0) ) result=true;
+
+ return result;
+ }
+ public boolean eq( Version comp ) {
+ boolean result=false;
+
+ if( (this.major == comp.getMajorInt()) && (this.minor == comp.getMinorInt()) && (this.micro == comp.getMicroInt()) && (this.qualifier.compareTo(comp.getQualifier()) == 0) ) {
result = true;
}
return result;
@@ -167,67 +186,64 @@
public boolean ge( Version comp ) {
boolean result=false;
- if(this.identifier.compareTo(comp.getIdentifier()) >= 0) {
- result = true;
- }
+ if( (this.gt(comp) || this.eq(comp) ) ) result = true;
return result;
}
public boolean le( Version comp ) {
boolean result=false;
- if(this.identifier.compareTo(comp.getIdentifier()) <= 0) {
- result = true;
- }
+ if( (this.lt(comp) || this.eq(comp) ) ) result = true;
return result;
}
- public boolean eq( Version comp ) {
+
+ public boolean empty() {
boolean result=false;
- if(this.identifier.equals(comp.getIdentifier())) {
+ if( (this.major == 0) && (this.minor == 0) && (this.micro == 0) && (this.qualifier.compareTo("") == 0) ) {
result = true;
}
return result;
}
// Compare version strings
- public boolean gt( String comp ) {
- boolean result=false;
-
- if(this.identifier.compareTo(comp) > 0) {
- result = true;
- }
- return result;
- }
- public boolean lt( String comp ) {
- boolean result=false;
-
- if(this.identifier.compareTo(comp) < 0) {
- result = true;
- }
- return result;
- }
- public boolean ge( String comp ) {
- boolean result=false;
-
- if(this.identifier.compareTo(comp) >= 0) {
- result = true;
- }
- return result;
- }
- public boolean le( String comp ) {
- boolean result=false;
-
- if(this.identifier.compareTo(comp) <= 0) {
- result = true;
- }
- return result;
- }
- public boolean eq( String comp ) {
- boolean result=false;
-
- if(this.identifier.equals(comp)) {
- result = true;
- }
- return result;
- }
+ //public boolean gt( String comp ) {
+ // boolean result=false;
+ //
+ // if(this.identifier.compareTo(comp) > 0) {
+ // result = true;
+ // }
+ // return result;
+ //}
+ //public boolean lt( String comp ) {
+ // boolean result=false;
+ //
+ // if(this.identifier.compareTo(comp) < 0) {
+ // result = true;
+ // }
+ // return result;
+ //}
+ //public boolean ge( String comp ) {
+ // boolean result=false;
+ //
+ // if(this.identifier.compareTo(comp) >= 0) {
+ // result = true;
+ // }
+ // return result;
+ //}
+ //public boolean le( String comp ) {
+ // boolean result=false;
+ //
+ // if(this.identifier.compareTo(comp) <= 0) {
+ // result = true;
+ // }
+ // return result;
+ //}
+ //public boolean eq( String comp ) {
+ // boolean result=false;
+ //
+ // if(this.identifier.equals(comp)) {
+ // result = true;
+ // }
+ // return result;
+ //}
}
diff --git a/ant_customizations/test.xml b/ant_customizations/test.xml
deleted file mode 100644
index 6fa6433..0000000
--- a/ant_customizations/test.xml
+++ /dev/null
@@ -1,112 +0,0 @@
-<project name="test" default="test" basedir=".">
-
- <target name="init">
- <property name="custom.tasks.lib" value="../ant_customizations.jar"/>
- <property name="custom.echo.task.class" value="org.eclipse.persistence.buildtools.ant.taskdefs.Say"/>
- <property name="custom.selectbundle.task.class" value="org.eclipse.persistence.buildtools.ant.taskdefs.SelectBundle"/>
- <property name="custom.cleanrev.task.class" value="org.eclipse.persistence.buildtools.ant.taskdefs.CleanRevision"/>
-
- <echo message="custom.tasks.lib = '${custom.tasks.lib}'"/>
- <available file="../ant_customizations.jar" property="antcustomizations.lib.exist"/>
- <fail message="Ant customizations file not found!" unless="antcustomizations.lib.exist"/>
-
- <taskdef name="say" classname="${custom.echo.task.class}" classpath="${custom.tasks.lib}"/>
- <taskdef name="selectbundle" classname="${custom.selectbundle.task.class}" classpath="${custom.tasks.lib}"/>
- <taskdef name="cleanRevision" classname="${custom.cleanrev.task.class}" classpath="${custom.tasks.lib}"/>
- </target>
-
- <target name="test" depends="init">
- <say message="Whoo Hoo! First test is passed!" if="antcustomizations.lib.exist"/>
-
- <property name="bnd.search.dir" value="C:/__external.lib"/>
- <property name="bnd.prefix" value="bnd"/>
- <property name="bnd.separator" value="-"/>
- <property name="bnd.criteria" value="[0.0.350,0.1.0)"/>
- <property name="bnd.property" value="selected.bnd.jar"/>
-
- <property name="plugin.dir" value="C:/_EL_trunk5/plugins"/>
- <property name="bind.prefix" value="javax.xml.bind"/>
- <property name="bind.criteria" value="[2.0,3.0)"/>
- <property name="bind.property" value="selected.bind.jar"/>
- <property name="ant.prefix" value="org.apache.ant"/>
- <property name="ant.criteria" value="[1.7,1.8)"/>
- <property name="ant.property" value="selected.ant.jar"/>
-
- <selectbundle
- criterion="${bnd.criteria}"
- basename="${bnd.prefix}"
- directory="${bnd.search.dir}"
- property="${bnd.property}"
- separator="${bnd.separator}"
- />
- <selectbundle
- criterion="${bnd.criteria}"
- basename="${bnd.prefix}"
- directory=".."
- property="${bnd.property}"
- separator="${bnd.separator}"
- />
- <say message="selected file: '${selected.bnd.jar}'" if="${bnd.property}"/>
- <say message="Bnd (${bnd.prefix}) bundle not found in '${bnd.search.dir}'!" unless="${bnd.property}"/>
-
- <selectbundle
- includepath="true"
- criterion="${bnd.criteria}"
- basename="${bnd.prefix}"
- directory="${bnd.search.dir}"
- property="selected.bndtool.lib"
- separator="${bnd.separator}"
- />
- <say message="selected file: '${selected.bndtool.lib}'" if="selected.bndtool.lib"/>
- <say message="Bnd (${bnd.prefix}) bundle not found in '${bnd.search.dir}'!" unless="selected.bndtool.lib"/>
-
- <selectbundle
- criterion="${bind.criteria}"
- basename="${bind.prefix}"
- directory="${plugin.dir}"
- property="${bind.property}"
- />
- <say message="selected file: '${selected.bind.jar}'" if="selected.bind.jar"/>
- <say message="Javax.xml.bind (${bind.prefix}) bundle not found in '${plugin.dir}'!" unless="selected.bind.jar"/>
-
- <selectbundle
- criterion="${ant.criteria}"
- basename="${ant.prefix}"
- directory="${plugin.dir}"
- property="${ant.property}"
- suffix="zip"
- />
- <say message="selected file: '${selected.ant.jar}'" if="selected.ant.jar"/>
- <say message="Ant (${ant.prefix}) bundle not found in '${plugin.dir}'!" unless="selected.ant.jar"/>
- </target>
-
- <target name="test2" depends="init">
- <property name="svn.exec" value="svn"/>
- <property name="branch.name" value=""/>
- <property name="branch.dir" value="${branch.name}trunk"/>
- <property name="svn.r.protocol" value="http:"/>
- <property name="svn.rw.protocol" value="svn+ssh:"/>
- <property name="osvn.server.name" value="egwin@eldev"/>
- <property name="svn.server.name" value="dev.eclipse.org"/>
- <property name="svn.base.urlpath" value="//${svn.server.name}/svnroot/rt/org.eclipse.persistence"/>
- <property name="svn.base.url" value="${svn.r.protocol}${svn.base.urlpath}"/>
- <property name="svn.branch.url" value="${svn.base.url}/${branch.dir}"/>
-
- <exec outputproperty="svn.revision"
- failonerror="false"
- failifexecutionfails="false"
- errorproperty="svnversion.failed"
- logError="true"
- executable="${svn.exec}">
- <arg value="info"/>
- <arg value="--revision"/>
- <arg value="HEAD"/>
- <arg value="${svn.branch.url}"/>
- </exec>
- <say message="SVN log command failed!" if="svnversion.failed"/>
- <say message="b:svn.revision = '${svn.revision}'"/>
- <cleanRevision input="${svn.revision}" property="svn.revision"/>
- <say message="a:svn.revision = '${svn.revision}'"/>
- </target>
-
-</project>
\ No newline at end of file