chiark / gitweb /
Create src/com/tedpearson/ypp/market/Version.java automatically from git revision
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 22 Aug 2010 22:01:41 +0000 (23:01 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 22 Aug 2010 22:01:41 +0000 (23:01 +0100)
.gitignore
build-sh

index e3094d7..a5e35b0 100644 (file)
@@ -8,3 +8,4 @@ PCTB-Uploader.jar
 jpctb-setup.exe
 jpctb.tar.gz
 src/build/
+src/com/tedpearson/ypp/market/Version.java
index d4687dc..1c0a975 100755 (executable)
--- a/build-sh
+++ b/build-sh
@@ -13,6 +13,14 @@ esac
 : ${JAVA_HOME:=/usr/lib/jvm/java-6-sun}
 export JAVA_HOME
 
+revision=`git describe --always || echo '(unknown revision)'`
+cat >src/com/tedpearson/ypp/market/Version.java <<END
+  package com.tedpearson.ypp.market;
+  public class Version {
+      public final static String version = "$revision";
+  }
+END
+
 cd src
 ant -f PCTB.xml
 cd ..
@@ -34,7 +42,6 @@ ls -al $files
 
 pubbase="${JPCTB_PUBLISH_BASE-login.chiark.greenend.org.uk}"
 pubdir="${JPCTB_PUBLISH_DIR-/home/yarrgweb/public-html/download/jpctb}"
-revision=`git describe --always`
 
 echo "
 Install with: