[Top] | [Contents] | [Index] | [ ? ] |
Ant http://ant.apache.org is a build tool. Generating ant build files can be hard work. In particular, I've found that its very hard to share build file code between different projects. antmerge attempts to address this problem, in a relatively straight forward way.
This manual describes how to use the antmerge tool, version 0.1.
1. Overview 2. installation 3. Usage 4. Command Line Options 5. Supplied Build files 6. The Future 7. Acknowledgements, and Contact
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The ant tool was developed to address the needs for a cross platform independent tool. Besides, we are told, "make files are inherently evil". This is probably all true. However ant files are also fairly evil, as anyone who has spent any time writing them will know. The complexity of the system is enormous. Some of this can be overcome by using a DTD for editing ant files. At least you can get files that ant will run. However even then the semantics of the different tags is often not clear, and a large amount of trail and error is necessary. Ant also uses XML, a format which is amusing described as "human readable", but often is not.
Now all of these difficulties are compounded by the difficulty of reusing ant files within one another. Ant provides no ability to include one file within another (although you can do an lexical include by defining an XML entity), and it provides no sort of inheritance between different builds.
Antmerge attempts to address this problem. It does this in a relatively straightforward way, by merging two or more build files, the "main files" (or parent files) and a "merge file", according to a set of rules. This generates an end build file, that is something like what would happen if the merge file inherited from the main files. You can add new functionality to the main files, and you over ride existing functionality.
Antmerge will work with any ant build file, although it will work better if the main files have been written with antmerge in mind. Additionally, antmerge provides some basic, generic, build files that you can use as main files for your own projects.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The easiest way to install antmerge on Unix is to symlink the file "antmerge.sh" into the system path. It should just then run. This is assuming java is on the system path also.
If you are using a Windows system, then you can use antmerge.bat instead. The supplied and generated build files assume that antmerge's binary `bin' directory is on the system path.
Installation can be a little more difficult if you are build straight from source, as you need to boot strap the process, for which see 2.1 Boot Installation.
2.1 Boot Installation
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Unsurprisingly it uses ant to build. Its own build file is generated by antmerge, so strictly speaking should need a bootstrap version of antmerge to build antmerge. However, the source distribution contains a bootstrap build file, `boot.xml', that builds enough of antmerge from source that you can complete the build with the generated `build.xml' file in the usual way. By default `boot.xml' compiles antmerge, generates `build.xml' and then deletes everything else that it has just done. To build antmerge fully, you then run ant on this `build.xml'. To get this to work fully you also need to run the gather target which pulls external dependencies from where ever they are stored, and then ant.
So the full process is....
ant -find boot.xml ant gather ant
and this should be it.
It should be noted that the "antmerge.sh" is generated during this process, and its not present in the CVS.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Basic usage of antmerge
is very simple. You might create a file
called `build-in.xml', which is the default name, with the
following contents...
<project name="antmerge" default="compile"/> |
You might then choose to use the default build file that antmerge
provides. Simply invoking antmerge default
, will result in the
generation of a new `build.xml' file.
In this case `default' refers to the file `default.xml' provided with antmerge, which provides most of the basic targets that you will for a project. The `build-in.xml' provides the project name, and default targets. In this manual, the file `build-in.xml' is described as the "merge file".
It is also possible to over ride specific parts of the main file. For instance, adding
<property name="ext-base" value="../../external-dependencies"/> |
will override the property definition that the `default.xml' file provides. Likewise you can override a target definition, so....
<target name="precompile"> <uptodate property="antfiles.uptodate" targetfile="${etc}/default.xml"> <srcfiles dir="${etc}"> <include name="default-in.xml"/> <include name="antmerge.xml"/> </srcfiles> </uptodate> </target> |
will change the precompile target to have the following definition.
As well as being able to override properties, and targets, you can specifically override any top level (i.e. immediate child of project) tag that has an unique "id" attribute.
Finally if you want to introduce a new target, not in the main file, then you can just added it to the merge file.
You can specify more than one main file (separated by commas or plus signs: note that the Windows command interpreter treats comma as a parameter separarator: we therefore recommend using plus signs if you expect your build files to be executed on Windows systems.
If you specify multiple main files, then antmerge merges the second main file into the first as above, then the third (if present) into the the result, and so on, finally merging the merge file inot the result of merging all the mainfiles.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A number of build files are provided
`antmerge' provides very little information other than tags for
ensuring that the `build.xml' file is up to date, with a specified
merge file. You might use this file if you do not wish to use any of the
default files provided by antmerge. This functionality can be accessed
by defining two properties, as this example from antmerge
's
own build file shows. (I like to change the default merge file name from
`build-in.xml', or I end up with many identically named files open
in Emacs, and I don't know which applies to which project).
<property name="antmerge.parent" value="default"/> <property name="antmerge.infile" value="antmerge-in.xml"/> |
`default' provides most of the targets that an average project would require. It is actually a antmerge generated file itself, and includes the functionality of `antmerge'.
`tomcat' provides some support for developing tomcat applications. This isn't finished yet, and is not fully functional
`netbeans' generate and install a netbeans module
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Recently, the ant developers have started work on a "Import" task which may provide much of the same functionality as antmerge. However this will not be available for some time. Migration between antmerge and this future import task should be possible, although it's hard to be sure before seeing the final specification of the task
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Antmerge was written by Phillip Lord (p.lord@russet.org.uk), and Nick Sharman (Nick.Sharman@cs.man.ac.uk), while at the Department of Computer Science, University of Manchester, as part of the myGrid project.
[Top] | [Contents] | [Index] | [ ? ] |
[Top] | [Contents] | [Index] | [ ? ] |
1. Overview
2. installation
3. Usage
4. Command Line Options
5. Supplied Build files
6. The Future
7. Acknowledgements, and Contact
[Top] | [Contents] | [Index] | [ ? ] |
Button | Name | Go to | From 1.2.3 go to |
---|---|---|---|
[ < ] | Back | previous section in reading order | 1.2.2 |
[ > ] | Forward | next section in reading order | 1.2.4 |
[ << ] | FastBack | previous or up-and-previous section | 1.1 |
[ Up ] | Up | up section | 1.2 |
[ >> ] | FastForward | next or up-and-next section | 1.3 |
[Top] | Top | cover (top) of document | |
[Contents] | Contents | table of contents | |
[Index] | Index | concept index | |
[ ? ] | About | this page |