Skip to content

Commit

Permalink
update build script to support github
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqiangqian committed May 23, 2014
1 parent d2a1acd commit 7f07b40
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 38 deletions.
75 changes: 43 additions & 32 deletions build/org.eclipse.birt.releng.birtbuilder/bootstrap.sh
Expand Up @@ -30,11 +30,12 @@ export DISPLAY
ulimit -c unlimited
export USERNAME BASH_ENV LD_LIBRARY_PATH DISPLAY

GitRoot=ssh://xgu@git.eclipse.org/gitroot/birt
GitRoot=ssh://git@github.com/eclipse
GitRoot_DTP=ssh://xgu@git.eclipse.org/gitroot/datatools
BranchName=Luna
dtp_BranchName=master

# Remember to change this to match the real working directory
WORKING_DIR=/home/adb/releng.440
LOG_FILE=adb.log

Expand Down Expand Up @@ -62,7 +63,7 @@ proc=$$
##########################################################################
sign=""
signDirectory=/home/data/httpd/download-staging.priv/birt
signHomeDir=/home/data/users/xgu
signHomeDir=/home/data/users/zqian
signUsername=$SIGN_USER
signPassword=$SIGN_PASSWD
signServer=build.eclipse.org
Expand Down Expand Up @@ -161,12 +162,42 @@ echo "======[dtp_BranchName]: $dtp_BranchName " >> $LOG_FILE
###############################################################
# Sync build script from branch $BranchName before build starts
###############################################################
rm -rf build
git archive --format=tar --remote=$GitRoot/org.eclipse.birt.git $BranchName build/org.eclipse.birt.releng.birtbuilder | tar -xf -
cp -f build/org.eclipse.birt.releng.birtbuilder/buildAll.xml ./
cp -f build/org.eclipse.birt.releng.birtbuilder/build.xml ./
cp -rf build/org.eclipse.birt.releng.birtbuilder/eclipse ./
cp -rf build/org.eclipse.birt.releng.birtbuilder/extras ./

#Pull or clone a branch from a repository
#Usage: pull repositoryURL branch
pull() {
mkdir -p $builderDir/gitClones
pushd $builderDir/gitClones
directory=$(basename $1 .git)
if [ ! -d $directory ]; then
echo git clone $1
git clone $1
fi
popd
pushd $builderDir/gitClones/$directory

echo ">>git fetch"
git fetch
echo ">>git checkout $2"
git checkout $2
echo ">>git pull origin $2"
git pull origin $2
popd
}

#rm -rf build

# github doesn't support the "archive" command, we have to do a clone instead.
#git archive --format=tar --remote=$GitRoot/birt.git $BranchName build/org.eclipse.birt.releng.birtbuilder | tar -xf -

echo ">>pulling latest source from $GitRoot/birt.git"
pull $GitRoot/birt.git $BranchName

# update build script from repo
#cp -f build/org.eclipse.birt.releng.birtbuilder/buildAll.xml ./
#cp -f build/org.eclipse.birt.releng.birtbuilder/build.xml ./
#cp -rf build/org.eclipse.birt.releng.birtbuilder/eclipse ./
#cp -rf build/org.eclipse.birt.releng.birtbuilder/extras ./
chmod -R +x buildAll.xml eclipse extras


Expand Down Expand Up @@ -203,27 +234,6 @@ cd $builderDir

mkdir -p $postingDirectory/$buildId

#Pull or clone a branch from a repository
#Usage: pull repositoryURL branch
pull() {
mkdir -p $builderDir/gitClones
pushd $builderDir/gitClones
directory=$(basename $1 .git)
if [ ! -d $directory ]; then
echo git clone $1
git clone $1
fi
popd
pushd $builderDir/gitClones/$directory

echo git fetch
git fetch
echo git checkout $2
git checkout $2
echo git pull origin $2
git pull origin $2
popd
}

###############################################################
# Auto tagging BIRT plugins and update mapfiles for I build
Expand All @@ -237,14 +247,14 @@ else

