Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to have a fileset with multiple source directories?

Tags:

ant

I have some ant logic that looks like this:

<copy todir="src_@{version}" flatten="true">
    <fileset dir="${generic-libs.source}\prolo">
        <include name="**/*.c"/> <!-- all .c files including subfolders -->
        <include name="**/*.h"/> <!-- all .h files including subfolders -->
        <exclude name="**/test/*.*" /> <!-- exclude test (sub)folders -->
        <exclude name="**/test*.*" /> <!-- exclude remaining test sources -->
    </fileset>
    <fileset dir="${generic-libs.source}\genlo">
        <include name="**/*.c"/>
        <include name="**/*.h"/>
        <exclude name="**/test/*.*" />
        <exclude name="**/test*.*" />
    </fileset>
    <fileset dir="${generic-libs.source}\ptclo">
        <include name="**/*.c"/>
        <include name="**/*.h"/>
        <exclude name="**/test/*.*" />
        <exclude name="**/test*.*" />
    </fileset>
    ...
</copy>

The ... has 10 more identical constructs.

The contents of the fileset tag are always the same, so I guess there has to be a way to shorten this?

like image 725
Lieven Cardoen Avatar asked Nov 27 '25 05:11

Lieven Cardoen


1 Answers

Ant 1.9.4 introduced multirootfileset for that purpose :

A new resourcecollection type acts like a union of <fileset>s and <dirset>s that share the same configuration but have different base directories.

In your case something like :

<multirootfileset basedirs="${generic-libs.source}\prolo,${generic-libs.source}\genlo,${generic-libs.source}\ptclo">
 <include name="**/*.c"/>
 <include name="**/*.h"/>
 <exclude name="**/test/*.*"/>
 <exclude name="**/test*.*"/>
</multirootfileset>
like image 177
Rebse Avatar answered Nov 29 '25 21:11

Rebse



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!