Chris Miles | 4 Jul 13:31

[groovy-dev] ant.inport from groovy?

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' ?
 
Chris
 
 
Russel Winder | 4 Jul 13:48

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
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

Russel Winder | 4 Jul 20:21

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

Chris,

On Fri, 2008-07-04 at 14:48 +0100, Chris Miles wrote:
> Thanks Russel,
> 
> That seems pretty good - however it seems that the dependencies of
> target init were not automatically processed.

Indeed.  (And here was me hoping no-one would spot that :-)

This is caused by the lack of integration between Ant projects and Gant
scripts, the AntFile mechanism just gives access to the targets not to
the processing of the targets.  Getting this right deserves proper
thought and not a quick hack, hence my proposal for it being a Gant
1.5.0 thing.

> 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.

I agree, but for now a necessity I'm afraid.  If you fancy putting up a
JIRA for this, then there is no chance the problem will get forgotten.

--

-- 
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
Chris Miles | 29 Jul 11:48

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

Russel Winder wrote:
> Chris,
>
> On Fri, 2008-07-04 at 14:48 +0100, Chris Miles wrote:
>   
>> Thanks Russel,
>>
>> That seems pretty good - however it seems that the dependencies of
>> target init were not automatically processed.
>>     
>
> Indeed.  (And here was me hoping no-one would spot that :-)
>
> This is caused by the lack of integration between Ant projects and Gant
> scripts, the AntFile mechanism just gives access to the targets not to
> the processing of the targets.  Getting this right deserves proper
> thought and not a quick hack, hence my proposal for it being a Gant
> 1.5.0 thing.
>
>   
>> 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.
>>     
>
> I agree, but for now a necessity I'm afraid.  If you fancy putting up a
> JIRA for this, then there is no chance the problem will get forgotten.
>
>   
http://jira.codehaus.org/browse/GANT-52 The dependency map of ant tasks 
imported into gant should be honoured

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

    http://xircles.codehaus.org/manage_email

Russel Winder | 29 Jul 13:27

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

Chris,

On Tue, 2008-07-29 at 10:48 +0100, Chris Miles wrote:
>
> http://jira.codehaus.org/browse/GANT-52 The dependency map of ant tasks 
> imported into gant should be honoured

On Tue, 2008-07-29 at 10:27 +0100, Chris Miles wrote:
>
> http://jira.codehaus.org/browse/GANT-51 
> 
> Allow antFile.includeTargets to accept File objects or streams

Thanks for posting these.  I will start work on them tomorrow.  I
suspect this is going to be 1.4.1 release stuff rather than 1.5.0
release stuff.

--

-- 
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
Chris Miles | 29 Jul 11:27

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

Chris Miles wrote:
> 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!
>   
http://jira.codehaus.org/browse/GANT-51 

Allow antFile.includeTargets to accept File objects or streams

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

    http://xircles.codehaus.org/manage_email


Gmane