Chris Miles | 4 Jul 15:48

RE: [groovy-dev] ant.inport from groovy?

Thanks Russel,

That seems pretty good - however it seems that the dependencies of
target init were not automatically processed.

In the file brought in init depends on -macrodef.
  <target name="init" depends="-macrodef, local.properties">

If I specify depends ( ['init'] ) I get 
  Could not create task or type of type: read.build.properties.
'read.build.properties' is a macrodef defined in target '-macrodef'.

If I specify
 depends ( ['-macrodef', 'init'] )
my job processes as required.

This seems a bit of a drawback.

Chris
-----Original Message-----
From: Russel Winder [mailto:russel.winder@...] 
Sent: 04 July 2008 12:48
To: dev@...
Subject: Re: [groovy-dev] ant.inport from groovy?

On Fri, 2008-07-04 at 12:35 +0100, Chris Miles wrote:
> Hi - I want to invoke a couple of Ant targets before running my gant
> stuff.
>  
> I can include my common ant stuff with
>   ant.'import' ( file : 'buildSWFcommon.xml' )
> but when I try
>  
> target ('try13' : '' ) {
>   depends ( 'init' )
>   // stuff using pre-defined properties and targets
>   ...
> }
> (init is defined in buildSWFcommon.xml) I get
>   Target `init' does not exist in this project.
>  
> Using -d to gant I find that gant is looking for init in build.xml -
> which is strange.
>  
> Can I invoke the buildSWFcommon.xml target 'init' ?

ant.'import' currently loads the XML file into the Ant project but this
does not make the target names available to the Gant framework -- it
should perhaps but currently it does not.  An as yet unpublished piece
of work I had in mind for Gant 1.5.0 was to much better integrate the
namespaces of the Ant project and the Gant framework.

Currently (Gant 1.2.0 and later if I remember correctly) there is a tool
AntFile which can be used to include an Ant XML file and which bridges
things so that the targets from the Ant file are Gant targets:

includeTool << gant.tools.AntFile
antFile.includeTargets ( 'ant/xml/file/path/as/string' )

You can use a list of strings as well to include multiple files.  Of
course using File objects should be allowed as well but I don't think
they are.   Seems like a good thing for a JIRA issue!
--

-- 
Russel.
====================================================
Dr Russel Winder                 Partner

Concertant LLP                   t: +44 20 7585 2200, +44 20 7193 9203
41 Buckmaster Road,              f: +44 8700 516 084
London SW11 1EN, UK.             m: +44 7770 465 077

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Gmane