Add version information that hudson will update.

This commit is contained in:
endolf 2009-12-12 13:29:01 +00:00
parent 530a7eaf94
commit 32829e5df6
4 changed files with 49 additions and 8 deletions

View file

@ -57,6 +57,12 @@
</antcall> </antcall>
</target> </target>
<target name="versiontest" depends="init,all" description="Try running it.">
<antcall target="runtest">
<param name="mainclass" value="net.java.games.input.test.VersionTest"/>
</antcall>
</target>
<macrodef name="iterate"> <macrodef name="iterate">
<attribute name="target"/> <attribute name="target"/>
<sequential> <sequential>

View file

@ -11,11 +11,22 @@
<target name="compile" depends="init"> <target name="compile" depends="init">
<javac srcdir="src/java" destdir="classes" debug="true" deprecation="true" source="1.4" target="1.4"> <javac srcdir="src/java" destdir="classes" debug="true" deprecation="true" source="1.4" target="1.4">
<include name="net/**"/> <include name="net/**"/>
<exclude name="**/Version.java"/>
<!-- To add something to the classpath: --> <!-- To add something to the classpath: -->
<classpath> <classpath>
<pathelement location="${utils}"/> <pathelement location="${utils}"/>
</classpath> </classpath>
</javac> </javac>
<buildnumber/>
<copy file="src/java/net/java/games/input/Version.java"
todir="build/src/java/net/java/games/input/" overwrite="true">
<filterset>
<filter token="BUILD_NUMBER" value="${build.number}"/>
</filterset>
</copy>
<javac srcdir="build/src/java" destdir="classes" debug="true" deprecation="true" source="1.4" target="1.4">
<include name="net/**" />
</javac>
</target> </target>
<target name="jar" depends="init,compile"> <target name="jar" depends="init,compile">

View file

@ -89,7 +89,13 @@ public final class Version {
/** /**
* Version string of this build. * Version string of this build.
*/ */
private static final String version = "2.0.0-b01"; private static final String apiVersion = "2.0.1";
private static final String buildNumber = "@BUILD_NUMBER@";
/*
* Split so that ant does not replace the token;
*/
private static final String antToken = "@BUILD_" + "NUMBER@";
/** /**
* Returns the verison string and build number of * Returns the verison string and build number of
@ -99,6 +105,10 @@ public final class Version {
* @return The version string of this implementation. * @return The version string of this implementation.
*/ */
public static String getVersion() { public static String getVersion() {
String version = apiVersion;
if(!antToken.equals(buildNumber)) {
version += "-b" + buildNumber;
}
return version; return version;
} }
} }

View file

@ -0,0 +1,14 @@
package net.java.games.input.test;
import net.java.games.input.Version;
public class VersionTest {
/**
* @param args
*/
public static void main(String[] args) {
System.out.println("JInput version: " + Version.getVersion());
}
}