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

           Summary: Add "if"/"unless" attributes to <import/>
           Product: Ant
           Version: 1.7.0
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: [EMAIL PROTECTED]


Idea:

Add target-like if/unless logic to imports. Such sentinels would allow for logic
similar to C/C++ header file inclusion, which could server as a
workaround/replacement for wanting to <import/> from within a target.

Benefits:
 * Backwards compatible
 * Familiar (since <imports/> occur at the <project/> level like <target/>s
 * Powerful. Much C/C++ build magic is based on this on principle

Example 1:


 <project>
   <import file="online.xml" unless="offline"/>
   <import file="offline.xml" if="offline"/>
   <target name="get-source">
      <getSource/> <!-- Macro in on- or offline.xml -->
   </target>
   <target name="build" depends="get-source">
     <!-- ... -->
   </target>
  </project>

$ ant -Doffline=yes build

Example 2:

A.xml:
  <project name="A">
    <import file="B.xml" unless="B.xml"/>
    <import file="C.xml" unless="C.xml"/>
  </project>

B.xml:
  <project name="B">
    <properties name="B.xml" value="true"/>
    <!-- overrides C.xml -->
    <properties name="C.xml" value="true"/>
    <macrodef name="Cmacro">
      <sequential><echo>B</echo></sequential>
    </macrodef>
  </project>

C.xml:
  <project name="C">
    <macrodef name="Cmacro">
      <sequential><echo>C</echo></sequential>
    </macrodef>
  </project>

Possibly related to:
 * scopes in build files (bug 23942)
 * conditions at the project level (bug 20093)

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to