Not quite ready for prime time but you might get bored this weekend... - I have put Argument out of Commandline. - Both Path and Argument now derive from a new class NestedDataType (it's a data type for nested element!), which implements the interface CompositeType. - I have eliminated PathElement since Path can already contain Path and Strings (through append). - FileSet implements CompositeType. - Property has a new attribute: separator. When a property has a reference to a CompositeType, it can change its separator.
You can do all sorts of fun things with references as the build file test1.xml
and its output on my
machine attest.
All this brings about some interesting issues:
- What should be allowed to be referenced? for example, you could reference a
Property, but it
currently does not
follow references (its toString() simply returns a value). If it followed
references, it would
have to check for
circular references. Same with any other task. Should we restrict references
to DataTypes at this
time?
Note that a Property is already a reference of sorts when you instanciate
with ${myproperty}.
- To resolve circular references and, often to display data, a DataType needs
to know what project
it is in.
I have added constructors that take a Project argument. Maybe there should be
a static method to
give you the
current project (the top of the project stack) to avoid passing projects
around.
- Since references essentially bypass the type system, you can get some
interesting results. In this
implementation,
Path and Argument try to do something reasonable. However, add more types,
and their behaviors
could become
quite obscure.
P.S.: On my machine (W2K, cygwin) patch seems to crash when given a multi-part
patch file. For that
reason,
I have made multiple patch files.
Cheers.
Vincent.
<<attachment: ant.zip>>
<?xml version="1.0"?>
<!-- ======================================================================= -->
<!-- Test1 -->
<!-- ======================================================================= -->
<project name="test1" default="test" basedir=".">
<property name="name" value="Test1" id="name"/>
<property name="words" value="one two three" id="words"/>
<path id="path1">
<path location="${name}.xml" id="path12"/>
<path value="${basedir};coucou">
<path value="toto"/>
</path>
<path refid="arg0"/>
</path>
<patternset id="pattern1">
<include name="**/*.xml"/>
</patternset>
<patternset id="pattern1">
<include name="**/*.xml"/>
</patternset>
<path id="path2">
<fileset dir="${basedir}" id="fileset1">
<patternset refid="pattern1"/>
</fileset>
<path refid="path12"/>
</path>
<path id="path3">
<fileset refid="fileset1"/>
</path>
<argument value="argument 0" id="arg0">
<argument refid="words"/>
</argument>
<argument id="arg1">
<argument value="argument 1" id="arg11"/>
<argument value="argument 2"/>
<argument line="'argument 31' 'argument 32'"/>
<argument refid="arg11"/>
<argument refid="path1"/>
</argument>
<argument id="arg2" refid="arg1"/>
<argument id="arg3" refid="path1"/>
<property name="prop1" refid="arg2"/>
<property name="prop2" refid="path1" separator=" "/>
<property name="prop3" refid="arg3"/>
<property name="prop4" refid="arg3" separator="${path.separator}"/>
<property name="prop5" refid="path2"/>
<property name="prop6" refid="path3"/>
<!-- =================================================================== -->
<!-- Testing -->
<!-- =================================================================== -->
<target name="test">
<echo message="prop1 = ${prop1}"/>
<echo message="prop2 = ${prop2}"/>
<echo message="prop3 = ${prop3}"/>
<echo message="prop4 = ${prop4}"/>
<echo message="prop5 = ${prop5}"/>
<echo message="prop6 = ${prop6}"/>
</target>
</project>
test1.log
Description: Binary data
