Bug 36589 - You could enhance ant by "AOP" task,very useful in many place!!!
Summary: You could enhance ant by "AOP" task,very useful in many place!!!
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core (show other bugs)
Version: unspecified
Hardware: Other other
: P4 enhancement (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2005-09-10 03:49 UTC by dengchaoming
Modified: 2009-07-31 06:14 UTC (History)
0 users



Attachments
Source code for AOP task (60.54 KB, text/plain)
2005-09-13 02:30 UTC, dengchaoming
Details
Source code for AOP task (22.59 KB, text/plain)
2005-09-13 02:31 UTC, dengchaoming
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dengchaoming 2005-09-10 03:49:11 UTC
Suggest ant add "AOP" task to enhance it.By "AOP" task,You could enhance old 
ant task but need't modify old ant task code!
 
Such as,if you want to do some ant task many times,you have to write it many 
times.
But now if you use "AOP" task,you could write it once

<apply executable="ls">
  <aoploop>
     <list var="command expr="issql,sqlplus"/>
  </aoploop>
  <arg value="${command}"/>
</apply>

This is a simple example,<aoploop> is a "AOP" task,I could run apply twice by 
it,one is run "issql" command ,another is "sqlplus" command,but I need't modify 
the code of "apply" task.

I think this way is very useful in many place,if you  interest it I could send 
source code to you!
Comment 1 Matt Benson 2005-09-11 07:58:42 UTC
You can attach source to this bugrep if you want, but from your example above 
I, so far, have no idea what you're talking about.
Comment 2 Steve Loughran 2005-09-12 11:27:19 UTC
we dont yet use any "aspects" in ant, though there has been some thought in the
past to use attributes in different namespaces, eg ant:failonerror="true" to
control some parts of Ant's execution.

for the particular problem you cite -iterative execution, I would use the
Ant-contrib <for> and <foreach> commands, that explicitly do iteration
Comment 3 dengchaoming 2005-09-13 02:28:52 UTC
Thank you very much for your answer,I download Ant-contrib and read it just 
now.I think it's better than my "AOP" task

But I think this is another way that ant could become more powerful 
with "AOP",as this way could extend the function of old ant task but need't 
modify it's code.

Ant is a very useful tool for me,I wish I could do something for it,^_^  


I modify IntrospectionHelper.java and UnknownElement.java to support it

Such as: IntrospectionHelper.java 
private NestedCreator getNestedCreator(){
   ...

   //by dcming
   if(nc == null){
        nc = createAopTask(project,parentUri,parent,elementName,child);
   }
   
   ....
}

I paste source code,you could search "dcming",then could find modified
Comment 4 dengchaoming 2005-09-13 02:30:45 UTC
Created attachment 16384 [details]
Source code for AOP task
Comment 5 dengchaoming 2005-09-13 02:31:11 UTC
Created attachment 16385 [details]
Source code for AOP task
Comment 6 Matt Benson 2005-09-13 15:52:41 UTC
We are accustomed to (and much more appreciative of) code submissions made in
the form of unified diffs so we can quickly see what modifications have been made.