You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Holzwarth, Dominique (Berne Branch)" <Do...@ch.talaris.com> on 2010/06/08 09:56:36 UTC

Invoke child build scripts from master build script

Hi all

I have the following source structure:

-products
        |--productA
                |--build.xml
-modules
        |--moduleA
                |--build.xml
        |--moduleB
                |--build.xml
        |--moduleC
                |--build.xml

The purpose of the build.xml inside the folder "productA" a is to configure which modules belong to a certain product (there could be a productB with another configuration of modules). The productA/build.xml should iterate over the modules/moduleX/build.xml files and execute their tasks.

I've read the doc about the <subant> task but I'm failing to get it work...

My master build.xml (the one in product/productA) looks like this:

<project>
        <macrodef name="iterate" >
                <attribute name="target"/>
                <sequential>
                        <subant target="@{target}" genericantfile="build.xml" >
                                <fileset dir="/path/to/modules" includes="*/build.xml"/>
                        </subant>
                </sequential>
        </macrodef>

        <target name="compile">
                <iterate target="compile" />
        </target>
</project>

Since most of the modules are compiled in the same way, I have created a common.xml which defines common tasks:

<project>
      <target name="compile" description="compile the sources" >
                <terp.cpp       compiler="^gcc(^file('/opt/omap-evm/toolchain/bin/arm-none-linux-gnueabi-gcc'))"
                        targetDir="${buildvariant}"
                                tempDir="obj"
                        depends="true">
                        <!-- more stuff here -->
                </terp.cpp>
        </target>
</project>

A specific build.xml of a module looks like:

<project name="moduleA" basedir=".">
        <property name="artifact-type" value="archive" />
        <import file="path/to/common.xml" />
</project>

My problem is:
The sources of the modules (I'm testing it for 1 module) are compiled, however, the base directory seems to be the one where the master script (products/productA/build.xml) is stored. Due to that fact, relative paths such as tempDir="obj" are created at the wrong location!

Is there any way to _CHANGE_ the working directory when invoking the moduleX/build.xml scripts?? I've played around with 'genericantfile' and 'antfile' attributes but had no success :-/

Any help is highly appreciated!
Thx,
Dominique

Dominique Holzwarth | Talaris
Software Engineer
Talaris Limited, London (GB), Berne Branch, Meriedweg 11, CH-3172 Niederwangen, Switzerland

T +41 (0) 31 980 42 65
dominique.holzwarth@ch.talaris.com

Wherever Money Moves - www.talaris.com
P  Please consider the environment before printing this email


*****************************************************************************
This e-mail and any files attached are strictly confidential, may be legally
privileged and are intended solely for the addressee. If you are not the
intended recipient please notify the sender immediately by return email and
then delete the e-mail and any attachments immediately.

The views and or opinions expressed in this e-mail are not necessarily the
views of Talaris Holdings Limited or any of its subsidiaries and the Talaris
Group of companies, their directors, officers and employees make no
representation about and accept no liability for its accuracy or
completeness.

You should ensure that you have adequate virus protection as the Talaris
Group of companies do not accept liability for any viruses.

Talaris Holdings Limited Registered No. 6569609 and Talaris Limited
Registered No 6569621 are both registered in England with their registered
office at:
Talaris House, Crockford Lane, Chineham Business Park, Basingstoke, RG24 8QZ
*****************************************************************************


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


RE: Invoke child build scripts from master build script

Posted by "Holzwarth, Dominique (Berne Branch)" <Do...@ch.talaris.com>.
Actually I managed now to solve the issue with relative paths. That is, if I put ${basedir}/ infront (which is an absolute path I guess) then the temp directories are created at the correct location... So I guess it might be an issue with the terp.cpp task...

> -----Original Message-----
> From: Michael Ludwig [mailto:milu71@gmx.de]
> Sent: Dienstag, 8. Juni 2010 14:51
> To: Ant Users List
> Subject: Re: Invoke child build scripts from master build script
>
> Holzwarth, Dominique (Berne Branch) schrieb am 08.06.2010 um
> 08:56 (+0100):
>
> > -products
> >         |--productA
> >                 |--build.xml
> > -modules
> >         |--moduleA
> >                 |--build.xml
> >         |--moduleB
> >                 |--build.xml
> >         |--moduleC
> >                 |--build.xml
> >
> > The purpose of the build.xml inside the folder "productA" a is to
> > configure which modules belong to a certain product (there
> could be a
> > productB with another configuration of modules). The
> > productA/build.xml should iterate over the
> modules/moduleX/build.xml
> > files and execute their tasks.
>
> > My problem is:
> > The sources of the modules (I'm testing it for 1 module)
> are compiled,
> > however, the base directory seems to be the one where the master
> > script (products/productA/build.xml) is stored. Due to that fact,
> > relative paths such as tempDir="obj" are created at the wrong
> > location!
>
> Would rearranging the build files solve the problem? What
> about moving productA/build.xml two levels up to the
> directory containing products/ and modules/, and creating
> targets called "productA", "productB", etc?
>
> --
> Michael Ludwig
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For
> additional commands, e-mail: user-help@ant.apache.org
>
>
>

*****************************************************************************
This e-mail and any files attached are strictly confidential, may be legally
privileged and are intended solely for the addressee. If you are not the
intended recipient please notify the sender immediately by return email and
then delete the e-mail and any attachments immediately.

The views and or opinions expressed in this e-mail are not necessarily the
views of Talaris Holdings Limited or any of its subsidiaries and the Talaris
Group of companies, their directors, officers and employees make no
representation about and accept no liability for its accuracy or
completeness.

You should ensure that you have adequate virus protection as the Talaris
Group of companies do not accept liability for any viruses.

Talaris Holdings Limited Registered No. 6569609 and Talaris Limited
Registered No 6569621 are both registered in England with their registered
office at:
Talaris House, Crockford Lane, Chineham Business Park, Basingstoke, RG24 8QZ
*****************************************************************************


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


Re: Invoke child build scripts from master build script

Posted by Michael Ludwig <mi...@gmx.de>.
Holzwarth, Dominique (Berne Branch) schrieb am 08.06.2010 um 08:56 (+0100):

> -products
>         |--productA
>                 |--build.xml
> -modules
>         |--moduleA
>                 |--build.xml
>         |--moduleB
>                 |--build.xml
>         |--moduleC
>                 |--build.xml
> 
> The purpose of the build.xml inside the folder "productA" a is
> to configure which modules belong to a certain product (there
> could be a productB with another configuration of modules). The
> productA/build.xml should iterate over the modules/moduleX/build.xml
> files and execute their tasks.

> My problem is:
> The sources of the modules (I'm testing it for 1 module) are
> compiled, however, the base directory seems to be the one where the
> master script (products/productA/build.xml) is stored. Due to that
> fact, relative paths such as tempDir="obj" are created at the wrong
> location!

Would rearranging the build files solve the problem? What about moving
productA/build.xml two levels up to the directory containing products/
and modules/, and creating targets called "productA", "productB", etc?

-- 
Michael Ludwig

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