Move org.spearce.jgit.pgm to its own Java project
[egit/fonseca.git] / make_jgit.sh
blobbcb2df048e5478f601177901d0a9995128e0b7c5
1 #!/bin/sh
3 O=jgit
4 PLUGINS="
5 org.spearce.jgit
6 org.spearce.jgit.pgm
8 JARS="
9 org.spearce.jgit/lib/jsch-0.1.37.jar
10 org.spearce.jgit.pgm/lib/args4j-2.0.9.jar
13 if [ -n "$JAVA_HOME" ]
14 then
15 PATH=$JAVA_HOME/bin:$PATH
18 T=".temp$$.$O"
19 T_MF="$T.MF"
20 R=`pwd`
22 cleanup_bin() {
23 rm -f $T $O+ $T_MF
24 for p in $PLUGINS
26 rm -rf $p/bin2
27 done
30 die() {
31 cleanup_bin
32 rm -f $O
33 echo >&2 "$@"
34 exit 1
37 cleanup_bin
38 rm -f $O
40 CLASSPATH=
41 for j in $JARS
43 if [ -z "$CLASSPATH" ]
44 then
45 CLASSPATH="$R/$j"
46 else
47 CLASSPATH="$CLASSPATH:$R/$j"
49 done
50 export CLASSPATH
52 for p in $PLUGINS
54 echo "Entering $p ..."
55 (cd $p/src &&
56 mkdir ../bin2 &&
57 find . -name \*.java -type f |
58 xargs javac \
59 -source 1.5 \
60 -target 1.5 \
61 -g \
62 -d ../bin2) || die "Building $p failed."
63 CLASSPATH="$CLASSPATH:$R/$p/bin2"
64 done
66 echo Manifest-Version: 1.0 >$T_MF &&
67 echo Implementation-Title: jgit >>$T_MF &&
68 echo Implementation-Version: `git describe HEAD` >>$T_MF &&
70 sed s/@@use_self@@/1/ jgit.sh >$O+ &&
71 java org.spearce.jgit.pgm.build.JarLinkUtil \
72 `for p in $JARS ; do printf %s " -include $p" ;done` \
73 `for p in $PLUGINS; do printf %s " -include $p/bin2";done` \
74 -file META-INF/MANIFEST.MF=$T_MF \
75 >>$O+ &&
76 chmod 555 $O+ &&
77 mv $O+ $O &&
78 echo "Created $O." || die "Creating $O failed."
80 cleanup_bin