ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Condition Task Question
Date Fri, 18 Oct 2002 13:58:03 GMT
Or you get ant-contrib's new tasks (mostly working fine), and can do things
like (examples from production build files):

    <if>
      <istrue value="${verbose}" />
      <then>
        <echo message="Building ${ant.project.name}" />
        <echo message="      on ${env.COMPUTERNAME}" />
        <echo message="      at ${TIME_NOW} on ${TODAY}" />
        <echo message="    from ${basedir}" />
        <echo message="   using JDK ${java.vm.version}" />
      </then>
    </if>

or

    <!-- Set various properties according to the build mode -->
    <switch value="${buildmode}" caseinsensitive="true">
      <case value="debug">
        <property name="debug"         value="true" />
        <property name="configuration" value="Win32 Debug" />
        <property name="baseconfig"    value="shared.debug" />
      </case>
      <case value="release">
        <property name="debug"         value="false" />
        <property name="configuration" value="Win32 Release" />
        <property name="baseconfig"    value="shared" />
      </case>
      <default>
        <fail message="Invalid buildmode: ${buildmode}" />
      </default>
    </switch>

or

    <if>
      <not>
        <uptodate targetfile="${buildmagic.jar}">
          <srcfiles dir="${buildmagic.home}/src" includes="**/*.java" />
        </uptodate>
      </not>
      <then>
        <ant dir="${buildmagic.home}" target="jar" inheritAll="false" />
      </then>
    </if>
    <taskdef name="which" classname="com.lgc.buildmagic.Which"
             classpath="${buildmagic.jar}" />
    <taskdef name="subant" classname="com.lgc.buildmagic.SubAnt"
             classpath="${buildmagic.jar}" />
    <taskdef name="lsync" classname="com.lgc.buildmagic.LocalSynchronize"
             classpath="${buildmagic.jar}" />
    <property name="-buildmagic-defined" value="true" />

--DD

PS: There are things that do not work that well though... It's all a matter
of experimenting ;-) Note that <if>/<switch>/etc... are not officially
supported by the Ant team, nor recommended. Report any problems to the
ant-contrib team (on SourceForge), of which at least one Ant committer
belongs to, thankfully ;-).

-----Original Message-----
From: Justo Casablanca [mailto:jcasablanca@cfl.rr.com] 
Sent: Friday, October 18, 2002 8:29 AM
To: Ant Users List
Subject: Re: Condition Task Question

Are you sure that "every" target does ? I'm trying to use "unless" in the
<depend unless="my.property" .../> target, but I get this error:

build.xml:110: The <depend> task doesn't support the "unless" attribute.

----- Original Message -----
From: <Primoz.Prislan@marand.si>
To: "Ant Users List" <ant-user@jakarta.apache.org>
Sent: Friday, October 18, 2002 1:10 AM
Subject: Re: Condition Task Question


>
> Actually every ant <target> can have "if" or "unless" attribute. That
means
> that target will be executed only if property is (or is not) set.
>
> You can use it like this:
>
> <target .... if="blabla">
> ...
>
> Primoz.
>
>
>
>
>                     "Justo
>                     Casablanca"           To:     "Ant Users List"
<ant-user@jakarta.apache.org>
>                     <jcasablanca@c        cc:
>                     fl.rr.com>            Subject:     Condition Task
Question
>
>                     18.10.2002
>                     06:14
>                     Please respond
>                     to "Ant Users
>                     List"
>
>
>
>
>
>
> Hi all, I really like having a Condition task and all, but all it seems to
> allow you is
> the setting of a property to "true" if the condition is met. How do you
> actually _do_
> something based on the true/false value of the property ? Thx in advance
> !!!
>
>
>
>
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message