ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Using "if" in a target?
Date Sun, 17 Sep 2000 20:52:18 GMT
Am I using "if" correctly in this target:
  <target name="nsync" if="p4client">
    <exec executable="p4" dir="${workspace}">
      <arg value="sync -n ${spec}"/>
    </exec>
  </target>

I have another target that depends on nsync, which I assumed would mean
"If nsync doesn't get run (or if it runs but fails), don't run this one"
-- and I assumed if the property in the "if" in nsync wasn't set, then
nsync wouldn't get run. The target that depends on nsync is just a little
stubbed-off echo (for now):
  <target name="build" depends="nsync">
    <echo message="Running build target..."/>
  </target>

I explicitly unset the env var that the p4client property is passed in the
ant wrapper-script (ie., "$JAVACMD ... -Dp4client=$P4CLIENT ...") so that
the property wouldn't have a value. The output from the check_properties
target shows that p4client isn't set, as does the fact and type of the
error from the command that nsync went ahead and executed anyway:

[binky] ant check_properties build
Buildfile: build.xml
check_properties:
  p4client is:
nsync:
     [exec] Client 'binky' unknown - use 'client' command to create it.
     [exec] Result: 1
build:
  Running build target...

BUILD SUCCESSFUL
Total time: 2 seconds

Note that not only did nsync get run, even though the p4client property
isn't set, the <exec> in the nsync target resulted in 1, and still the
build target got run.

So am I just doing this all wrong -- or is ant not behaving as it should?
(I'm hoping it's the former -- then I can just correct whatever it is I'm
doing, and get past this.)

I'm running the nightly from 9/16. (But it behaves the same with the
nightly back from 9/9.)

Thanks,
Diane


=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/

Mime
View raw message