-
-
Save nickboldt/3901251c9fad89fe5d5536d89fbe30bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -xe | |
START_TIME=`date +%s` | |
# work in a tempdir. The tmp-dir name is something like /home/user/tmp/this_scripts_name/ | |
tmpdir=~/tmp/${0/.sh/.tmp} | |
tmpdirCache=~/tmp/${0/.sh/.tmp}_cache | |
#rm -fr ${tmpdir} | |
mkdir -p ${tmpdir} | |
cd ${tmpdir} | |
# in case we have another alias for mv, like 'mv -i' | |
alias mv=mv | |
alias rm=rm | |
# set our local pull command depending on git version | |
verlte() { | |
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ] | |
} | |
verlt() { | |
[ "$1" = "$2" ] && return 1 || verlte $1 $2 | |
} | |
GIT_VERSION=`git version | head -1 | cut -f 3 -d " "` | |
verlte $GIT_VERSION 2.9.0 && ALLOW_PULL_FLAG=false || ALLOW_PULL_FLAG=true | |
if $ALLOW_PULL_FLAG | |
then | |
LOCAL_PULL_CMD="git pull --no-edit --allow-unrelated-histories --no-rebase --rebase=false" | |
else | |
LOCAL_PULL_CMD="git pull --no-edit --no-rebase --rebase=false" | |
fi | |
MVN="mvn clean install -fae -e -Dplatform-repo.url=http://download.eclipse.org/eclipse/updates/4.8-I-builds/" | |
# Make sure different users with different settings will run the script as intended | |
gitBranchSettings () | |
{ | |
git config branch.autosetuprebase never | |
git config branch.autosetupmerge false | |
git config branch.master.rebase false | |
} | |
# handle changes to parent pom | |
if [[ ! -d webtools.releng.aggregator ]]; then git clone http://git.eclipse.org/gitroot/webtools/webtools.releng.aggregator.git; fi | |
pushd webtools.releng.aggregator/wtp-parent | |
gitBranchSettings | |
git reset --hard origin/master | |
${MVN} | |
popd | |
# Now clone the repos | |
for d in webtools.jsf webtools.jsf.docs webtools.jsf.tests; do | |
if [[ ! -d ${d} ]]; then | |
git clone http://git.eclipse.org/gitroot/jsf/${d}.git | |
fi | |
done | |
for d in webtools.jsf webtools.jsf.docs webtools.jsf.tests; do | |
pushd ${d} | |
gitBranchSettings | |
git reset --hard origin/master | |
popd | |
done | |
# Let's collect all the gitignores into one file to use later | |
for d in webtools.jsf.docs webtools.jsf.tests; do | |
pushd ${d} | |
rm -f pom.xml | |
rm -f .project | |
cat .gitignore >> ../git_ignore_accumulator | |
rm -f .gitignore | |
git commit -a -m "Removing poms and .gitignore files that will be clobbered" --signoff | |
popd | |
done | |
cd webtools.jsf | |
for d in webtools.jsf.docs webtools.jsf.tests; do | |
$LOCAL_PULL_CMD ../${d} | |
done | |
# "Merging all repos together" . | |
cat ../git_ignore_accumulator >> .gitignore | |
cat .gitignore | sort | uniq > .gitignore2 | |
mv -f .gitignore2 .gitignore | |
# WARNING: make sure correct quotes used in next line (stupid google) | |
git commit -s -m "Accumulate all gitignore files. To be cleaned later" .gitignore | |
mkdir docs | |
git mv plugins/ docs/plugins | |
git mv features docs/features | |
git commit -a -m "Move docs plugins and features into their own sub-folder" --signoff | |
{ cat pom.xml | head -n 33; find -maxdepth 3 -mindepth 3 -type d | grep -v "\.git" | cut -c 1,2 --complement | awk '{ print " <module>" $0 "</module>";}' | grep -v "jsfRuntimeJarsDirectory" | sort; tail -n 2 pom.xml;} > pom2.xml | |
mv pom2.xml pom.xml | |
git commit -a -m "Update root pom with all plugins, features, and tests" --signoff | |
cd docs | |
for td in $(find -maxdepth 2 -mindepth 2 -type d | awk '{ print $0 "/pom.xml";}'); do | |
sed 's/<artifactId>org.eclipse.webtools.jsf.docs<\/artifactId>/<artifactId>org.eclipse.webtools.jsf<\/artifactId>/' $td > $td.2; mv $td.2 $td; | |
done | |
cd ../jsf/tests/ | |
for td in $(find -maxdepth 1 -mindepth 1 -type d | grep -v jsfRuntimeJarsDirectory | awk '{ print $0 "/pom.xml";}'); do | |
sed 's/<artifactId>org.eclipse.webtools.jsf.tests<\/artifactId>/<artifactId>org.eclipse.webtools.jsf<\/artifactId>/' $td > $td.2; mv $td.2 $td; | |
done | |
cd ../features/ | |
for td in $(find -maxdepth 1 -mindepth 1 -type d | grep -v jsfRuntimeJarsDirectory | awk '{ print $0 "/pom.xml";}'); do | |
sed 's/<artifactId>org.eclipse.webtools.jsf.tests<\/artifactId>/<artifactId>org.eclipse.webtools.jsf<\/artifactId>/' $td > $td.2; mv $td.2 $td; | |
done | |
cd ../../docs | |
for td in $(find -maxdepth 2 -mindepth 2 -type d | grep -v jsfRuntimeJarsDirectory | awk '{ print $0 "/pom.xml";}'); do | |
if [ -f $td ]; then | |
sed 's/<relativePath>\.\.\/\.\.\/<\/relativePath>/<relativePath>\.\.\/\.\.\/\.\.\/<\/relativePath>/' $td > $td.2; mv $td.2 $td; | |
fi | |
done | |
cd ../ | |
git commit -a -m "Fix references to jsf root pom" --signoff | |
# Not verified yet. Do not do the below steps | |
cat <<EOT > test.txt | |
<repositories> | |
<repository> | |
<id>webtools-common-site</id> | |
<layout>p2</layout> | |
<url>\${webtools-common-site}</url> | |
</repository> | |
<repository> | |
<id>webtools-servertools-site</id> | |
<layout>p2</layout> | |
<url>\${webtools-servertools-site}</url> | |
</repository> | |
<repository> | |
<id>webtools-sourceediting-site</id> | |
<layout>p2</layout> | |
<url>\${webtools-sourceediting-site}</url> | |
</repository> | |
<repository> | |
<id>webtools-jsdt-site</id> | |
<layout>p2</layout> | |
<url>\${webtools-jsdt-site}</url> | |
</repository> | |
<repository> | |
<id>webtools-jeetools-site</id> | |
<layout>p2</layout> | |
<url>\${webtools-jeetools-site}</url> | |
</repository> | |
<!-- To reference parent pom --> | |
<repository> | |
<id>Webtools Repository - Releases</id> | |
<name>Webtools Repository - Releases</name> | |
<url>https://repo.eclipse.org/content/repositories/webtools-releases/</url> | |
</repository> | |
<repository> | |
<id>Webtools Repository - Snapshots</id> | |
<name>Webtools Repository - Snapshots</name> | |
<url>https://repo.eclipse.org/content/repositories/webtools-snapshots/</url> | |
</repository> | |
</repositories> | |
EOT | |
{ head -n 32 pom.xml; cat test.txt; tail -n 44 pom.xml; } > pom2.xml | |
mv pom2.xml pom.xml | |
rm test.txt | |
git commit -a -m "Made sure all upstream sites are referenced in root pom" --signoff | |
{ head -n 30 pom.xml ; echo " <tycho.version>1.0.0</tycho.version>"; tail -n 85 pom.xml; } > pom2.xml | |
mv pom2.xml pom.xml | |
git commit -a -m "Make sure Tycho 1.0 is being used" --signoff | |
END_TIME=`date +%s` | |
EXEC_TIME=$((END_TIME-START_TIME)) | |
echo $EXEC_TIME " seconds execution time without build" | |
# apply patches! | |
git remote add nickboldt https://github.com/nickboldt/webtools.jsf | |
git fetch nickboldt | |
# Bug 528714 add update site build | |
# https://github.com/nickboldt/webtools.jsf/commit/f8cf88dc6eecc1c4653829dc1c54ecb79dfee370 | |
git cherry-pick --keep-redundant-commits f8cf88dc6eecc1c4653829dc1c54ecb79dfee370 | |
# can now run a build locally with: | |
# mvn clean install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment