ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey N. Solofnenko" <>
Subject RFC: metadata (annotations) in ANT
Date Fri, 06 May 2005 00:26:41 GMT

  As you may noticed, my primary love are executors. Projects become 
bigger and bigger, and their build speed becomes more and more 
important. As a private project, I implemented parallel executor to take 
advantage of multi-CPU computers.It works with simple projects, 
unfortunately in the real life projects, one information is missing - 
what targets cannot be executed simultaneously. It is possible to add 
"mutexes" attribute to the target and continue, but eventually we will 
come to the point when we create too many attributes that are needed 
only in some specific situations. So instead of adding N+1 attribute, it 
is possible to use metadata facility similar to ones in Java or C# - 
generic annotations for targets (and tasks). When I wrote "and tasks", I 
was thinking about <macrodef>s - it is very convenient to specify custom 
annotations within <macrodef>s that will affect targets (there was a 
similar discussion before, that <macrodef>s should be able to add 
dependencies on targets that use the macros).


  Annotations are defined using XML processing instructions in format 
<?name attr="value"...?> (XML standard does not impose any structure on 
a string after name in processing instructions, but we do) specified 
before targets and tasks (I am not sure whether we should support other 
XML nodes as well - <fileset>s could use some hints to run faster in 
some situations). Annotations will be stored in identity hash map (so no 
real object will have to be updated to support annotations) within 
Project object and it will be updated automatically when UnknownElements 
are converted into real objects. IdentityHashMap was introduced in Java 
1.4. This would be a good reason to drop 1.3 support in ANT (discussed 
separately), but it is also not difficult to our own IdentityHashMap 
using System identityHashCode().


class Annotation {
  public final String name;
  public final @readonly Map<String, String> attributes;

class Project {
  private finally IdentityHashMap<Object, List<Annotations> > annotations;

  public List<Annotation> getAnnotations(Object o);
  public List<Annotation> collectAnnotations(Target t); // collects all 
annotations from target and its tasks

Possible uses:
- for parallel executor: 
  <?mutex names="test-mutex1,remote-test-mutex"?>
  <target name="some-test">

- for distributed executor:
  <?prerequisite name="Linux" min-version="2.4"?>
  <?prerequisite name="InstallShield" version="6.1"?>
  <?option name="support-unc-path" value="no"?>

- for group executor (to execute only targets from some subset):
  <?group names="solaris,install"?>

- Alexey.

/ Alexey N. Solofnenko

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message