ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 40908] New: - Updating ScriptRunner for bsf 2.4.0 plus some minor enhancements
Date Mon, 06 Nov 2006 12:42:58 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40908>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40908

           Summary: Updating ScriptRunner for bsf 2.4.0 plus some minor
                    enhancements
           Product: Ant
           Version: 1.7.0Beta3
          Platform: All
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Optional Tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: paulk@asert.com.au


The attached patch provides several changes/enhancements to ScriptRunner.

They fall into two kinds of change. The first are changes to improve the
functionality required by the script task and include:

+ remove explicit groovy registration - this hack is no longer required as
Groovy registration is built in to bsf 2.4.0 which is a dependency of
ant-apache-bsf.jar.

+ make use of FileUtils reader functionality - reduces code in ScriptRunner and
may prove superior for handling scripts with encoding (this is the approach
WebTest has used for the last 2-3 years without issues from its users)

+ minor reduction in duplication when binding to components

+ some additional refactoring to reduce method JavaNCSS and fix typos

The second kind are items which make ScriptRunner more functional as a support
class within the codebase. The functionality has existed within WebTest for
several years but it would be good to not have to repeat code from Ant in
WebTest. Here are the changes:

+ allow script variable to be cleared - this allows ScriptRunner objects to be
cached and re-used

+ support both evaluateScript() as well as executeScript() - this is very handy
for single line scripts which return a value and saves having to set an Ant
property to get something back (WebTest uses this to allow "script properties".
Properties with a prefixed namespace 'script:' are passed to evaluate, e.g.
${script:getProperty('user.home').reverse()} or
${script:getProperty(numFiles).toInteger()*getProperty(maxFileSize).toInteger()}

I believe the additional changes are low risk - this is just a helper object not
normally visible directly to Ant Scripts. Having the extra functionality
available will assist further integration between Ant and scripting languages
like Groovy, JRuby and Jython.

If the "fancy" additions are deemed not desirable, a workable minimum partial
step that would assist me is to make a protected reset() method that cleared the
script variable. At the moment, that variable is private and all public methods
only extend its value. This makes it difficult to minimise memory usage for
large scripts which perform a lot of scripting.

A slightly more elaborate workaround would be to make reset public or protected
and also refactor out the methods used by evaluate (as per the patch) and make
those methods protected. Of course, these two workarounds are not as ideal as
incorporating all of the patch.

I am happy to help with any further work required to get this across the line -
preferably for 1.7 (apart from additions, no publicly visible API changes are
required and no tasks are affected so I hope this is a possibility still).
The patch has javadoc comments. The existing tests for script need to be run.

Thanks, Paul.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message