The Source for Java Technology Collaboration
User: Password:



Rich Unger

Rich Unger's Blog

Module Suite building tips (part 4)

Posted by richunger on December 21, 2005 at 02:42 PM | Comments (4)

Today, I'll be taking the stock Module Suite build files, and creating a nightly build process. My process does an update on the source tree, builds it, runs unit tests, publishes the result to our intranet, and labels the source tree.

My particular project uses ClearCase as the source control repository, though this should be simple enough to tweak for CVS, subversion, perforce, etc.

All these targets are just in my root build.xml.

To start, here's a high level overview of the tasks which need to be completed:

<target name="nightly-impl">
    <antcall target="clean"/>
    <antcall target="repository-update"/>
    <antcall target="build-zip"/>
    <antcall target="test-all"/>
    <antcall target="publish-build"/>
    <antcall target="label-build"/>
</target>

The 'clean' target is just inherited. 'repository-update' looks like this:

<target name="repository-update">
    <ccupdate viewpath="."
    graphical="false" 
    log="build/clearcase.log"
    overwrite="true"
    currenttime="true"
    rename="false"/>
</target>

...though, of course, that's clearcase-specific.

The 'build-zip' and 'test-all' targets are inherited as well, though I override 'build-zip' as seen in my previous entry.

Publishing to the intranet, in my case, is just a simple copy with a fancy naming scheme. The variables ${vb.release.location} and ${vb.branch.name} must be defined elsewhere.

<target name="publish-build">
    <tstamp>
        <format property="buildnumber" pattern="yyMMdd" timezone="UTC"/>
    </tstamp>
    <property name="nightly-release-dir" value="${vb.release.location}/nightly"/>
    <mkdir dir="${nightly-release-dir}"/>
    <copy file="dist/${app.name}.zip" 
          tofile="${nightly-release-dir}/V-Builder-${vb.branch.name}-${buildnumber}.zip" overwrite="yes"/>
</target>

Labelling/tagging the build is, once again, a clearcase-specific thing. The syntax for CVS, etc. would be different:

<target name="label-build">
    <tstamp>
        <format property="buildnumber" pattern="yyMMdd" timezone="UTC"/>
    </tstamp>

<property name="label-ver" value="REL-${vb.branch.name}-${buildnumber}"/> <ccmklbtype typename="${label-ver}"/> <ccmklabel viewpath="." recurse="true" typename="${label-ver}" failonerr="false"/> </target>

The last step is to provide some kind of notification/logging of the status of the nightly build. I do this by invoking ant with command-line parameters for sending the console output to some email address:

<target name="nightly">
    <exec executable="cmd" failonerror="true">
        <arg line="/c ant -logger org.apache.tools.ant.listener.MailLogger -DMailLogger.from=${vb.nightly.email.from} -DMailLogger.failure.to=${vb.nightly.email.to.failure} -DMailLogger.success.to=${vb.nightly.email.to.success} -DMailLogger.mailhost=${vb.nightly.email.mailhost} nightly-impl"/>
    </exec>
</target>

Then we just set up a cron job that runs "ant nightly" at the top of the source tree. Simple, eh?


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • Hi Rich,
    just curious,
    a) what is your feeling about ClearCase, comparing to other Versionning Tool ?
    b) are you using CC in a windows environment or unix/linux one ?

    Thanks a lot.

    Vincent

    Posted by: vbrabant on December 22, 2005 at 03:51 AM

  • Any ideas how to further integrate this with something like http://bitten.cmlenz.net (ok. it is subversion based but maybe of interest as well)

    Posted by: sven on December 22, 2005 at 08:47 AM

  • Hey, Vincent. I'm running CC under windows, though others in my office use solaris and linux. I have a serious love/hate relationship with clearcase. It has, by far, the best merge capabilities of any source control system. It's absolutely fantastic for maintaining multiple branches and merging bugfixes across branches. It figures things out automatically that other systems would require you to merge manually. The GUI tools for this are unbelievable as well. I love the version tree browser.But, that's about all it has going for it. The performance is dismal, the configuration is entirely too complicated, the learning curve is way too steep.
    Also, the netbeans VCS profile for CC needs a serious updating. It only acts the way I expect it to half the time, and fails silently the other half.
    Sven-Sorry, I've never used that product. To the extent that it integrates with ant, I'm sure it would fit in just fine, though.

    Posted by: richunger on December 22, 2005 at 11:23 AM

  • Yeah, seems so - I will set something up using trac/bitten using some of your tips (e.g. fetching and unpacking of platform)

    Keep up the good work, Thx Sven

    Posted by: sven on December 23, 2005 at 03:49 AM





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds