ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dick, Brian E." <Brian.D...@FMR.com>
Subject RE: Ant dependencies task
Date Mon, 15 Aug 2005 14:07:51 GMT
Besides macrodef, you need to get familiar with import too.

-----Original Message-----
From: Frank W. Zammetti [mailto:fzlists@omnytex.com] 
Sent: Saturday, August 13, 2005 10:52 AM
To: Ant Users List
Subject: Re: Ant dependencies task


Hi again,

This did the trick, almost... there was one other piece to the puzzle...

I had to add inheritRefs="true" to all the targets I antcall'd.  So, my 
main build target looks like:

   <target name="build">
      <get_dependencies />
      <antcall target="compile" inheritRefs="true" />
      <antcall target="make_javadocs" inheritRefs="true" />
      <antcall target="checkstyle" inheritRefs="true" />
   </target>

...and the get_dependencies is now:

   <macrodef name="get_dependencies">
     <sequential>
       <typedef classpath="${basedir}/ant-dependencies.jar"
        resource="dependencies.properties" />
         <dependencies pathId="compiletime_classpath" verbose="true">
	      <dependency group="servletapi" version="2.3" />
	      <dependency group="checkstyle" version="3.4" />
	      <dependency group="antlr" version="2.7.5" />
	      <dependency group="regexp" version="1.3" />
         </dependencies>
     </sequential>
   </macrodef>

That works perfectly.  Thanks for the suggestion Brian, I appreciate 
very much, especially since I had never used macrodef before and I can't

imagine I would have thought of it on my own :)

Frank

Dick, Brian E. wrote:
> Another thing that may work is converting your get_dependencies target
> to a macrodef.
> 
> -----Original Message-----
> From: Dick, Brian E. 
> Sent: Friday, August 12, 2005 3:19 PM
> To: Ant Users List
> Subject: RE: Ant dependencies task
> 
> 
> You can recode
> 
> <target name="build"
> depends="get_dependencies,compile,make_javadocs,checkstyle,cleanup" />
> 
> as
> 
> <target name="build">
>    <antcall>
>       <target name="get_dependencies"/>
>       <target name="compile"/>
>       <target name="make_javadocs"/>
>       <target name="checkstyle"/>
>       <target name="cleanup"/>
>    </antcall>
> </target>
> 
> -----Original Message-----
> From: Frank W. Zammetti [mailto:fzlists@omnytex.com] 
> Sent: Friday, August 12, 2005 2:54 PM
> To: user@ant.apache.org
> Subject: Ant dependencies task
> 
> 
> Does anyone have any experience with this add-on?
> 
> http://www.httpunit.org/doc/dependencies.html
> 
> It works great for me, but one problem I have is that my build scripts
> usually have a single "build" target with a bunch of antcalls to other
> targets in it.  I have the following target which is executed first:
> 
> <target name="get_dependencies">
>   <typedef classpath="${basedir}/ant-dependencies.jar"
>    resource="dependencies.properties" />
>      <dependencies pathId="compiletime_classpath" verbose="true">
>      <dependency group="servletapi" version="2.3" />
>      <dependency group="checkstyle" version="3.4" />
>      <dependency group="antlr" version="2.7.5" />
>      <dependency group="regexp" version="1.3" />
>     </dependencies>
> </target>
> 
> However, the problem I'm encountering is that the
compiletime_classpath
> property is not available outside this target.  HOWEVER, if instead of
a
> series of antcalls I instead have my build target like so:
> 
> <target name="build"
> depends="get_dependencies,compile,make_javadocs,checkstyle,cleanup" />
> 
> Then it works, the property is available to all the other targets.  I
> have
> also tried having all the antcalls EXCEPT the one to get_dependencies
> and
> instead made that a depends entry for the build target, but that
didn't
> work either.
> 
> Anyone have any ideas?  There is obviously some subtle thing going on
> with
> properties and scoping or some such, but I don't know what it is.
FYI,
> the reason I'd prefer to do the antcalls is that I have like 15
targets
> that get called, and having a big comma-sepated lists in the depends
> attribute is kind of unwieldly.  Thanks!
> 

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


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

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


Mime
View raw message