You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Sam Hendley <sa...@oasysmobile.com> on 2007/02/14 19:42:09 UTC

Best Practices Using uptodate?

How do you all use <uptodate> in your build scripts? I am using it to
see if a build should be performed. I am getting the correct value in
the property specified by uptodate but I am having some trouble
determining the correct way to structure my build file to avoid using
antcall's. I have it working right now with the DoBuild target and
antcall but it irks me that I can't see the better way to do this (what
did people do before antcall?), that and I don't like the overhead of
using antcall. My first thought was to add the unless clause
(unless="noBuildNecessary") to the main Build target, but that obviously
doesn't work as the unless/if don't get evaluated until after the
depends targets have already run. So this seems to indicate that I need
to add the unless clause to all the other targets in the Build list so
they don't run at all. The problem there is I am already using unless
for some of those targets and it appears that I can't use a list of
properties in the unless clauses. The third way I thought to do this is
to use something like <fail> if no build is needed but this would be
reported to the caller (cruisecontrol) as a failure which wouldn't work.
Is there a <success> equivilant to fail as I could use that in the
UpdateAndCheck target and keep the rest of the targets clean of the
unless tags.
Thanks
Sam 


<target name="Build"
 
depends="GetConfiguration,GetSources,GetResources,CreateJadFile,Compile,
Obfuscate,UpdateJadFile,CheckFail,MakeSiblings"
/>
<target name="DoBuild" unless="noBuildNecessary">
	<antcall target="Build" />
</target>
<target name="UpdateAndCheck">
	<UpdateAllSVN />
	<GetUpToDate property="noBuildNecessary" />
	<echo message="noBuildNecessary? ${noBuildNecessary}" />
</target>
<target name="BuildIfNecessary"
        depends="GetConfiguration,UpdateAndCheck,DoBuild"
/>

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


Re: Best Practices Using uptodate?

Posted by Andrew Close <ac...@gmail.com>.
On 2/14/07, Sam Hendley <sa...@oasysmobile.com> wrote:
> How do you all use <uptodate> in your build scripts? I am using it to
> see if a build should be performed. I am getting the correct value in
> the property specified by uptodate but I am having some trouble
> determining the correct way to structure my build file to avoid using
> antcall's. I have it working right now with the DoBuild target and
> antcall but it irks me that I can't see the better way to do this (what
> did people do before antcall?), that and I don't like the overhead of
> using antcall. My first thought was to add the unless clause
> (unless="noBuildNecessary") to the main Build target, but that obviously
> doesn't work as the unless/if don't get evaluated until after the
> depends targets have already run. So this seems to indicate that I need
> to add the unless clause to all the other targets in the Build list so
> they don't run at all. The problem there is I am already using unless
> for some of those targets and it appears that I can't use a list of
> properties in the unless clauses. The third way I thought to do this is
> to use something like <fail> if no build is needed but this would be
> reported to the caller (cruisecontrol) as a failure which wouldn't work.
> Is there a <success> equivilant to fail as I could use that in the
> UpdateAndCheck target and keep the rest of the targets clean of the
> unless tags.
> Thanks
> Sam
>
>
> <target name="Build"
>
> depends="GetConfiguration,GetSources,GetResources,CreateJadFile,Compile,
> Obfuscate,UpdateJadFile,CheckFail,MakeSiblings"
> />
> <target name="DoBuild" unless="noBuildNecessary">
>         <antcall target="Build" />
> </target>
> <target name="UpdateAndCheck">
>         <UpdateAllSVN />
>         <GetUpToDate property="noBuildNecessary" />
>         <echo message="noBuildNecessary? ${noBuildNecessary}" />
> </target>
> <target name="BuildIfNecessary"
>         depends="GetConfiguration,UpdateAndCheck,DoBuild"
> />

i don't know that you need to use the 'uptodate' task if you're using
your build with CruiseControl.  CruiseControl is smart in that it only
performs a build if changes have occurred.  i'm not sure if it uses
the 'uptodate' task internally, or has some other mechanism.

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