ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francis GALIEGUE <...@one2team.com>
Subject Re: <target>s unless/if: strangeness in default behaviour (imho) (ant 1.6.5)
Date Mon, 31 Aug 2009 11:31:01 GMT
On Mon, Aug 31, 2009 at 13:19, Rebhan,
Gilbert<Gilbert.Rebhan@huk-coburg.de> wrote:
[...]
>
> f.e. =
>
> <target name="check_state">
>  <condition property="${mname}.done">
>    <available file="${ant.working.dir}/${mname}_script.params"/>
>  </condition>
> </target>
>
> <target name="build" depends="check_state" unless="${mname}.done">
> ...
>
>

Yes, but that's one usage scenario. My scenario is not this at all.

To be precise, I'd have liked to write:

<target name="coverage-gen-report"/>

<target name="coverage-mail-report" unless="nomail"/>

<target name="coverage-report" unless="nocoverage"
depends="coverage-gen-report, coverage-mail-report"/>

This way, if nomail was set, the coverage report would have been
generated but no mail would have been sent. And if nocoverage was
sent, nothing would have been done at all, since I believed that
nocoverage being sent meant that coverage-report wouldn't be executed
at all. But no.

What I had to write to accomplish what I wanted is:

<target name="coverage-gen-report" unless="nocoverage"/>

<target name="coverage-mail-report" depends="coverage-gen-report"
unless="nomail">
    <if>
        <not>
            <isset property="nocoverage"/>
        </not>
        <then>
            <!-- do the stuff -->
        </then>
    </if>
</target>

<target name="coverage-report" depends="coverage-gen-report,
coverage-mail-report"/>

Which is a lot more confusing. And I don't want to write an extra task
to check for the existence of the file I have to send via mail.

-- 

Francis Galiegue
ONE2TEAM
Ingénieur système
Mob : +33 (0) 683 877 875
Tel : +33 (0) 178 945 552
fge@one2team.com
40 avenue Raymond Poincaré
75116 Paris

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


Mime
View raw message