ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Toomey <toome...@yahoo.com>
Subject Re: "depends" gets executed before "if"
Date Fri, 01 Sep 2000 16:04:16 GMT
Yes, it is a little clumsy, but after thinking about it some more, I
think I understand why it was done that way. 
If and unless are used to check if a property has been set. Usually
properties are set during an "init" target. The init target would need
to run prior to the "if" check. 

Thanks,
Kevin.
--- Jesse Glick <Jesse.Glick@netbeans.com> wrote:
> Kevin Toomey wrote:
> > Given the build.xml statements below, I expected that my input and
> > output directories would get deleted only if the property cleanAll
> was
> > set. That's not the case. The "depends" targets get executed first,
> > then the "if" is checked. I can get around this easily enough, by
> > moving the "if" checks to the two delete_* tasks.
> > Am I missing something in thinking that "if" and "unless" should be
> > checked prior to performing depends"?
> 
> Well, they're not...they only apply to the target they are placed on,
> and I believe they are checked at runtime when that target is
> reached.
> The "depends" analysis is done statically before any targets are run.
> I
> can see how this would be considered confusing. Anyway, just add the
> if-test to the subtargets; or move the subtargets into the body of a
> conditional target, thus:
> 
> <target name="clean" depends="maybeCleanAll">
>   <!-- do light clean tasks -->
> </target>
> <target name="maybeCleanAll" if="cleanAll">
>   <ant dir="." target="reallyCleanAll"/>
> </target>
> <target name="reallyCleanAll"
> depends="delete_class_files,delete_source_files"/>
> 
> Clumsy and not very efficient but you can make it work.
> 
> -Jesse
> 
> -- 
> Jesse Glick   <mailto:Jesse.Glick@netbeans.com>
> NetBeans, Open APIs  <http://www.netbeans.org/>
> tel (+4202) 3300-9161 Sun Micro x49161 Praha CR


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

Mime
View raw message