ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jon Skeet" <>
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/"/>

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

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

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

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

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

<target name="label" depends="checkbaselevel">
  <antcall target="checkprops">
    <param name="base" value="${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)


View raw message