forked from sonatype/JGit
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake_jgit.sh
executable file
·120 lines (105 loc) · 2.18 KB
/
make_jgit.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/sh
O_CLI=jgit
O_JAR=jgit.jar
O_SRC=jgit_src.zip
PLUGINS="
org.spearce.jgit
org.spearce.jgit.pgm
"
JARS="
org.spearce.jgit/lib/jsch-0.1.37.jar
org.spearce.jgit.pgm/lib/args4j-2.0.9.jar
"
PSEP=":"
T=".temp$$.$O_CLI"
T_MF="$T.MF"
R=`pwd`
if [ "$OSTYPE" = "cygwin" ]
then
R=`cygpath -m $R`
PSEP=";"
fi
if [ "$MSYSTEM" = "MINGW" ]
then
PSEP=";"
fi
if [ -n "$JAVA_HOME" ]
then
PATH=${JAVA_HOME}/bin${PSEP}${PATH}
fi
cleanup_bin() {
rm -f $T $O_CLI+ $O_JAR+ $O_SRC+ $T_MF
for p in $PLUGINS
do
rm -rf $p/bin2
done
}
die() {
cleanup_bin
rm -f $O_CLI $O_JAR $O_SRC
echo >&2 "$@"
exit 1
}
cleanup_bin
rm -f $O_CLI $O_JAR $O_SRC
VN=`git describe --abbrev=4 HEAD 2>/dev/null`
git update-index -q --refresh
if [ -n "`git diff-index --name-only HEAD --`" ]
then
VN="$VN-dirty"
fi
VN=`echo "$VN" | sed -e s/-/./g`
CLASSPATH=
for j in $JARS
do
if [ -z "$CLASSPATH" ]
then
CLASSPATH="$R/$j"
else
CLASSPATH="${CLASSPATH}${PSEP}$R/$j"
fi
done
export CLASSPATH
for p in $PLUGINS
do
echo "Entering $p ..."
(cd $p/src &&
mkdir ../bin2 &&
find . -name \*.java -type f |
xargs javac \
-source 1.5 \
-target 1.5 \
-encoding UTF-8 \
-g \
-d ../bin2) || die "Building $p failed."
CLASSPATH="${CLASSPATH}${PSEP}$R/$p/bin2"
done
echo
echo "Version $VN" &&
echo Manifest-Version: 1.0 >$T_MF &&
echo Implementation-Title: jgit >>$T_MF &&
echo Implementation-Version: $VN >>$T_MF &&
java org.spearce.jgit.pgm.build.JarLinkUtil \
-include org.spearce.jgit/bin2 \
-file META-INF/MANIFEST.MF=$T_MF \
>$O_JAR+ &&
mv $O_JAR+ $O_JAR &&
echo "Created $O_JAR." &&
java org.spearce.jgit.pgm.build.JarLinkUtil \
-include org.spearce.jgit/src \
-file META-INF/MANIFEST.MF=$T_MF \
>$O_SRC+ &&
mv $O_SRC+ $O_SRC &&
echo "Created $O_SRC." &&
M_TB=META-INF/services/org.spearce.jgit.pgm.TextBuiltin &&
sed s/@@use_self@@/1/ jgit.sh >$O_CLI+ &&
java org.spearce.jgit.pgm.build.JarLinkUtil \
`for p in $JARS ; do printf %s " -include $p" ;done` \
`for p in $PLUGINS; do printf %s " -include $p/bin2";done` \
-file $M_TB=org.spearce.jgit.pgm/src/$M_TB \
-file META-INF/MANIFEST.MF=$T_MF \
>>$O_CLI+ &&
chmod 555 $O_CLI+ &&
mv $O_CLI+ $O_CLI &&
echo "Created $O_CLI." || die "Build failed."
cleanup_bin