aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorSam Berlin <sameb@google.com>2014-08-08 14:17:15 -0400
committerSam Berlin <sameb@google.com>2014-08-08 14:17:43 -0400
commitc15e74affaa89bcf9499aa14171040a9f991e4e4 (patch)
tree8a29f8c09b32591b54526ba0a45395758f31a65f /util
parentc229763b2375415b005cad56c108d7e1dea8585d (diff)
downloadguice-c15e74affaa89bcf9499aa14171040a9f991e4e4.tar.gz
Move utility scripts to util dir, add secure vars to CI username/pwd, update POM to use canonical snapshot dir, add support for snapshot on succesful commit in Travis.
Diffstat (limited to 'util')
-rwxr-xr-xutil/compareBuilds.sh74
-rwxr-xr-xutil/generate-latest-docs.sh30
-rwxr-xr-xutil/publish-snapshot-on-commit.sh17
3 files changed, 121 insertions, 0 deletions
diff --git a/util/compareBuilds.sh b/util/compareBuilds.sh
new file mode 100755
index 00000000..63af7d61
--- /dev/null
+++ b/util/compareBuilds.sh
@@ -0,0 +1,74 @@
+#!/bin/bash
+# Compares the ant jars to the maven jars and makes sure they're the same
+# (or different where/how expected)
+
+# Build everything first.
+function cleanAndBuild {
+ mvn clean
+ ant clean.all
+ ant no_aop
+ ant dist test.dist
+ mvn package
+ cd build/no_aop
+ ant dist test.dist
+ cd ../..
+}
+
+function findAndCompareJars {
+ version=3.0
+ for ANT in `find ./build/dist/* -name "*-snapshot.jar" `
+ do
+ if [ $ANT = "./build/dist/guice-snapshot.jar" ]; then #Check main build
+ MVN=./core/target/guice-$version-SNAPSHOT.jar
+ extension=core
+ compareJars "$ANT" "$MVN" $extension
+ compareJars "./build/no_aop/$ANT" "./core/target/guice-$version-SNAPSHOT-no_aop.jar" "no_aop: $extension" #also compare no_aop core
+ else # Check extensions
+ extension=`echo $ANT | awk -F"-" '{print $2 }'`
+ MVN=./extensions/$extension/target/guice-$extension-$version-SNAPSHOT.jar
+ compareJars "$ANT" "$MVN" $extension
+ fi
+
+ done;
+}
+
+function compareJars {
+ ANT=$1
+ MVN=$2
+ extension=$3
+
+ echo Comparing $3
+ mkdir tmp$$
+ cp $ANT tmp$$/ant.jar
+ cp $MVN tmp$$/mvn.jar
+ cd tmp$$
+ mkdir ant
+ mkdir mvn
+ cd ant
+ jar -xf ../ant.jar
+ cd ..
+ cd mvn
+ jar -xf ../mvn.jar
+ cd ..
+
+ # ant puts LICENSE & NOTICE files in a different place
+ echo LICENSE > excludes
+ echo NOTICE >> excludes
+ # ant does not create DEPENDENCIES
+ echo DEPENDENCIES >> excludes
+ # ant/mvn slightly different in MANIFEST.MF
+ echo MANIFEST.MF >> excludes
+ # ant leaves empty directories for some jarjar'd paths --
+ # we grep -v instead of exclude because we want to make sure
+ # if any files in those directories exist, that they're diff'd
+ diff -u --recursive -Xexcludes ant mvn | grep -v "Only in ant/com/google/inject/internal/asm: signature" | grep -v "Only in ant/com/google/inject/internal/cglib: beans" | grep -v "Only in ant/com/google/inject/internal/cglib: transform" | grep -v "Only in ant/com/google/inject/internal/cglib: util"
+ cd ..
+ rm -rf "tmp$$"
+}
+
+cleanAndBuild
+echo "Starting to compare jars... Check the output closely!"
+echo
+findAndCompareJars
+echo
+echo "If the only thing that printed out is 'Comparing <thing>', then you're good!"
diff --git a/util/generate-latest-docs.sh b/util/generate-latest-docs.sh
new file mode 100755
index 00000000..683c5fd3
--- /dev/null
+++ b/util/generate-latest-docs.sh
@@ -0,0 +1,30 @@
+# see http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/ for details
+
+if [ "$TRAVIS_REPO_SLUG" == "google/guice" ] && \
+ [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && \
+ [ "$LABEL" == "ant" ] && \
+ [ "$TRAVIS_PULL_REQUEST" == "false" ] && \
+ [ "$TRAVIS_BRANCH" == "master" ]; then
+ echo -e "Publishing javadoc & JDiff...\n"
+ rm -rf build/docs
+ ant javadoc jdiff
+ cp -R build/docs/javadoc $HOME/javadoc-latest
+ cp -R build/docs/latest-api-diffs $HOME/api-diffs-latest
+ cp lib/build/jdiff/*.gif $HOME/api-diffs-latest/
+
+ cd $HOME
+ git config --global user.email "travis@travis-ci.org"
+ git config --global user.name "travis-ci"
+ git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/google/guice gh-pages > /dev/null
+
+ cd gh-pages
+ git rm -rf api-docs/latest/api-diffs api-docs/latest/javadoc
+ mkdir -p api-docs/latest
+ cp -rf $HOME/api-diffs-latest api-docs/latest/api-diffs
+ cp -rf $HOME/javadoc-latest api-docs/latest/javadoc
+ git add -f .
+ git commit -m "Lastest javadoc & api-diffs on successful travis build $TRAVIS_BUILD_NUMBER auto-pushed to gh-pages"
+ git push -fq origin gh-pages > /dev/null
+
+ echo -e "Published Javadoc & JDiff to gh-pages.\n"
+fi
diff --git a/util/publish-snapshot-on-commit.sh b/util/publish-snapshot-on-commit.sh
new file mode 100755
index 00000000..19b571b3
--- /dev/null
+++ b/util/publish-snapshot-on-commit.sh
@@ -0,0 +1,17 @@
+# see https://coderwall.com/p/9b_lfq
+
+if [ "$TRAVIS_REPO_SLUG" == "google/guice" ] && \
+ [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && \
+ [ "$LABEL" == "mvn" ] && \
+ [ "$TRAVIS_PULL_REQUEST" == "false" ] && \
+ [ "$TRAVIS_BRANCH" == "master" ]; then
+ echo -e "Publishing maven snapshot...\n"
+
+ cd $HOME
+ git clone --quiet --branch=travis https://github.com/google/guice travis > /dev/null
+ cd -
+
+ mvn clean deploy --settings="$HOME/travis/settings.xml" -DskipTests=true -Dmaven.javadoc.skip=true
+
+ echo -e "Published maven snapshot"
+fi