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