You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2005/01/14 22:15:49 UTC

DO NOT REPLY [Bug 33105] New: - Provide an if/unless optional attribute with all tasks

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=33105>.
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=33105

           Summary: Provide an if/unless optional attribute with all tasks
           Product: Ant
           Version: 1.6.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: ninju_bohra@yahoo.com


Hey guys (and gals) of the ANT community,

    First off, I love ANT (been using it since 1.4.2) and I find myself 
writing build files have a greater need for branching and conditional 
execution capabilities.  I like the ability to define an if(or unless) 
attribute to all targets to control their impact, but I am finding more and 
more often that I need fine grained control.  

    I am finding that I need to control the execution of specific tasks within 
a process target that I wrote.  Currently, I am having to pull those tasks out 
into seperate target(s) and do the if(or unless) check out there.  But this 
results in a large number of un-natural targets and the flow of the build 
target logic is muddled.

    I propose the addition of two optional attributes ('if' and 'unless') 
available to all tasks that control the calling of the .execute() function 
with the same semantics of the similarly named attributes of the <target> 
entity.

    The obvious (to me) place to put this new logic would be in the .perform() 
call of the Task class.  Below is an example of the pseudo-code:

    public final void perform() {
        if (!invalid) {
            // **** Pseudo-code begin
            if (if_condition_check_says_exit() ||
                unless_condition_check_says_exit()) {
               return;
            }
            // **** Pseudo-code ends
            getProject().fireTaskStarted(this);
            Throwable reason = null;
            try {
                maybeConfigure();
                execute();
            } catch (BuildException ex) {
              .
              .
              .
      }

    The implementation of the helper functions (if_condition_checks_says_exit
() and unless_condition_check_says_exit()) are trivial and would have the same 
semantics as the <target> process (and/or the <fail> task)

    I am not sure whether the if checks should occur before or after the 
getProject().fireTaskStarted(this) call and would leave it up to the community 
to decide where it would make most sense.

    I am making the change to our local version of ANT that we are using.  I 
have no experience in working on an open-source contribution and if it decided 
to promote my change into the build, I would need guidance on how to proceed.  
I work on a Windows XP environment.

    Awaiting your response,


    Ninju Bohra
    ninju_bohra@yahoo.com

-- 
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