ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 49776] New: Enable conditional dependencies
Date Wed, 18 Aug 2010 15:32:48 GMT

           Summary: Enable conditional dependencies
           Product: Ant
           Version: 1.8.1
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Core

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

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

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


      F   G
       \ / \
        D   E
         \ /

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


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

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="" execdepends="A"/>
    <target name="T-by-B" unless="" 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:
------- You are receiving this mail because: -------
You are the assignee for the bug.

View raw message