ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clifton C. Craig" <...@icsaward.com>
Subject Re: Including files in a dirset - mysterious SubAnt behaviour
Date Fri, 02 Jan 2004 20:45:06 GMT
Ok this is spooky. I have a build that calls several builds in it's sub 
directories via SubAnt. The sub-builds should run with their basedir set 
to the folder they are located in. If I call the main build directly 
from the command line all is fine. However, if I call the main build 
from another build (as part of an automated process) then all of the 
main build's sub build's basedirs are set to the basedir of the main 
build. I thought that using a dirset would rectify the problem but it 
doesn't. Can anyone help me figure out why the strange behaviour? A 
simplified example is as such:

automated-build.xml:
    <!-- this build is located in the ${project.base}/tools/scripts dir
    <target name="clean-build" depends="init">
        <ant dir="${project.base}" antfile="main-build.xml" target="default"
            output="${log.dir}\nightly-build.log"/>
    </target>

main-build.xml:
    <!-- this build is located in the ${project.base} dir defined 
elsewhere...
    <target name="default" depends="init">
        <subant inheritall="false" inheritrefs="true"
            failonerror="${fail.on.error}">
             <!-- ${project.src} is the src folder under ${project.base} 
or ${project.base}/src -->
            <dirset dir="${project.src}" includes="/**">
                <!-- includes.selector is a custom selector that 
includes only folders that contain build.xml -->
                <selector refid="includes.selector"/>
            </dirset>
            <propertyset>
                <propertyref regex=".*"/>
            </propertyset>
        </subant>
    </target>

If I run main-build.xml from the command-line all build.xmls selected by 
subant run with their basedir set to their contained folder. However, 
when I run automated-build.xml all of the build.xmls under 
${project.src} run with their basedir set to ${project.base} which is 
the basedir of main-build.xml. (This, of course causes them to crash 
since they all use paths relative to their basedir.) What's the deal?



Earlier I wrote:

> How does a dirset act when one of its patternsets includes a file?  
> What I'm looking for is a way to include all sub-directories of a 
> given directory that contain build.xml so I can pass it off to SubAnt. 
> I was originally using a fileset but it caused a tricky error where 
> the basedir of the build file was being set to the basedir of the 
> calling target. I want the basedir of the build xmls to be set to the 
> folder they are found in. I was thinking that I could change my 
> fileset to a dirset which should implicitly set the basedir of all 
> located build xmls to the folder they located in. However I don't see 
> a straight foward way to do this with a dirset. I have a custom 
> selector that I could use but I was wondering if there was a pattern 
> expression that would be work as well. For example, if I use <include 
> name="**/build..xml"> in a dirset would this give me a set of all sub 
> folders that have build.xml or would it give me an error or what?
>
> Cliff
>
> Clifton C. Craig, Software Engineer
> Intelligent Computer Systems -  A Division of GBG
> 2101 Embassy Drive
> Lancaster, PA  17603
>
> Phone:  717-295-7977 ext. 621
> Fax:  717-295-7683
> ccc@icsaward.com
> ccraig@globalbeveragegroup.com
>
> **************************************************************************** 
>
> Mark the dates: February 22-25, 2004 at the Aladdin Hotel & Casino in Las
> Vegas, NV.
> GBG is pleased to announce the premier event for sales and distribution
> software solutions for soft drink, beer, water, snack, candy & tobacco
> organizations - Encounter 2004: GBG's 2nd Annual User Conference!
> Register by December 15th and receive early bird rates:
> http://www.globalbeveragegroup.com/postings/user_conf_2004_announcement.htm 
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>
>
> Clifton C. Craig, Software Engineer
> Intelligent Computer Systems -  A Division of GBG
> 2101 Embassy Drive
> Lancaster, PA  17603
>
> Phone:  717-295-7977 ext. 621
> Fax:  717-295-7683
> ccc@icsaward.com
> ccraig@globalbeveragegroup.com
>
> ****************************************************************************
> Mark the dates: February 22-25, 2004 at the Aladdin Hotel & Casino in Las
> Vegas, NV.
> GBG is pleased to announce the premier event for sales and distribution
> software solutions for soft drink, beer, water, snack, candy & tobacco
> organizations - Encounter 2004: GBG's 2nd Annual User Conference!
> Register by December 15th and receive early bird rates:
> http://www.globalbeveragegroup.com/postings/user_conf_2004_announcement.htm
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message