chiark / gitweb /
add "-local" to version string when tree is locally modified
[jarrg-ian.git] / build-sh
1 #!/bin/bash
2 #
3 # We don't supply a Makefile.  Instead, we just supply this shell script.
4
5 set -e
6
7 case "$#.$1" in
8 0.)     ;;
9 *.-*)   echo >&2 'no options allowed'; exit 1;;
10 *)      echo >&2 'no arguments allowed'; exit 1;;
11 esac
12
13 : ${JAVA_HOME:=/usr/lib/jvm/java-6-sun}
14 export JAVA_HOME
15
16 revision=`git describe --always || echo '(unknown revision)'`
17 if [ x"`git diff 2>/dev/null || echo x`" != x ]; then
18         revision="$revision-local"
19 fi
20
21 cat >src/com/tedpearson/ypp/market/Version.java <<END
22   package com.tedpearson.ypp.market;
23   public class Version {
24       public final static String version = "$revision";
25   }
26 END
27 rm -f src/build/com/tedpearson/ypp/market/Version.class
28 rm -f src/build/com/tedpearson/ypp/market/ControlPanel.class
29 rm -f *.jar
30
31 cd src
32 ant -f PCTB.xml
33 cd ..
34
35 echo "
36 Building tarball
37 "
38
39 GZIP='-9v --rsyncable' tar --exclude=\*{~,.tar.gz,.exe} --exclude='#*#' \
40   --transform='s/^./jpctb/' --exclude=jpctb/{src/build,tmp} \
41   -zcf jpctb.tar.gz .
42
43 files='jpctb.tar.gz jpctb-setup.exe'
44
45 echo "
46 Generated OK:
47 "
48 ls -al $files
49
50 pubbase="${JPCTB_PUBLISH_BASE-login.chiark.greenend.org.uk}"
51 pubdir="${JPCTB_PUBLISH_DIR-/home/yarrgweb/public-html/download/jpctb}"
52
53 echo "
54 Install with:
55  RSYNC_RSH=ssh rsync -vP $files $pubbase:$pubdir/test/
56 "