> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>
> I thought for myself to create a <scriptselector> where you simply
> implement the isSelected() method.
>
> Base should be the BaseExtendSelector and the script gets
> basedir, filename and file (the arguments of isSelected()) as
> populated variables.
>
> <fileset>
> <scriptselector language="javascript">
> return file.canWrite();
> </scriptselector>
> </fileset>
I agree with Jan. I don't want to have build script littered with code.
<script>+BeanSehll power is awesome, but it's too verbose for my build.xml.
I would see a <script>-based selector extending DynamicConfigurator so I
can specify configuration arguments directory in the <script> tag, and
simply two nested tags, one optional for one time initialization, the other
required with the isSelected method.
To take Peter's example, I would envision:
<fileset dir=".">
<scriptselector language="beanshell" pattern="^.*reg.*$">
<init>
_pattern = java.util.Pattern.compile(pattern);
_matcher = _pattern.matcher("");
</init>
<isselected>
return _matcher.reset(new java.io.File(filename).name).matches();
<isselected>
</scriptselector>
</fileset>
Or less performant, but less code:
<fileset dir=".">
<scriptselector language="beanshell" pattern="^.*reg.*$">
<isselected>
return new java.io.File(filename).name.matches(pattern);
<isselected>
</scriptselector>
</fileset>
isselected automatically gets the basedir/filename/file names bound to the
method argument, and must be documented as such.
But I may be off base here ;-) --DD
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]