ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: resource enabling scriptdef
Date Fri, 27 Apr 2007 14:46:05 GMT
Matt Benson wrote:
> --- Steve Loughran <stevel@apache.org> wrote:
> 
>> I'm just prototypting resource support for
>> <scriptdef>, so it can load 
>> scripts off the classpath, etc...all the work goes
>> on in ScriptHelper
>>
>> One question. Should I resource enable a task by
>> adding support for 
>> ResourceCollections inst
>>
>> add(ResourceCollection rc)
>>
>> rather than simple resources
>>
>> add(ResourceCollection rc)
>>
>> Every resource is a ResourceCollection, after all,
>> and doing it this way 
>> lets me handle any specific collection in the list
>> of resources...
> 
> Right--and then you just document that the
> "collection" you receive should be of size 1?  Is that
> what you mean?  I realized when I made the decision
> that Resource would implement ResourceCollection that
> it was kind of a weird concept ("endlessly recursive
> composite"?), but my hope was that the ease in task
> authoring would justify it.

actually I've just set up <scriptdef> to take any number of resources. 
It used to just append text, so I've done the same with resources. You 
can mix script from referenced strings, remote properties or even inline 
string resources:

     <js >
       <string refid="script.code" />
       <propertyresource name="prop" />
       <string >
         project.setNewProperty("property2","live");
       </string>
     </js>


And of course the real use is <javaresource>, as scriptdef can now work 
off the classpath...which means you can use it in antlibs properly.

I've been having fun testing this stuff

1. the only way to get JS to work is to delete bsf-2.4.0.jar, otherwise 
I get an exception about a missing class. Rhino/BSF out of sync (as usual?)

2. so the tests only work on Java6 for me, maybe on other machines where 
BSF works right

3. but there is no (current) way to exclude bits of the test suite.

People without working BSF or JS will have failing tests until we add 
conditional patternsets to antunit.

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


Mime
View raw message