ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Holzwarth, Dominique (Berne Branch)" <Dominique.Holzwa...@ch.talaris.com>
Subject Invoke child build scripts from master build script
Date Tue, 08 Jun 2010 07:56:36 GMT
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


Mime
View raw message