Move AWT UI code to new org.eclipse.jgit.ui bundle
[jgit.git] / make_jgit.sh
blobf7363f9f4b911e8c3c015a0543733db99140603c
1 #!/bin/sh
2 # Copyright (C) 2009, Christian Halstrick <christian.halstrick@sap.com>
3 # Copyright (C) 2008-2009, Google Inc.
4 # Copyright (C) 2009, Johannes Schindelin <Johannes.Schindelin@gmx.de>
5 # Copyright (C) 2008, Mike Ralphson <mike@abacus.co.uk>
6 # Copyright (C) 2009, Mykola Nikishov <mn@mn.com.ua>
7 # Copyright (C) 2009, Nicholas Campbell <nicholas.j.campbell@gmail.com>
8 # Copyright (C) 2009, Robin Rosenberg <robin.rosenberg@gmail.com>
9 # Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
10 # and other copyright owners as documented in the project's IP log.
12 # This program and the accompanying materials are made available
13 # under the terms of the Eclipse Distribution License v1.0 which
14 # accompanies this distribution, is reproduced below, and is
15 # available at http://www.eclipse.org/org/documents/edl-v10.php
17 # All rights reserved.
19 # Redistribution and use in source and binary forms, with or
20 # without modification, are permitted provided that the following
21 # conditions are met:
23 # - Redistributions of source code must retain the above copyright
24 # notice, this list of conditions and the following disclaimer.
26 # - Redistributions in binary form must reproduce the above
27 # copyright notice, this list of conditions and the following
28 # disclaimer in the documentation and/or other materials provided
29 # with the distribution.
31 # - Neither the name of the Eclipse Foundation, Inc. nor the
32 # names of its contributors may be used to endorse or promote
33 # products derived from this software without specific prior
34 # written permission.
36 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
37 # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
38 # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
39 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
40 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
41 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
42 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
43 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
44 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
45 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
46 # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
47 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
48 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51 O_CLI=jgit
52 O_JAR=jgit.jar
53 O_SRC=jgit_src.zip
54 O_DOC=jgit_docs.zip
56 PLUGINS="
57 org.eclipse.jgit
58 org.eclipse.jgit.ui
59 org.eclipse.jgit.pgm
61 JARS="
62 org.eclipse.jgit/lib/jsch-0.1.37.jar
63 org.eclipse.jgit.pgm/lib/args4j-2.0.9.jar
66 PSEP=":"
67 T=".temp$$.$O_CLI"
68 T_MF="$T.MF"
69 R=`pwd`
70 if [ "$OSTYPE" = "cygwin" ]
71 then
72 R=`cygpath -m $R`
73 PSEP=";"
75 if [ "$MSYSTEM" = "MINGW" -o "$MSYSTEM" = "MINGW32" ]
76 then
77 PSEP=";"
78 R=`pwd -W`
81 if [ -n "$JAVA_HOME" ]
82 then
83 PATH=${JAVA_HOME}/bin${PSEP}${PATH}
86 cleanup_bin() {
87 rm -f $T $O_CLI+ $O_JAR+ $O_SRC+ $T_MF
88 for p in $PLUGINS
90 rm -rf $p/bin2
91 done
92 rm -rf docs
95 die() {
96 cleanup_bin
97 rm -f $O_CLI $O_JAR $O_SRC
98 echo >&2 "$@"
99 exit 1
102 cleanup_bin
103 rm -f $O_CLI $O_JAR $O_SRC $O_DOC
105 VN=`git describe --abbrev=4 HEAD 2>/dev/null`
106 git update-index -q --refresh
107 if [ -n "`git diff-index --name-only HEAD --`" ]
108 then
109 VN="$VN-dirty"
111 VN=${VN:-untagged}`echo "$VN" | sed -e s/-/./g`
113 CLASSPATH=
114 for j in $JARS
116 if [ -z "$CLASSPATH" ]
117 then
118 CLASSPATH="$R/$j"
119 else
120 CLASSPATH="${CLASSPATH}${PSEP}$R/$j"
122 done
123 export CLASSPATH
125 for p in $PLUGINS
127 echo "Entering $p ..."
128 (cd $p/src &&
129 mkdir ../bin2 &&
130 find . -name \*.java -type f |
131 xargs javac \
132 -source 1.5 \
133 -target 1.5 \
134 -encoding UTF-8 \
135 -g \
136 -d ../bin2) || die "Building $p failed."
137 CLASSPATH="${CLASSPATH}${PSEP}$R/$p/bin2"
138 done
139 echo
141 echo "Version $VN" &&
142 echo Manifest-Version: 1.0 >$T_MF &&
143 echo Implementation-Title: jgit >>$T_MF &&
144 echo Implementation-Version: $VN >>$T_MF &&
146 java org.eclipse.jgit.pgm.build.JarLinkUtil \
147 -include org.eclipse.jgit/bin2 \
148 -file META-INF/MANIFEST.MF=$T_MF \
149 >$O_JAR+ &&
150 mv $O_JAR+ $O_JAR &&
151 echo "Created $O_JAR." &&
153 java org.eclipse.jgit.pgm.build.JarLinkUtil \
154 -include org.eclipse.jgit/src \
155 -file META-INF/MANIFEST.MF=$T_MF \
156 >$O_SRC+ &&
157 mv $O_SRC+ $O_SRC &&
158 echo "Created $O_SRC." &&
160 M_TB=META-INF/services/org.eclipse.jgit.pgm.TextBuiltin &&
161 sed s/@@use_self@@/1/ jgit.sh >$O_CLI+ &&
162 java org.eclipse.jgit.pgm.build.JarLinkUtil \
163 `for p in $JARS ; do printf %s " -include $p" ;done` \
164 `for p in $PLUGINS; do printf %s " -include $p/bin2";done` \
165 -file $M_TB=org.eclipse.jgit.pgm/src/$M_TB \
166 -file META-INF/MANIFEST.MF=$T_MF \
167 >>$O_CLI+ &&
168 chmod 555 $O_CLI+ &&
169 mv $O_CLI+ $O_CLI &&
170 echo "Created $O_CLI." || die "Build failed."
172 echo "Building Javadocs ..."
173 for p in $PLUGINS; do
174 javadoc -quiet -sourcepath "$p/src/" -d "docs/$p/" \
175 `find "$p/src" -name "*.java"`
176 done
178 (cd docs && jar cf "../$O_DOC" .)
179 echo "Created $O_DOC."
181 cleanup_bin