You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Jose Alberto Fernandez <ja...@cellectivity.com> on 2004/01/02 03:48:19 UTC

RE: ScriptDef revisited

Peter, this sounds fantastic and really think something like this task should
be part of the standard distribution (optional tasks). Does the code
depends on ANT1.7 features? Or is it usable in 1.6?
 
Jose Alberto

	-----Original Message----- 
	From: Peter Reilly [mailto:peter.reilly@corvil.com] 
	Sent: Wed 31/12/2003 11:24 
	To: Ant Developers List 
	Cc: 
	Subject: Re: ScriptDef revisited
	
	

	You could try playing with beanshelldef
	http://marc.theaimsgroup.com/?l=ant-dev&m=106577547220771&w=2
	
	Peter
	
	Jose Alberto Fernandez wrote:
	
	>Hi,
	>
	>my current struggle with <script/> and beanshell, made me notice how
	>inefficient
	>or script task is (i.e., on every execution the script is recompiled,
	>and executed).
	>
	>Although there is no other way for <script/> it would be nice is
	><scriptdef/>
	>could do something more efficient. Currently <scriptdef/> will recompile
	>the
	>src on every invocation of the defined script.
	>
	>It would be nice if we could somehow cache the already parsed source,
	>and
	>being able to reexecute it multiple times with different element and
	>attribute
	>instances on each execution. So, to treat it a little more like compiled
	>code.
	>
	>The way I see it, such a script definition would specify an expression
	>entrypoint
	>that can be called over and over. Something like:
	>
	> <scripdef name="myscript" language="beanshell"
	>execute="executeScript()">
	>   <attribute name="att1"/>
	>   void executeScript() {
	>     print (attributes.get("att1"));
	>   }
	> </scriptdef>
	>
	>The execute attribute indicates the expression to be evaluated
	>on each <myscript/> instance, and it also indicates that it is safe
	>to keep the compiled source (i.e., bsf engine object around).
	>
	>Notice that it may not be thread-safe to do this since the engine
	>is statefull. hummmm
	>
	>So, what do people think?
	>
	>Jose Alberto
	>
	>
	>
	>
	>
	> 
	>
	>------------------------------------------------------------------------
	>
	>---------------------------------------------------------------------
	>To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
	>For additional commands, e-mail: dev-help@ant.apache.org
	>
	
	
	---------------------------------------------------------------------
	To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
	For additional commands, e-mail: dev-help@ant.apache.org
	
	


Re: ScriptDef revisited

Posted by Peter Reilly <pe...@corvil.com>.
I am just waiting for bsh 2.0 to be the official cvs version of beanshell.

It does not depend on ant 1.7 features and so can be used as is for ant 1.6.

Peter
Jose Alberto Fernandez wrote:

>Peter, this sounds fantastic and really think something like this task should
>be part of the standard distribution (optional tasks). Does the code
>depends on ANT1.7 features? Or is it usable in 1.6?
> 
>Jose Alberto
>
>	-----Original Message----- 
>	From: Peter Reilly [mailto:peter.reilly@corvil.com] 
>	Sent: Wed 31/12/2003 11:24 
>	To: Ant Developers List 
>	Cc: 
>	Subject: Re: ScriptDef revisited
>	
>	
>
>	You could try playing with beanshelldef
>	http://marc.theaimsgroup.com/?l=ant-dev&m=106577547220771&w=2
>	
>	Peter
>	
>	Jose Alberto Fernandez wrote:
>	
>	>Hi,
>	>
>	>my current struggle with <script/> and beanshell, made me notice how
>	>inefficient
>	>or script task is (i.e., on every execution the script is recompiled,
>	>and executed).
>	>
>	>Although there is no other way for <script/> it would be nice is
>	><scriptdef/>
>	>could do something more efficient. Currently <scriptdef/> will recompile
>	>the
>	>src on every invocation of the defined script.
>	>
>	>It would be nice if we could somehow cache the already parsed source,
>	>and
>	>being able to reexecute it multiple times with different element and
>	>attribute
>	>instances on each execution. So, to treat it a little more like compiled
>	>code.
>	>
>	>The way I see it, such a script definition would specify an expression
>	>entrypoint
>	>that can be called over and over. Something like:
>	>
>	> <scripdef name="myscript" language="beanshell"
>	>execute="executeScript()">
>	>   <attribute name="att1"/>
>	>   void executeScript() {
>	>     print (attributes.get("att1"));
>	>   }
>	> </scriptdef>
>	>
>	>The execute attribute indicates the expression to be evaluated
>	>on each <myscript/> instance, and it also indicates that it is safe
>	>to keep the compiled source (i.e., bsf engine object around).
>	>
>	>Notice that it may not be thread-safe to do this since the engine
>	>is statefull. hummmm
>	>
>	>So, what do people think?
>	>
>	>Jose Alberto
>	>
>	>
>	>
>	>
>	>
>	> 
>	>
>	>------------------------------------------------------------------------
>	>
>	>---------------------------------------------------------------------
>	>To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>	>For additional commands, e-mail: dev-help@ant.apache.org
>	>
>	
>	
>	---------------------------------------------------------------------
>	To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>	For additional commands, e-mail: dev-help@ant.apache.org
>	
>	
>
>  
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>For additional commands, e-mail: dev-help@ant.apache.org
>


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