You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2008/01/28 22:50:11 UTC
DO NOT REPLY [Bug 44315] New: - if and unless don't work
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=44315>.
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=44315
Summary: if and unless don't work
Product: Ant
Version: 1.7.0RC1
Platform: All
OS/Version: Windows XP
Status: NEW
Severity: major
Priority: P2
Component: Core
AssignedTo: notifications@ant.apache.org
ReportedBy: dean_w_schulze@yahoo.com
Here's a build.xml file. I have two targets, only one of which should be
executed depending on whether the project is named "thin". The same target gets
executed regardless of what the project is:
<?xml version="1.0"?>
<project name="apps" default="all" basedir=".">
<property name="vendor.lib" value="${basedir}/../vendor/vendor-lib" />
<property name="common.lib" value="${basedir}/../components/common-lib" />
<property name="build.file" value="build.xml" />
<property name="thin" value="thin" />
<target name="all">
<antcall target="check-project">
<param name="project" value="${thin}" />
</antcall>
<antcall target="check-project">
<param name="project" value="not-thin" />
</antcall>
</target>
<target name="clean">
<antcall target="clean-project">
<param name="project" value="${thin}" />
</antcall>
</target>
<target name="check-project">
<echo message="CHECKING ${project}" />
<uptodate property="${project}.buildNotRequired"
targetfile="${project}/dist/${project}.jar">
<srcfiles dir="${project}/src" includes="**/*.java" />
</uptodate>
<antcall target="build-project">
<param name="project" value="${project}" />
</antcall>
</target>
<target name="build-project" unless="${project}.buildNotRequired">
<echo message="BUILDING ${project}" />
<echo message="thin = ${thin}, project = ${project}" />
<condition property="buildingThin">
<equals arg1="${thin}" arg2="${project}" />
</condition>
<echo message="buildingThin = ${buildingThin}" />
<antcall target="build-project-not-thin">
<param name="project" value="${project}" />
</antcall>
<antcall target="build-project-thin">
<param name="project" value="${project}" />
</antcall>
</target>
<target name="build-project-thin" if="${buildingThin}">
<echo message="Building thin" />
<!--
<ant antfile="${project}/${build.file}" target="ear" inheritall="false" >
<property name="vendor.lib" value="${vendor.lib}"/>
<property name="common.lib" value="${common.lib}"/>
</ant>
-->
</target>
<target name="build-project-not-thin" unless="${buildingThin}">
<echo message="Building not thin" />
<!--
<ant antfile="${project}/${build.file}" target="ear" inheritall="false" >
<property name="vendor.lib" value="${vendor.lib}"/>
<property name="common.lib" value="${common.lib}"/>
</ant>
-->
</target>
<target name="clean-project">
<echo message="CLEANING ${project}" />
<ant antfile="${project}/${build.file}" target="clean" inheritall="false" />
</target>
</project>
--
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.
DO NOT REPLY [Bug 44315] - if and unless don't work
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=44315>.
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=44315
------- Additional Comments From gudnabrsam@yahoo.com 2008-01-29 06:14 -------
This really is material for the userlist. However, if/unless are described at http://ant.apache.org/manual/using.html#targets . The examples there don't show ${} notation, and the
attributes are described as taking a property name. Feel free to suggest (on the developer list) any
additional wording you feel might make the matter clearer. Ordinarily, property substitution applies
everywhere else; i.e. I can't think of any other places where this dichotomy would trip you up.
--
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.
DO NOT REPLY [Bug 44315] - if and unless don't work
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=44315>.
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=44315
------- Additional Comments From dean_w_schulze@yahoo.com 2008-01-28 20:25 -------
Thanks for the pointer on using if / unless.
The normal way to use properties is throught the ${} notation so if / unless
expect a very different use of a property than elsehwere in Ant build files.
Are there other places where I should use property names without ${} notation?
Is the appropriate use of ${} notation covered in the docs anywhere?
There are other places in our build.xml files where others have written if /
unless attributes using ${} notation and we really need to understand how to use
it correctly.
--
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.
DO NOT REPLY [Bug 44315] - if and unless don't work
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=44315>.
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=44315
gudnabrsam@yahoo.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
------- Additional Comments From gudnabrsam@yahoo.com 2008-01-28 14:59 -------
You don't use ${} notation inside if/unless attribute values. These are expected to point to a property
name which, if set, satisfies the condition.
--
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.