From: <jpi...@us...> - 2011-11-28 16:23:30
|
Revision: 3703 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3703&view=rev Author: jpilgrim Date: 2011-11-28 16:23:20 +0000 (Mon, 28 Nov 2011) Log Message: ----------- Fixed a bug in the update site build script. Wrong class name of LWJGL plugin activator was specified (org.lwjgl.eclipse.Activator, but correct is org.lwjgl.Activator). Now, the current date/time string is added as a qualifier to the LWJGL version, e.g., org.lwjgl_2.8.2.v20111128-1653 instead of org.lwjgl_2.8.2. This simplifies testing and discouples LWJGL versions from plugin versions. Modified Paths: -------------- trunk/LWJGL/eclipse-update/org.lwjgl.build/.classpath trunk/LWJGL/eclipse-update/org.lwjgl.build/META-INF/MANIFEST.MF trunk/LWJGL/eclipse-update/org.lwjgl.build/build.xml trunk/LWJGL/eclipse-update/org.lwjgl.build/src/java/org/lwjgl/ant/NormalizeVersion.java trunk/LWJGL/eclipse-update/org.lwjgl.build/test/java/org/lwjgl/ant/NormalizeVersionTest.java Modified: trunk/LWJGL/eclipse-update/org.lwjgl.build/.classpath =================================================================== --- trunk/LWJGL/eclipse-update/org.lwjgl.build/.classpath 2011-11-17 21:41:24 UTC (rev 3702) +++ trunk/LWJGL/eclipse-update/org.lwjgl.build/.classpath 2011-11-28 16:23:20 UTC (rev 3703) @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src/java"/> <classpathentry kind="src" path="test/java"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="output" path="anttasks"/> </classpath> Modified: trunk/LWJGL/eclipse-update/org.lwjgl.build/META-INF/MANIFEST.MF =================================================================== --- trunk/LWJGL/eclipse-update/org.lwjgl.build/META-INF/MANIFEST.MF 2011-11-17 21:41:24 UTC (rev 3702) +++ trunk/LWJGL/eclipse-update/org.lwjgl.build/META-INF/MANIFEST.MF 2011-11-28 16:23:20 UTC (rev 3703) @@ -9,5 +9,6 @@ org.apache.tools.ant.types, org.apache.tools.ant.types.selectors, org.apache.tools.ant.util, - org.junit;version="4.8.1" + org.junit;version="4" Bundle-Vendor: Lightweight Java Game Library Project +Require-Bundle: org.junit;bundle-version="4.8.1" Modified: trunk/LWJGL/eclipse-update/org.lwjgl.build/build.xml =================================================================== --- trunk/LWJGL/eclipse-update/org.lwjgl.build/build.xml 2011-11-17 21:41:24 UTC (rev 3702) +++ trunk/LWJGL/eclipse-update/org.lwjgl.build/build.xml 2011-11-28 16:23:20 UTC (rev 3703) @@ -54,7 +54,7 @@ <target name="init"> - <normalizeversion version="${version}" property="normversion" /> + <normalizeversion version="${version}" property="normversion" addDateQualifier="yes" /> <echo>Building plugins for version ${version}, normalized version ${normversion}</echo> </target> @@ -209,7 +209,7 @@ Bundle-SymbolicName: org.lwjgl Bundle-Version: ${normversion} Bundle-Vendor: ${bundle.vendor} -Bundle-Activator: org.lwjgl.eclipse.Activator +Bundle-Activator: org.lwjgl.Activator Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime Bundle-ActivationPolicy: lazy Modified: trunk/LWJGL/eclipse-update/org.lwjgl.build/src/java/org/lwjgl/ant/NormalizeVersion.java =================================================================== --- trunk/LWJGL/eclipse-update/org.lwjgl.build/src/java/org/lwjgl/ant/NormalizeVersion.java 2011-11-17 21:41:24 UTC (rev 3702) +++ trunk/LWJGL/eclipse-update/org.lwjgl.build/src/java/org/lwjgl/ant/NormalizeVersion.java 2011-11-28 16:23:20 UTC (rev 3703) @@ -11,6 +11,9 @@ ******************************************************************************/ package org.lwjgl.ant; +import java.text.SimpleDateFormat; +import java.util.Date; + import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Task; @@ -24,7 +27,11 @@ */ public class NormalizeVersion extends Task { - + public final static String SEGMENTS[] = { "major", "minor", "service", + "qualifier" }; + + public final static String VERSION_QUALIFIER_PATTERN = "yyyyMMdd-HHmm"; + /** * name of the property to set */ @@ -32,7 +39,23 @@ protected String version; + protected boolean addDateQualifier = false; + /** + * @return the addQualifier + */ + public boolean isAddDateQualifier() { + return addDateQualifier; + } + + /** + * @param i_addQualifier the addQualifier to set + */ + public void setAddDateQualifier(boolean i_addDateQualifier) { + addDateQualifier = i_addDateQualifier; + } + + /** * @return the property */ public String getProperty() { @@ -57,7 +80,7 @@ * @param i_versionNumber the versionNumber to set */ public void setVersion(String version) { - this.version =version; + this.version = version; } /** @@ -72,6 +95,30 @@ if (version == null) { throw new BuildException("attribute version missing"); } + String s = getVersion().trim(); + int sn = 0; + boolean qualifier = false; + for (int i = 0; i < s.length(); i++) { + if (s.charAt(i) == '.') { + sn++; + } else { + + qualifier = !Character.isDigit(s.charAt(i)); + if (sn < 1 && !Character.isDigit(s.charAt(i))) { + + throw new BuildException( + "Wrong version format, must contain only digits in the " + + SEGMENTS[sn] + " segment, was " + + s.substring(0, i) + ">>" + s.charAt(i) + + "<<" + s.substring(i + 1)); + + } + } + } + if ((sn > 2 || qualifier) && isAddDateQualifier()) { + throw new BuildException( + "Cannot add date qualifier, qualifier already specified"); + } } /** @@ -147,11 +194,11 @@ } n.append(c); } - } + if (!qualifier) { - if (digits.length()>0) { + if (digits.length() > 0) { if (snIndex > 0) n.append('.'); n.append(digits); @@ -166,8 +213,25 @@ case 2: // e.g. "1.2.beta n.append(".0"); } + if (isAddDateQualifier()) + n.append(createDateQualifier()); + } else { + if (isAddDateQualifier()) { + throw new BuildException( + "Cannot add date qualifier, qualifier already specified"); + } } + return n.toString(); } + /** + * @return + */ + private String createDateQualifier() { + return ".v" + + new SimpleDateFormat(VERSION_QUALIFIER_PATTERN) + .format(new Date()); + } + } Modified: trunk/LWJGL/eclipse-update/org.lwjgl.build/test/java/org/lwjgl/ant/NormalizeVersionTest.java =================================================================== --- trunk/LWJGL/eclipse-update/org.lwjgl.build/test/java/org/lwjgl/ant/NormalizeVersionTest.java 2011-11-17 21:41:24 UTC (rev 3702) +++ trunk/LWJGL/eclipse-update/org.lwjgl.build/test/java/org/lwjgl/ant/NormalizeVersionTest.java 2011-11-28 16:23:20 UTC (rev 3703) @@ -67,5 +67,42 @@ } + @Test + public void testQualifier() { + NormalizeVersion t = new NormalizeVersion(); + t.setProperty("normalized"); + t.setAddDateQualifier(true); + + t.setVersion("1"); + String s = t.doExecute(); + Assert.assertEquals(20, s.length()); + Assert.assertTrue(s.startsWith("1.0.0")); + + t.setVersion("1.2"); + s = t.doExecute(); + Assert.assertEquals(20, s.length()); + Assert.assertTrue(s.startsWith("1.2.0")); + + t.setVersion("1.2.3"); + s = t.doExecute(); + Assert.assertEquals(20, s.length()); + Assert.assertTrue(s.startsWith("1.2.3")); + + t.setVersion("2.8.2"); + s = t.doExecute(); + Assert.assertEquals(20, s.length()); + Assert.assertTrue(s.startsWith("2.8.2")); + } + + @Test(expected= BuildException.class) public void dateQualifierWithQualifier() { + NormalizeVersion t = new NormalizeVersion(); + t.setProperty("normalized"); + t.setAddDateQualifier(true); + t.setVersion("1.2.beta"); + t.doExecute(); + } + + + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |