ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Svetlin Stanchev <svet...@acm.org>
Subject Re: Invoking a target for multiple build-files?
Date Tue, 13 Jan 2004 16:17:47 GMT
If I understand you correctly, as a workaround/partial solution you can 
try making the modules dependent and use proxy targets in a masterbuild 
as described in chapter 9 of the Hatcher/Loughran book:

http://www.manning.com/hatcher/index.html

The idea goes as follows (we are using another implementation, so the 
code below is neither complete nor tested!):

<?xml version="1.0" encoding="UTF-8"?>
<project name="masterbuild" basedir=".">
	<target name="checkout">
		<antcall target="do-all">
			<param name="target" value="checkout"/>
		</antcall>
	</target>
	<target name="compile">
		<antcall target="do-all">
			<param name="target" value="compile"/>
		</antcall>
	</target>

	<!-- PROXY TARGETS -->
	<target name="do-module1">
		<ant dir="module1" target="${target}"/>
	</target>	
	<target name="do-module2">
		<ant dir="module2" target="${target}"/>
	</target>
	<target name="do-all" depends="do-module1, do-module2"/>
</project>

Then, call them on the command-line with:

ant compile

An alternative to making them dependent is to construct a list of them 
and use foreach (as already noted by somebody else).

Rgs,
-- 
Svetlin

Jörg Leuschke wrote:

> Hi,
> 
> I have a project directory containing several independent modules.
> Each module has its own build-file, but all build-files contain the
> same targets. Now I want to create an additional build-file, which
> invokes a certain target for all modules. I tried the new <subant>
> task and it works, but it does not exactly do what I intended.
> 
> With <subant> I always have to specify the target property, or ant
> will use the default-target of each build-file. I want ant to call every
> module build-file with the target I passed as argument on the
> command-line.
> 
> Is this somehow possible?
> 
> Best regards,
> Jörg Leuschke.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 



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


Mime
View raw message