ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jon Skeet" <jon.sk...@peramon.com>
Subject Any way to use property values within an unless clause?
Date Tue, 12 Jun 2001 10:08:56 GMT
I've been trying to do something like the following:

<?xml version="1.0"?>
<project name="VSS Mobilizer Label" default="notarget" basedir="../..">

<property file="Build_And_Install/BuildProcedures/locations.map"/>

<target name="checkbaselevel" unless="bl">
  <fail message="No baselevel (bl) property set."/>
</target>

<target name="checkprops" unless="${base}.vss">
  <fail message="Required property ${base}.vss not set."/>
</target>

<target name="notarget">
  <fail message="There is no default target; please specify one"/>
</target>

<target name="all" depends="test"/>

<target name="test">
  <echo message="test.vss=${test.vss}"/>
  <antcall target="label">
    <param name="project" value="test"/>
  </antcall>
</target>

<target name="label" depends="checkbaselevel">
  <antcall target="checkprops">
    <param name="base" value="${project}"/>
  </antcall>
</target>

</project>

I realise it's a bit of a hack, but I was hoping it would work.
Unfortunately, it appears the unless part of checkprops doesn't resolve
${base} at an appropriate time for me - everything goes smoothly if I
change ${base}.vss to test.vss, but I'd hoped to just have the one task
for checking that properties were available.

Is there a better way to do this? I suppose I could write a task which
failed if the specified property wasn't set, but I'm surprised one
doesn't exist already...

(Obviously the above build file isn't complete in that it doesn't do
anything other than check for the appropriate properties, but it's
complete enough to show that that bit isn't working)

Jon

Mime
View raw message