edge releases now include the release timestamp in the ‘full version’ name.

This commit is contained in:
Reinier Zwitserloot committed 2014-05-30 03:00:36 +02:00
1 parent 912b96c1e5
commit 48c93ecc30
2 files changed
+41 -1

No files matched your search

+6
View File
@@ -205,6 +205,10 @@ the common tasks and can be called on to run the main aspects of all the sub-scr
<target name="dist" description="Builds THE lombok.jar file which contains everything." depends="version, compile">
<mkdir dir="dist" />
<copy file="doc/changelog.markdown" tofile="build/changelog.txt" />
<tstamp>
<format property="releaseTimestamp" pattern="yyyy-MM-dd" />
</tstamp>
<echo file="release-timestamp.txt">$releaseTimestamp</echo>
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="lib/build/com.googlecode.jarjar-jarjar.jar" />
<jarjar destfile="dist/lombok-${lombok.version}.jar">
<fileset dir="build/lombok">
@@ -213,6 +217,7 @@ the common tasks and can be called on to run the main aspects of all the sub-scr
<fileset dir="build" includes="changelog.txt" />
<fileset dir="." includes="LICENSE" />
<fileset dir="." includes="AUTHORS" />
<fileset dir="." includes="release-timestamp.txt" />
<rule pattern="com.zwitserloot.cmdreader.**" result="lombok.libs.com.zwitserloot.cmdreader.@1" />
<rule pattern="org.objectweb.asm.**" result="lombok.libs.org.objectweb.asm.@1" />
<manifest>
@@ -223,6 +228,7 @@ the common tasks and can be called on to run the main aspects of all the sub-scr
<attribute name="Lombok-Version" value="${lombok.version}" />
</manifest>
</jarjar>
<delete file="release-timestamp.txt" />
<copy file="dist/lombok-${lombok.version}.jar" tofile="dist/lombok.jar" />
<property name="lombok.dist.built" value="true" />
</target>
+35 -1
View File
@@ -21,6 +21,8 @@
*/
package lombok.core;
import java.io.InputStream;
/**
* This class just holds lombok's current version.
*/
@@ -66,6 +68,38 @@ public class Version {
}
public static String getFullVersion() {
return String.format("v%s \"%s\"", VERSION, RELEASE_NAME);
String version = String.format("v%s \"%s\"", VERSION, RELEASE_NAME);
if (!isEdgeRelease()) return version;
InputStream in = Version.class.getResourceAsStream("release-timestamp.txt");
if (in == null) return version;
try {
byte[] data = new byte[65536];
int p = 0;
while (p < data.length) {
int r = in.read(data, p, data.length - p);
if (r == -1) break;
p += r;
}
String timestamp = new String(data, "UTF-8").trim();
return version + " - " + timestamp;
} catch (Exception e) {
try {
in.close();
} catch (Exception ignore) {}
}
return version;
}
public static boolean isEdgeRelease() {
int lastIdx = VERSION.lastIndexOf('.');
if (lastIdx == -1) return false;
try {
return Integer.parseInt(VERSION.substring(lastIdx + 1)) % 1 == 1;
} catch (Exception e) {
return false;
}
}
}