Tuesday, 27 October 2009

Building Maven artifacts for GWT 2.0.0 (trunk) and GWT Incubator

Update: Fixed svn url to GWT incubator.

Here's how I set up Hudson to run daily builds of the upcoming 2.0 version of GWT together with GWT Incubator:

I first set up a job 'GWT-2.0' to check out and build GWT itself. There are two repositories needed:

http://google-web-toolkit.googlecode.com/svn/trunk
and
http://google-web-toolkit.googlecode.com/svn/tools

Hudson then runs the following script to build GWT and deploy the maven artifacts to a local repository:
LOCAL_REPO=file:///srv/maven2
cd trunk
SVN_REV=`svn info | grep Revision | awk '{print $2}'`
GWT_VERSION=2.0.0-$SVN_REV
$ANT_HOME/bin/ant clean
$ANT_HOME/bin/ant -Dgwt.version=$GWT_VERSION

for artifact in `ls build/lib`;
do
artifact_packaging=${artifact##*.}
artifact_name=${artifact%.*}
$MAVEN_HOME/bin/mvn deploy:deploy-file -DgroupId=com.google.gwt -DartifactId=$artifact_name -Dversion=$GWT_VERSION -Dpackaging=$artifact_packaging \
-Durl=$LOCAL_REPO -DgeneratePom=true -Dfile=build/lib/$artifact
done

$MAVEN_HOME/bin/mvn deploy:deploy-file -DgroupId=com.google.gwt -DartifactId=gwt \
-Dversion=$GWT_VERSION -Dpackaging=zip -Durl=$LOCAL_REPO -DgeneratePom=true -Dfile=build/dist/gwt-$GWT_VERSION.zip

For GWT Incubator I trigger a build after each successful build of GWT. The Incubator repository is at

http://google-web-toolkit-incubator.googlecode.com/svn/trunk

After checking out, hudson runs the following script to build and deploy the Maven artifact:
LOCAL_REPO=file:///srv/maven2

export GWT_TOOLS=/home/hudson/.hudson/jobs/GWT-2.0/workspace/tools
GWT_SVN_REV=`svn info /home/hudson/.hudson/jobs/GWT-2.0/workspace/trunk/| grep \
Revision | awk '{print $2}'`
GWT_VERSION=2.0.0-$GWT_SVN_REV
export GWT_HOME=/home/hudson/.hudson/jobs/GWT-2.0/workspace/trunk/build/staging/gwt-$GWT_VERSION

cd trunk
$ANT_HOME/bin/ant -Dgwt.dev.jar=$GWT_HOME/gwt-dev.jar
$MAVEN_HOME/bin/mvn deploy:deploy-file -DgroupId=com.google.gwt -DartifactId=gwt-incubator \
-Dversion=$GWT_VERSION -Dpackaging=jar -Durl=$LOCAL_REPO -DgeneratePom=true -Dfile=build/dist/gwt-incubator.jar

4 comments:

Olivier said...

Neat stuff. Do you publish the artefacts somewhere?

rodrigob said...

The incubator svn rul is the same as the gwt svn url ?

Asgeir Frimannsson said...

Olivier, you can find the hudson builds at http://openl10n.net/hudson/ and the artifacts at http://openl10n.net/maven2/com/google/gwt/ (for now).

Asgeir Frimannsson said...

rodrigob, thanks, I've updated the url.