#remove comments
rm -f repos-clean.txt clones.txt
echo "$GitRoot/org.eclipse.birt.git $BranchName" > repos-clean.txt
echo "$GitRoot/birt.git $BranchName" > repos-clean.txt

#clone or pull each repository and checkout the appropriate branch
while read line; do
#each line is of the form <repository> <branch>
set -- $line
pull $1 $2
echo $1 | sed 's/ssh:.*@git.eclipse.org/git:\/\/git.eclipse.org/g' >> clones.txt
echo $1 | sed 's/ssh:.*@github.com/git:\/\/github.com/g' >> clones.txt
done < repos-clean.txt

cat clones.txt| xargs /bin/bash extras/git-map.sh $builderDir/gitClones \
Expand Down Expand Up @@ -318,6 +328,7 @@ echo $sign >> $LOG_FILE

########################################################################
# Set up the full build command
# *remove the '-q' option if you want to see verbose info in the log*
########################################################################
buildCommand="$antRunner -q -buildfile buildAll.xml $testBuild $compareMaps $unitTest $CheckNewJars $skipNL \
-Dbuild.runtimeOSGI=true -DallowBinaryCycles=true \
Expand All @@ -340,7 +351,7 @@ buildCommand="$antRunner -q -buildfile buildAll.xml $testBuild $compareMaps $uni
-DmapGitRoot=$GitRoot \
-Ddtp.mapGitRoot=$GitRoot_DTP \
-Dskip.unit.test=true \
-DBirtRepoCache=git___git_eclipse_org_gitroot_birt_org_eclipse_birt_git"
-DBirtRepoCache=git___github_com_eclipse_birt_git"


#capture command used to run the build
Expand Down
30 changes: 24 additions & 6 deletions build/org.eclipse.birt.releng.birtbuilder/buildAll.xml
Expand Up @@ -644,15 +644,26 @@
<cvs dest="${buildDirectory}/maps/source/org.eclipse.birt.releng"
command="tag v${package.version}_${buildId}" />
</target>

<target name="prepareMapFile" depends="checkLocal" unless="mapsLocal">

<!-- github doesn't support archive command, we cannot do this.
<exec executable="git" dir="${buildDirectory}/maps" output="${buildDirectory}/maps/maps.zip">
<arg line="archive --format=zip" />
<arg line="--remote=${mapGitRoot}/org.eclipse.birt.git" />
<arg line="archive - -format=zip" />
<arg line="- -remote=${mapGitRoot}/birt.git" />
<arg line="${mapVersionTag} releng/maps" />
</exec>
<unzip src="${buildDirectory}/maps/maps.zip" dest="${buildDirectory}/maps" />
-->

<mkdir dir="${buildDirectory}/maps/releng/maps" />

<!-- instead we simply copy the latest files from the cloned git repo -->
<!-- please update the path if you changed the repo -->
<echo>copy from: "${builder.dir}/gitClones/birt/releng/maps"</echo>
<copy todir="${buildDirectory}/maps/releng/maps" overwrite="true" failonerror="false">
<fileset dir="${builder.dir}/gitClones/birt/releng/maps" includes="**/*" />
</copy>

<!--compare the map files project -->
<antcall target="compareMapFiles" />
Expand Down Expand Up @@ -683,7 +694,6 @@

</target>


<target name="prepareSrc" if="prepare.src.flag">

<antcall target="logger">
Expand All @@ -697,12 +707,20 @@
</delete>
<mkdir dir="${buildDirectory}/source" />

<!-- github doesn't support archive command, we cannot do this.
<exec executable="git" dir="${buildDirectory}/source" output="${buildDirectory}/source/source.zip">
<arg line="archive --format=zip" />
<arg line="--remote=${mapGitRoot}/org.eclipse.birt.git" />
<arg line="archive - -format=zip" />
<arg line="- -remote=${mapGitRoot}/birt.git" />
<arg line="${mapVersionTag}" />
</exec>
<unzip src="${buildDirectory}/source/source.zip" dest="${buildDirectory}/source" />
-->

