You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2020/07/15 14:08:02 UTC

[Bug 64603] New: ScriptFilter has no way to reuse it

https://bz.apache.org/bugzilla/show_bug.cgi?id=64603

            Bug ID: 64603
           Summary: ScriptFilter has no way to reuse it
           Product: Ant
           Version: 1.10.8
          Hardware: PC
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Optional Tasks
          Assignee: notifications@ant.apache.org
          Reporter: robert.flaherty@oracle.com
  Target Milestone: ---

I see no way to reuse a ScriptFilter in various tasks.

- I thought a FilterSet might work, but it doesn't support nesting standard
filters.

- Possibly a new ScriptFilterDef would be needed, and maybe provide an "id",
then use a ScriptFilter with "refid" in say a copy task.

- Currently I'm trying to hack this by creating a ScriptDef with an attribute,
and do:
        var sText = String(attributes.get("input"));
        sText = "ScriptDef(" + sText + ")";
        project.setProperty("output", sText);
and in a ScriptFilter do:
        var sText = self.getToken();
        sText = "ScriptFilter(" + sText + ")";
        var oMinifyTask = project.createTask("minify");
        oMinifyTask.setDynamicAttribute("input", sText);
        oMinifyTask.perform();
        sText = project.getProperty("output");
        self.setToken(sText);
I saw no other way to pass back a value.  I'll try to use a Local to minimize
the scope.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64603] ScriptFilter has no way to reuse it

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64603

Robert Flaherty <ro...@oracle.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Robert Flaherty <ro...@oracle.com> ---
- One other idea is if FilterChain could support the id/refid combo.  I don't
know if FilterChains can be nested, but that may also be desirable.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64603] ScriptFilter has no way to reuse it

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64603

--- Comment #2 from Stefan Bodewig <bo...@apache.org> ---
I think <filterchain> can be defined once and reused via refid later. Doesn't
this work?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64603] ScriptFilter has no way to reuse it

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64603

--- Comment #4 from Stefan Bodewig <bo...@apache.org> ---
if you look at the actual implementations you'll see that refid by itself
doesn't do anything and that all implmentations of DataType contain custom code
to make it work. Pushing it down to ProjectComponent wouldn't change anything
as each implementation of ProjectComponent add support for it explicitly.

There isn't anything that would stop a task from implementing refid today - or
from extending DataType. Tasks don't need to extend Task, they don't even have
to be ProjectComponents. All that is required of a task is to have a no-arg
void execure method. Pure duck-typing :-)

As for the documentation there is a section of references in
https://ant.apache.org/manual/using.html#references but it is not
cross-references from all places where it could be. I'll try to improve that.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64603] ScriptFilter has no way to reuse it

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64603

--- Comment #3 from Robert Flaherty <ro...@oracle.com> ---
Well, the FilterChain worked.

Firstly, can this be turned into a doc bug for the "Manual" docs:
- The "FilterChains and FilterReaders" section has no grid of info for
FilterChain; I think "refid" is the only attribute.
- Looking at the JavaDocs, anything extending from DataType would support the
"refid", but that should be documented in the corresponding "Manual" docs.  I
don't see "refid" for FileList, FilterSet, PatternSet, etc...

Secondly, is it technically possible to push the Reference concept down from
DataType to ProjectComponent, where even tasks could leverage this?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64603] ScriptFilter has no way to reuse it

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64603

Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |1.10.9
             Status|NEW                         |RESOLVED
          Component|Optional Tasks              |Documentation

--- Comment #5 from Stefan Bodewig <bo...@apache.org> ---
https://github.com/apache/ant/commit/47a008ab33a1a3a1c5ce5492042d4cabc6aa1fa6

-- 
You are receiving this mail because:
You are the assignee for the bug.