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 2007/04/17 11:51:40 UTC

DO NOT REPLY [Bug 42143] New: - Boolean expressions in if and unless attributes

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

           Summary: Boolean expressions in if and unless attributes
           Product: Ant
           Version: 1.7.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Wrapper scripts
        AssignedTo: dev@ant.apache.org
        ReportedBy: svroemisse@servoy.com


I'd like to have the possiblity to use expressions in the if attribute - and
possibly the unless attribute as well, like so:

    <target name="jars" depends="compile_B,compile_A" if="plugins_changed and
(A_changed or B_changed)">
        ... do stuff ...
    </target>


Without, I have to do this:

    <target name="jars" depends="jars_A_changed,jars_B_changed">
	<!-- Fake target to get conditional dependencies working -->
    </target>

    <target name="jars_A_changed" if="A_changed">
	<antcall target="make_jars"/>
	<property name="jars_made" value="blah"/>
    </target>

    <target name="jars_B_changed" if="B_changed">
	<antcall target="make_jars"/>
	<property name="jars_made" value="blah"/>
    </target>

    <target name="make_jars" if="plugins_changed" unless="jars_made">
	make jars
    </target>

That's ugly and error-prone. It's something I don't want my successor to encounter.

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


DO NOT REPLY [Bug 42143] - Boolean expressions in if and unless attributes

Posted by bu...@apache.org.
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=42143>.
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=42143





------- Additional Comments From stevel@apache.org  2007-04-17 03:20 -------
There's lots of reasons why this is really hard, and its been asked for before,
but I wont close it as wontfix, as it a sign of pent up need. 

Can I point out that there is a much cleaner way to do this; use the condition
task to set a property containing all your tests, and depend on the result:

    
    <target name="check-rebuild-needed">
      <condition property="make-the-jars" >
       <or>
        <isset property="A_changed" />
        <isset property="B_changed" />
      </condition>
    </target>
    
    <target name="make_jars" depends="check-rebuild-needed" if="make-the-jars">
     ...
    </target>

This keeps the dependency graph in order, lets you declare complex conditions,
and is fairly easy to debug.

-steve


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


DO NOT REPLY [Bug 42143] - Boolean expressions in if and unless attributes

Posted by bu...@apache.org.
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=42143>.
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=42143





------- Additional Comments From svroemisse@servoy.com  2007-04-17 04:41 -------
Wow, you're fast :)

> Can I point out that there is a much cleaner way to do this; use the condition
> task to set a property containing all your tests, and depend on the result:

Thanks for pointing that out, it is indeed a whole lot cleaner.


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