Ant Darcs Lab

Swe

Introduction

The following exercise will introduce you to Ant, a build tool originally developed for java, and Darcs, a distributed version management system. It probably is a good idea to keep the manuals of ant and darcs close by, because you're going to need them.

There are many other programs that provide alternative interfaces to ant and darcs. Most notably there are some plugins for Eclipse for both ant (eclipse actually supports ant by default) and darcs. You are invited to explore these yourself if you prefer point and click interfaces, but at your own risk. By the way, the man pages for darcs are also useful as a quick reference.

Getting Started

Where to Work

You can either work on the machines in rooms BBL 5..., or you can use Putty from one of the Windows machines in the labs where we usually reside. It is up to you. Make sure at the start that ant, darcs, javac and java can be accessed from the terminal.

The program you will write an ant build-file for, is a demo of jogl. It consists of an extremely limited particle effects system. Here is the download.

Some Remarks

  • darcs might give you an error message plink: unknown option "-0" for almost every command, you can safely ignore it
  • darcs seems to crash when trying to add a long comment (when you make a patch) so don't

The Exercise

An Ant Build file

Take a careful look at the simple example in the manual. Write a build.xml file in the project root that

  • compiles the source code in a special build directory;
  • has a clean target that clears all the files that can be produced by the building script;
  • contains a target that produces a jar file containing the demo (also include the images directory in the jar file);
  • uses properties where appropriate and
  • by default builds the jar file.
The file jogl.jar contains some library files that you need, include it in the classpath.

Jogl needs some native binary files. These can be found in the subdirectories of lib. Using these you should be able to write a target named run that starts the program for any of the operating systems you have native files for. The windows-i586 binaries have to be used for the windows 2000 at the lab (take care of this using Ant). To get you started have a look at the properties os.name and os.arch and the following task:

<java classname="ControlWindow" fork="true">
  <sysproperty key="java.library.path" value="${java.library.path}${path.separator}lib/Linux-i386" />
  <classpath>
    <path location="build/jar/demo.jar"/>
    <path location="lib/jogl.jar"/>
  </classpath>
</java>

N.B. Even if it is only possible to test this exercise on Linux, you still need to support these other operating systems. You can do this by checking if your ant-files deals with them properly by overriding the environment variables. Basically, what you can assume is that the os.arch and os.name points to the right binary, except for windows 2000. For that you need to do something special. In that case os.name is not "windows", but "windows 2000". Check the Ant documentation for proper ways to deal with this exception.

Back to Darcs

If the build file is ready, record your changes in a new patch. Now download this patch and apply the changes to your repository. Note that the patch is not based on the repository you downloaded, but a previous version. Explain how this could be compared to branching in subversion.

Now, create a patch containing all the changes between your repository and the original one. Hint: use the -o flag to get a file as output instead of email.

Handing in the Exercise

Since the final patch should contain the build.xml file that you created it will suffice. Hand in your patch (check and double check if it really works!) and answer the question in a readme file. -- GideonSmeding - 27 Sep 2006

Topic attachments
I Attachment Action Size Date Who Comment
zipzip demo.zip manage 5111.0 K 29 Sep 2006 - 12:44 GideonSmeding  
elsepatch smudge.patch manage 3.4 K 29 Sep 2006 - 12:44 GideonSmeding