ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <dona...@mad.scientist.com>
Subject RE: Immutable Properties in 1.1?
Date Fri, 21 Jul 2000 00:55:22 GMT
At 03:24  20/7/00 -0700, you wrote:
>Can't we achive the same thing by just writing the following:
>
>build.xml:
>
><project name="xxx" basedir="." default="all-jars">
>  <target name="all-jars" depends="jar1,jar2"/>
>
>  <target name="jar1">
>   <ant dir="." target="jar" >
>     <property name="jar.arg1" value="jar1" />
>     <property name="jar.arg2" value="1" />
>   </ant>
>  </target>
>
>  <target name="jar2">
>   <ant dir="." target="jar" >
>     <property name="jar.arg1" value="jar2" />
>     <property name="jar.arg2" value="2" />
>   </ant>
>  </target>
>
>  <!-- his is the subrutine -->
>  <target name="jar">
>    <echo message="Running target ${jar.arg1}..."/>
>    <someJarTask jarfileToUse="jar${jar.arg2}.jar"
>                 includeList="**/someotherfiles-${jar.arg2}"/>
>  </target>
></project>
> 
>This is just calling ANT as a subroutine. And it works just fine.
>The trick being that you need to make certain that the properties used
>for parameters are not defined in the build.xml file outside of
>the ANT tasks.

I like it thout it should probably be made more explicit. Maybe make it 

<ant-call target="blah"> ??

Also could we change sub-element property to a different name as it gets
evaluated in current context aswell as being passed into new one.

>Doesn't this solve the problem people had?

Almost but the only way we *can* solve it is by becoming make which is not
a good thing :<. Make is good in that once you define a few rules you can
define makefiles really simply. A sample of one of my makefiles is

----------------------

include mk/constants.mak

###########################################################################
# Scripting Support library
###########################################################################

SCRIPT.TYPE          = exe
SCRIPT.NAME          = script
SCRIPT.DESCRIPTION   = Scripting Support library
SCRIPT.DEPEND        = scf xp debug
SCRIPT.DEFINES       = -DSCRIPTAPI=EXPORT
SCRIPT.SRC           = $(wildcard $(SRCDIR)/script/*.cpp )
SCRIPT.LIB.EXTRA     =

include mk/doMake.mak

---------------------

This level of simplity will never been available in ant. (Or at least I
hope not). You would still have to write out a bunch of targets etc.
However the difference is very few people could look at above Makefile and
understand what happens without very extensive knowledge of gmake. Almost
anyone can read an Ant file thou and get it going :P which is a very very
good thing. Ant is generally faster to - especially for java processes.





Cheers,

Pete

*------------------------------------------------------*
| "Nearly all men can stand adversity, but if you want |
| to test a man's character, give him power."          |
|       -Abraham Lincoln                               |
*------------------------------------------------------*

Mime
View raw message