Override fileset ref in ANT

1.1k views Asked by At

I have populated a fileset at the start of script as follows;

<!-- Define the list of projects to be built -->
<fileset id="ivy.buildlist.fileset" dir="${ivy.buildlist.dir}" includes="${ivy.buildlist.includes}" excludes="${ivy.buildlist.excludes}" />

But I want to update this ref if user select a particular task. For that I have written a new target with <intersect> which will be called but its not updating the reference;

<target name="getPreReleaseList" description="Target to override the component list for pre release" >
    <echo message="Existing List : ${toString:ivy.buildlist.fileset}" />
    <intersect>
        <fileset refid="ivy.buildlist.fileset" />
        <fileset dir="${ivy.buildlist.dir}" 
            includes="${ivy.pre.buildlist.includes}"
            excludes="${ivy.pre.buildlist.excludes}" />
    </intersect>
    <echo message="Updated List : ${toString:ivy.buildlist.fileset}" />
</target>

Before and after list in ivy.buildlist.fileset is same :(. Am I missing anything or do I have adapt a different approach.

1

There are 1 answers

0
VirtualTroll On

Your problem is due to the fact that ant properties are immutable.

In order to modify a property, you could either use the variable task or use a macrodef.

I suggest you take a look at the following question for more detail.