From dad52baae835f28c7fc4b8cc184f8f6703433ac4 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sat, 31 Oct 2009 18:07:26 -0700 Subject: [PATCH] Refactor our Maven build to be modular Drop our simple and stupid jgit.sh and instead rely upon Maven for the command line based build. Maven is relatively simple to download and install, and doesn't require the entire Eclipse IDE. To avoid too much refactoring of the current code we reuse the existing src/ directory within each plugin, and treat each of the existing OSGI bundles as one Maven artifact. The command line wrapper jgit.sh no longer works in the uncompiled state, as we don't know where to obtain our JSch or args4j from. Developers will now need to compile it with `mvn package`, or run our Main class from within an IDE which has the proper classpath. Bug: 291265 Change-Id: I355e95fa92fa7502651091d2b651be6917a26805 Signed-off-by: Shawn O. Pearce --- .gitignore | 6 - jgit-maven/.gitignore | 1 - jgit-maven/jgit/pom.xml | 226 --------------------- make_jgit.sh | 181 ----------------- org.eclipse.jgit.pgm/.gitignore | 1 + org.eclipse.jgit.pgm/META-INF/MANIFEST.MF | 2 + jgit.sh => org.eclipse.jgit.pgm/jgit.sh | 17 +- org.eclipse.jgit.pgm/pom.xml | 170 ++++++++++++++++ org.eclipse.jgit.test/.gitignore | 6 +- org.eclipse.jgit.test/pom.xml | 95 +++++++++ org.eclipse.jgit.ui/.gitignore | 1 + org.eclipse.jgit.ui/plugin.properties | 2 +- org.eclipse.jgit.ui/pom.xml | 95 +++++++++ org.eclipse.jgit/.gitignore | 3 +- org.eclipse.jgit/pom.xml | 95 +++++++++ pom.xml | 234 ++++++++++++++++++++++ 16 files changed, 702 insertions(+), 433 deletions(-) delete mode 100644 .gitignore delete mode 100644 jgit-maven/.gitignore delete mode 100644 jgit-maven/jgit/pom.xml delete mode 100644 make_jgit.sh rename jgit.sh => org.eclipse.jgit.pgm/jgit.sh (86%) create mode 100644 org.eclipse.jgit.pgm/pom.xml create mode 100644 org.eclipse.jgit.test/pom.xml create mode 100644 org.eclipse.jgit.ui/pom.xml create mode 100644 org.eclipse.jgit/pom.xml create mode 100644 pom.xml diff --git a/.gitignore b/.gitignore deleted file mode 100644 index d73c6106c..000000000 --- a/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/jgit -/jgit.jar -/jgit_src.zip -/jgit_docs.zip -/org.eclipse.jgit/lib/jsch-*.jar -/org.eclipse.jgit.pgm/lib/args4j-*.jar diff --git a/jgit-maven/.gitignore b/jgit-maven/.gitignore deleted file mode 100644 index eb5a316cb..000000000 --- a/jgit-maven/.gitignore +++ /dev/null @@ -1 +0,0 @@ -target diff --git a/jgit-maven/jgit/pom.xml b/jgit-maven/jgit/pom.xml deleted file mode 100644 index 5f30afbfb..000000000 --- a/jgit-maven/jgit/pom.xml +++ /dev/null @@ -1,226 +0,0 @@ - - - - - 4.0.0 - org.eclipse - jgit - jar - 0.6.0-SNAPSHOT - jgit - http://repo.or.cz/w/jgit.git - - - GIT Mailing List - git@vger.kernel.org - http://marc.info/?l=git - - - Pure Java implementation of Git - - - Shawn O. Pearce - spearce@spearce.org - - Maintainer - - - - Robin Rosenberg - robin.rosenberg@dewire.com - - Maintainer - - - - Dave Watson - dwatson@mimvista.com - - Developer - - - - Roger C. Soares - rogersoares@intelinet.com.br - - Developer - - - - Marek Zawirski - marek.zawirski@gmail.com - - Developer - - - - Charles O'Farrell - charleso@charleso.org - - Contributor - - - - Imran M Yousuf - imyousuf@smartitengineering.com - Smart IT Engineering - - Contributor - - - - - - Eclipse Distribution License (New BSD License) - - All rights reserved. - Redistribution and use in source and binary forms, with or - without modification, are permitted provided that the following - conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - Neither the name of the Eclipse Foundation, Inc. nor the - names of its contributors may be used to endorse or promote - products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - ../../org.eclipse.jgit/src/ - - - ../../org.eclipse.jgit.test/tst-rsrc/ - - - ../../org.eclipse.jgit.test/tst/ - - - maven-compiler-plugin - 2.0.2 - - 1.5 - 1.5 - UTF-8 - - - - maven-surefire-plugin - 2.4.2 - - - **/*Test.java - **/*TestCase.java - **/T000*.java - - - - - maven-source-plugin - - - - jar - - - - - - maven-javadoc-plugin - - - - jar - - - - - - - - - junit - junit - 3.8.1 - test - - - com.jcraft - jsch - 0.1.41 - compile - - - - - jgit-maven-snapshot-repository - JGit Maven Snapshot Repository - dav:https://egit.googlecode.com/svn/maven/snapshot-repository/ - true - - - diff --git a/make_jgit.sh b/make_jgit.sh deleted file mode 100644 index f7363f9f4..000000000 --- a/make_jgit.sh +++ /dev/null @@ -1,181 +0,0 @@ -#!/bin/sh -# Copyright (C) 2009, Christian Halstrick -# Copyright (C) 2008-2009, Google Inc. -# Copyright (C) 2009, Johannes Schindelin -# Copyright (C) 2008, Mike Ralphson -# Copyright (C) 2009, Mykola Nikishov -# Copyright (C) 2009, Nicholas Campbell -# Copyright (C) 2009, Robin Rosenberg -# Copyright (C) 2008, Shawn O. Pearce -# and other copyright owners as documented in the project's IP log. -# -# This program and the accompanying materials are made available -# under the terms of the Eclipse Distribution License v1.0 which -# accompanies this distribution, is reproduced below, and is -# available at http://www.eclipse.org/org/documents/edl-v10.php -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or -# without modification, are permitted provided that the following -# conditions are met: -# -# - Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# - Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# -# - Neither the name of the Eclipse Foundation, Inc. nor the -# names of its contributors may be used to endorse or promote -# products derived from this software without specific prior -# written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -O_CLI=jgit -O_JAR=jgit.jar -O_SRC=jgit_src.zip -O_DOC=jgit_docs.zip - -PLUGINS=" - org.eclipse.jgit - org.eclipse.jgit.ui - org.eclipse.jgit.pgm -" -JARS=" - org.eclipse.jgit/lib/jsch-0.1.37.jar - org.eclipse.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" -o "$MSYSTEM" = "MINGW32" ] -then - PSEP=";" - R=`pwd -W` -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 - rm -rf docs -} - -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 $O_DOC - -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=${VN:-untagged}`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.eclipse.jgit.pgm.build.JarLinkUtil \ - -include org.eclipse.jgit/bin2 \ - -file META-INF/MANIFEST.MF=$T_MF \ - >$O_JAR+ && -mv $O_JAR+ $O_JAR && -echo "Created $O_JAR." && - -java org.eclipse.jgit.pgm.build.JarLinkUtil \ - -include org.eclipse.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.eclipse.jgit.pgm.TextBuiltin && -sed s/@@use_self@@/1/ jgit.sh >$O_CLI+ && -java org.eclipse.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.eclipse.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." - -echo "Building Javadocs ..." -for p in $PLUGINS; do - javadoc -quiet -sourcepath "$p/src/" -d "docs/$p/" \ - `find "$p/src" -name "*.java"` -done - -(cd docs && jar cf "../$O_DOC" .) -echo "Created $O_DOC." - -cleanup_bin diff --git a/org.eclipse.jgit.pgm/.gitignore b/org.eclipse.jgit.pgm/.gitignore index 5e56e040e..934e0e06f 100644 --- a/org.eclipse.jgit.pgm/.gitignore +++ b/org.eclipse.jgit.pgm/.gitignore @@ -1 +1,2 @@ /bin +/target diff --git a/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF b/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF index 5100d140a..4d0bacc66 100644 --- a/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF @@ -20,3 +20,5 @@ Import-Package: org.eclipse.jgit.awtui, org.kohsuke.args4j.spi Bundle-ActivationPolicy: lazy Export-Package: org.eclipse.jgit.pgm +Main-Class: org.eclipse.jgit.pgm.Main +Implementation-Title: JGit Command Line Interface diff --git a/jgit.sh b/org.eclipse.jgit.pgm/jgit.sh similarity index 86% rename from jgit.sh rename to org.eclipse.jgit.pgm/jgit.sh index 76b582919..e6a2119ef 100644 --- a/jgit.sh +++ b/org.eclipse.jgit.pgm/jgit.sh @@ -42,20 +42,9 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -if [ "@@use_self@@" = "1" ] -then - this_script=`which "$0" 2>/dev/null` - [ $? -gt 0 -a -f "$0" ] && this_script="$0" - cp=$this_script -else - jgit_home=`dirname $0` - cp="$jgit_home/org.eclipse.jgit/bin" - cp="$cp:$jgit_home/org.eclipse.jgit/lib/jsch-0.1.37.jar" - cp="$cp:$jgit_home/org.eclipse.jgit.pgm/bin" - cp="$cp:$jgit_home/org.eclipse.jgit.pgm/lib/args4j-2.0.9.jar" - unset jgit_home - java_args= -fi +this_script=`which "$0" 2>/dev/null` +[ $? -gt 0 -a -f "$0" ] && this_script="$0" +cp=$this_script if [ -n "$JGIT_CLASSPATH" ] then diff --git a/org.eclipse.jgit.pgm/pom.xml b/org.eclipse.jgit.pgm/pom.xml new file mode 100644 index 000000000..8f2312b85 --- /dev/null +++ b/org.eclipse.jgit.pgm/pom.xml @@ -0,0 +1,170 @@ + + + + + 4.0.0 + + + org.eclipse.jgit + jgit-parent + 0.6.0-SNAPSHOT + + + org.eclipse.jgit.pgm + JGit - Command Line Interface + + + Command line client tools built on top of JGit. + + + + + args4j + args4j + + + + org.eclipse.jgit + org.eclipse.jgit + + + + org.eclipse.jgit + org.eclipse.jgit.ui + + + + + src/ + + + + . + + META-INF/services/org.eclipse.jgit.pgm.TextBuiltin + + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 1.2 + + + package + + shade + + + jgit-cli + false + + + + + org.eclipse.jgit.pgm.Main + JGit Command Line Interface + ${project.version} + + + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.3 + + + create_jgit + package + + + + + + + + + + + run + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.3 + + + attach_jgit + package + + attach-artifact + + + + + ${basedir}/target/jgit + sh + + + + + + + + + diff --git a/org.eclipse.jgit.test/.gitignore b/org.eclipse.jgit.test/.gitignore index 9d7d1382b..b5bbb0ab8 100644 --- a/org.eclipse.jgit.test/.gitignore +++ b/org.eclipse.jgit.test/.gitignore @@ -1,3 +1,3 @@ -bin -tst/todopack -trash +/bin +/target +/trash diff --git a/org.eclipse.jgit.test/pom.xml b/org.eclipse.jgit.test/pom.xml new file mode 100644 index 000000000..2eb8f9aa7 --- /dev/null +++ b/org.eclipse.jgit.test/pom.xml @@ -0,0 +1,95 @@ + + + + + 4.0.0 + + + org.eclipse.jgit + jgit-parent + 0.6.0-SNAPSHOT + + + org.eclipse.jgit.test + JGit - Core Tests + + + JUnit tests for the core library. + + + + + org.eclipse.jgit + org.eclipse.jgit + + + + + tst/ + + + + tst-rsrc/ + + + + + + maven-surefire-plugin + 2.4.2 + + + **/*Test.java + **/*TestCase.java + **/T000*.java + + + + + + diff --git a/org.eclipse.jgit.ui/.gitignore b/org.eclipse.jgit.ui/.gitignore index 5e56e040e..934e0e06f 100644 --- a/org.eclipse.jgit.ui/.gitignore +++ b/org.eclipse.jgit.ui/.gitignore @@ -1 +1,2 @@ /bin +/target diff --git a/org.eclipse.jgit.ui/plugin.properties b/org.eclipse.jgit.ui/plugin.properties index e6c6c0865..b9acc5151 100644 --- a/org.eclipse.jgit.ui/plugin.properties +++ b/org.eclipse.jgit.ui/plugin.properties @@ -1,2 +1,2 @@ -plugin_name=Java Git UI (Incubation) +plugin_name=Java Git AWT User Interface (Incubation) provider_name=eclipse.org diff --git a/org.eclipse.jgit.ui/pom.xml b/org.eclipse.jgit.ui/pom.xml new file mode 100644 index 000000000..f77a143cb --- /dev/null +++ b/org.eclipse.jgit.ui/pom.xml @@ -0,0 +1,95 @@ + + + + + 4.0.0 + + + org.eclipse.jgit + jgit-parent + 0.6.0-SNAPSHOT + + + org.eclipse.jgit.ui + JGit - AWT User Interface + + + AWT/Swing based UI + + + + + org.eclipse.jgit + org.eclipse.jgit + + + + + src/ + + + + . + + plugin.properties + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + META-INF/MANIFEST.MF + + + + + + diff --git a/org.eclipse.jgit/.gitignore b/org.eclipse.jgit/.gitignore index ba077a403..934e0e06f 100644 --- a/org.eclipse.jgit/.gitignore +++ b/org.eclipse.jgit/.gitignore @@ -1 +1,2 @@ -bin +/bin +/target diff --git a/org.eclipse.jgit/pom.xml b/org.eclipse.jgit/pom.xml new file mode 100644 index 000000000..e0359398b --- /dev/null +++ b/org.eclipse.jgit/pom.xml @@ -0,0 +1,95 @@ + + + + + 4.0.0 + + + org.eclipse.jgit + jgit-parent + 0.6.0-SNAPSHOT + + + org.eclipse.jgit + JGit - Core + + + Repository access and algorithms + + + + + com.jcraft + jsch + + + + + src/ + + + + . + + plugin.properties + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + META-INF/MANIFEST.MF + + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 000000000..910b58716 --- /dev/null +++ b/pom.xml @@ -0,0 +1,234 @@ + + + + + 4.0.0 + + org.eclipse.jgit + jgit-parent + pom + 0.6.0-SNAPSHOT + + JGit - Parent + http://www.eclipse.org/egit/ + + + Pure Java implementation of Git + + + + + egit-dev Mailing List + egit-dev@eclipse.org + https://dev.eclipse.org/mailman/listinfo/egit-dev + https://dev.eclipse.org/mailman/listinfo/egit-dev + http://dev.eclipse.org/mhonarc/lists/egit-dev + + + + GIT Mailing List + git@vger.kernel.org + http://marc.info/?l=git + + + + + https://bugs.eclipse.org/bugs/ + Bugzilla + + + + + Eclipse Distribution License (New BSD License) + + All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, are permitted provided that the following + conditions are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + - Neither the name of the Eclipse Foundation, Inc. nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + UTF-8 + UTF-8 + + + + + + maven-compiler-plugin + 2.0.2 + + 1.5 + 1.5 + UTF-8 + + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + ${project.build.sourceEncoding} + true + + http://java.sun.com/j2se/1.5.0/docs/api + + + + + attach-javadocs + + jar + + + + + + + + + + junit + junit + test + + + + + + + + com.jcraft + jsch + 0.1.41 + + + + + args4j + args4j + 2.0.12 + + + + junit + junit + 3.8.1 + + + + org.eclipse.jgit + org.eclipse.jgit + ${project.version} + + + + org.eclipse.jgit + org.eclipse.jgit.ui + ${project.version} + + + + + + + jgit-maven-snapshot + JGit Maven Repository + dav:https://egit.googlecode.com/svn/maven/ + true + + + + + org.eclipse.jgit + org.eclipse.jgit.ui + org.eclipse.jgit.pgm + org.eclipse.jgit.test + +