<!-- instead we simply copy the latest files from the cloned git repo -->
<!-- please update the path if you changed the repo -->
<copy todir="${buildDirectory}/source" overwrite="true" failonerror="false">
<fileset dir="${builder.dir}/gitClones/birt" includes="**/*" />
</copy>

<antcall target="logger">
<param name="message" value="Finish to clone BIRT source" />
Expand Down
7 changes: 7 additions & 0 deletions build/org.eclipse.birt.releng.birtbuilder/eclipse/helper.xml
Expand Up @@ -1420,6 +1420,7 @@

<target name="InformQA" depends="checkOS">
<property file="${eclipse.build.configs}/../../config.properties" />
<echo>INFO: Today's build (BuildId: ${buildId}) is available.</echo>
<mail failonerror="false" mailport="${mail.port}" tolist="${QA.members}"
from="${mail.from}" replyto="${replyto.address}"
subject="${BranchVersion} Build on ${mapVersionTag} Branch Is Ready on ${hostname}(BuildId: ${buildId})">
Expand Down Expand Up @@ -1561,6 +1562,7 @@

<target name="checkDTPVersion" depends="getDTPVersionProperty"
unless="latest.dtp.version">
<echo>WARNING: The installed DTP build is not the latest version.</echo>
<mail failonerror="false" mailport="${mail.port}"
subject="WARNING: The installed DTP build is not the latest version"
tolist="${build.engineer}">
Expand Down Expand Up @@ -1595,6 +1597,7 @@
<target name="checkcompileerror">
<property file="${eclipse.build.configs}/../../config.properties" />
<property file="${eclipse.build.configs}/../../monitor.properties" />
<echo>ERROR: Compile errors are found in today's BIRT build(BuildId: ${buildId}).</echo>
<mail failonerror="false" mailport="${mail.port}"
subject="Compile errors found on ${mapVersionTag} Branch in Today's Build (BuildId: ${buildId} ) "
tolist="${COMPILE.ERROR.RECIPIENTS}">
Expand Down Expand Up @@ -1644,6 +1647,7 @@

<target name="NoDiskSpace">
<property file="${eclipse.build.configs}/../../config.properties" />
<echo>ERROR: No enough disk space for build, build has been stopped.</echo>
<mail failonerror="false" mailport="${mail.port}"
subject="No enough disk space for build on ${local.hostname}" tolist="${build.engineer},${QA.leaders}">
<from address="${mail.from}" />
Expand All @@ -1661,6 +1665,7 @@

<target name="DiskSpaceWarning">
<property file="${eclipse.build.configs}/../../config.properties" />
<echo>WARNING: Disk space usage of build server is less than 7GB.</echo>
<mail failonerror="false" mailport="${mail.port}"
subject="Disk space warning on ${local.hostname}" tolist="${build.engineer}">
<from address="${mail.from}" />
Expand All @@ -1678,6 +1683,7 @@

<target name="ThirdPartyJarCheckNotification" if="CheckThirdpartylog">
<property file="${eclipse.build.configs}/../../config.properties" />
<echo>ERROR: ThirdPartyJars matching failed.</echo>
<mail failonerror="false" mailport="${mail.port}"
subject="ThirdPartyJars matching failed on ${local.hostname} ${package.version} build (BuildId: ${buildId} )"
tolist="${build.engineer}">
Expand All @@ -1701,6 +1707,7 @@

<target name="InformNoSign" if="CompareSignPack2">
<property file="${eclipse.build.configs}/../../config.properties" />
<echo>ERROR: ${target.dir}/${target.name} hasn't been signed.</echo>
<mail failonerror="false" mailport="${mail.port}"
subject="No sign in today's ${BranchVersion} build (BuildId: ${buildId} )"
tolist="${build.engineer}">
Expand Down

0 comments on commit 7f07b40

Please sign in to comment.