Ant Darcs Lab

Swe0607

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

Working on windows with Cygwin

Before you can start the lab assignment on the windows lab machines you need to set up cygwin. This can be done by following these steps:

  1. Start a command prompt: Start -> Programs -> Accessories -> Command Prompt.
  2. In the dos command prompt start bash by opening C:\cygwin\cygwin.bat.
  3. Open the bash configuration file for cygwin with a text editor. The file is called H:\cygwin\.bashrc (or ~/.bashrc) and is usually hidden from view, so you might have to type in the location explicitly instead of using explorer.
  4. Add the following lines to your bashrc:
    CYGWINPKGS="/cygdrive/u/gjsmedin/cygwin/"
    export PATH=$PATH:$CYGWINPKGS/darcsdir-cygwin
          
  5. You probably want to uncomment the line with alias ls='ls -F --color=tty' too, it gives colorized output for ls
  6. Re-read your bash configuration file by typing source ~/.bashrc in the command prompt
  7. Check if everything works by running which ant java javac darcs (the paths to the executables should be returned)

The program you will write an ant build-file for, is a demo of jogl. It consists of an extremely limited particle effects system. Retrieve the repository using the following command (or download it and use it locally):

darcs get http://www.students.cs.uu.nl/people/gjsmedin/demo

Some Remarks

  • you can paste to the command prompt with the right mouse button
  • darcs probably will 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 can also be used for the windows 2000 at the lab. 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>

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