ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 49776] New: Enable conditional dependencies
Date Wed, 18 Aug 2010 15:32:48 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=49776

           Summary: Enable conditional dependencies
           Product: Ant
           Version: 1.8.1
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Core
        AssignedTo: notifications@ant.apache.org
        ReportedBy: info_issues.apache.org@nmhq.net


Add an attribute "execdepends" to Target. Targets listed in execdepends are
dependencies that -- as far as the current target is concerned -- are only
executed if the current target is executed, i.e. if the current target hasn't
been disabled via if/unless.

The resulting operational order for a given target would be:
1) execute "depends" targets
2) evaluate if/unless
3) execute "execdepends" targets
4) execute target body
Where the 3 and 4 are skipped if 2 determines that the target is disabled.

This feature would enable conditional dependencies as for example described in
http://mail-archives.apache.org/mod_mbox/ant-user/201008.mbox/%3c20100817223510.GC15983@nmhq.net%3e.

More generally: Sometimes there are multiple ways to achieve a particular state
(= target), where the one to pursue depends on the presence of certain inputs
or settings, or some other condition. By "multiple ways", we mean based on
inputs from different sources, i.e. different dependee targets. Consider the
following dependency graph for example (dependencies go upwards):

      F   G
     / \ / \
    C   D   E
     \ / \ /
      A   B
       \v/
        T

Indicated by the "v", target T can be achieved by either A _or_ B. Depending on
some condition, we would want to execute either

      F   G
     / \ /  
    C   D    
     \ /    
      A    
       \  
        T

or

      F   G
       \ / \
        D   E
         \ /
          B
         /
        T

but not both. And (as an additional example) if we execute an additional target
S that depends on T and E, we would want to have either

      F   G
     / \ / \
    C   D   E
     \ /    |
      A     |
       \    |
        T   |
         \ /
          S

or

      F   G
       \ / \
        D   E
         \ /|
          B |
         /  |
        T   |
         \ /
          S

but again not both.

This is currently not possible with Ant, other than by complicated, redundant
and hard-to-maintain instrumentation of all targets with additional
ifs/unless', possibly having to AND/OR with existing ifs/unless'.

With execdefault, one could simply define

    <target name="T-by-A" if="t.by.a" execdepends="A"/>
    <target name="T-by-B" unless="t.by.a" execdepends="B"/>
    <target name="T" depends"T-by-A, T-by-B"/>

and would not have to touch the definitions of A-G (and of S).

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

Mime
View raw message