You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Tarun Garg <ta...@induslogic.com> on 2001/09/27 13:50:25 UTC

property

I have a big project with many subprojects in it.
I've written a build.xml for each subproject and one build.xml for the main
project.
A lot of these subprojects are dependent on each other.
Lets say I have subprojects A,B,C,D,E and F.
A is dependent on B and C.
B is dependent on D.
C is dependent on D and E.
D is dependent on E.
F is dependent on E.

Now I want that the individual build.xml files for each subproject should
completely build that subproject.
For that I've used <Ant> task.
So the compilation target of each build.xml depends on a target which calls
ant for all the other subprojects that need be there.
Now when I am writing the build.xml for the main project, I want to build
all the subprojects.
Here again I am using the <Ant> task.

The problem here is that ant calls the target again and again for a
subproject every time it comes in the dependency of another subproject. This
increases the build time considerably even when the subprojects are already
uptodate.
I tried to solve this problem by setting a property in every subproject and
checking it whenever it is called again. But I have now discovered that the
property set during one ant call does not carry forward to the other one.
How can I solve this problem ?




Re: property

Posted by Tarun Garg <ta...@induslogic.com>.
I did exactly the same thing too, for the subprojects.
Though it appears a bit odd that a target should call a target in the parent
file which again calls a target back in the same file, but it works. And is
pretty neat too.


----- Original Message -----
From: "Victor Hadianto" <vi...@nuix.com.au>
To: <an...@jakarta.apache.org>
Sent: Friday, September 28, 2001 4:51 AM
Subject: Re: property


>
> > and similarly other build files too.
> > But now I realise that your design is much neater.
> > (Its my first brush with ant or make system of any kind. Couldn't think
of
> > such a basic thing.)
> > Thanks for the tip.
> > It would certainly make things simpler.
> >
>
> Yupe I got similar problem as well and that is how I solved the problem.
> However the problem arise when I tried to compile from the sub-project, I
> then make the target on the subproject call the top most level. fe:
>
>
> <project name="main" basedir=".">
>    <target name="build-A" depends="build-B, build-C">
>      <ant antfile="dirA/build.xml" dir="dirA"/>
>    </target>
> </project>
>
> and in B:
> <project name="B" default="build" basedir=".">
>    <target name="build">
>      <ant antfile="../build.xml" target="build-B/>
>    </target>
> </project>
>
>
> I wonder what other people has done for similar thing.
>
> Regards,
> Victor
>


Re: property

Posted by Shyam Koppikar <vk...@tds.net>.
----- Original Message -----
From: "Victor Hadianto" <vi...@nuix.com.au>
To: <an...@jakarta.apache.org>
Sent: Thursday, September 27, 2001 4:21 PM
Subject: Re: property


>
> > and similarly other build files too.
> > But now I realise that your design is much neater.
> > (Its my first brush with ant or make system of any kind. Couldn't think
of
> > such a basic thing.)
> > Thanks for the tip.
> > It would certainly make things simpler.
> >
>
> Yupe I got similar problem as well and that is how I solved the problem.
> However the problem arise when I tried to compile from the sub-project, I
> then make the target on the subproject call the top most level. fe:
>
>
> <project name="main" basedir=".">
>    <target name="build-A" depends="build-B, build-C">
>      <ant antfile="dirA/build.xml" dir="dirA"/>
>    </target>
> </project>
>
> and in B:
> <project name="B" default="build" basedir=".">
>    <target name="build">
>      <ant antfile="../build.xml" target="build-B/>
>    </target>
> </project>
>
>
> I wonder what other people has done for similar thing.
>
> Regards,
> Victor


Re: property

Posted by Victor Hadianto <vi...@nuix.com.au>.
> and similarly other build files too.
> But now I realise that your design is much neater.
> (Its my first brush with ant or make system of any kind. Couldn't think of
> such a basic thing.)
> Thanks for the tip.
> It would certainly make things simpler.
>

Yupe I got similar problem as well and that is how I solved the problem. 
However the problem arise when I tried to compile from the sub-project, I 
then make the target on the subproject call the top most level. fe:


<project name="main" basedir=".">
   <target name="build-A" depends="build-B, build-C">
     <ant antfile="dirA/build.xml" dir="dirA"/>
   </target>
</project>

and in B:
<project name="B" default="build" basedir=".">
   <target name="build">
     <ant antfile="../build.xml" target="build-B/>
   </target>
</project>


I wonder what other people has done for similar thing.

Regards,
Victor

Re: property

Posted by Tarun Garg <ta...@induslogic.com>.
I had written the build files for the subprojects in a way, such that the
subproject build files had the dependency information in themselves.
Something like

(build.xml for A)

<target name="prepare">
    <ant antfile="../dirB/build.xml" dir="dirB"/>
    <ant antfile="../dirC/build.xml" dir="dirC"/>
</target>
<target name="compile" depends="prepare">
    <javac...../>
</target>

and similarly other build files too.
But now I realise that your design is much neater.
(Its my first brush with ant or make system of any kind. Couldn't think of
such a basic thing.)
Thanks for the tip.
It would certainly make things simpler.


----- Original Message -----
From: "Don Taylor" <do...@yahoo.com>
To: <an...@jakarta.apache.org>
Sent: Thursday, September 27, 2001 5:54 PM
Subject: Re: property


>
> --- Tarun Garg <ta...@induslogic.com> wrote:
> > I have a big project with many subprojects in it.
> > I've written a build.xml for each subproject and one build.xml for
> > the main
> > project.
> > A lot of these subprojects are dependent on each other.
> > Lets say I have subprojects A,B,C,D,E and F.
> > A is dependent on B and C.
> > B is dependent on D.
> > C is dependent on D and E.
> > D is dependent on E.
> > F is dependent on E.
> >
> > Now I want that the individual build.xml files for each subproject
> > should
> > completely build that subproject.
> > For that I've used <Ant> task.
> > So the compilation target of each build.xml depends on a target which
> > calls
> > ant for all the other subprojects that need be there.
> > Now when I am writing the build.xml for the main project, I want to
> > build
> > all the subprojects.
> > Here again I am using the <Ant> task.
> >
> > The problem here is that ant calls the target again and again for a
> > subproject every time it comes in the dependency of another
> > subproject. This
> > increases the build time considerably even when the subprojects are
> > already
> > uptodate.
> > I tried to solve this problem by setting a property in every
> > subproject and
> > checking it whenever it is called again. But I have now discovered
> > that the
> > property set during one ant call does not carry forward to the other
> > one.
> > How can I solve this problem ?
> >
> >
> >
> So are you saying that something like
>
> <project name="main" basedir=".">
>   <target name="A" depends="B,C">
>     <ant antfile="dirA/build.xml" dir="dirA"/>
>   </target>
>
>   <target name="B" depends="D">
>     <ant antfile="dirB/build.xml" dir="dirB"/>
>   </target>
>
>   <target name="C" depends="D,E">
>     <ant antfile="dirC/build.xml" dir="dirC"/>
>   </target>
>
>   <target name="D" depends="E">
>     <ant antfile="dirD/build.xml" dir="dirD"/>
>   </target>
>
>   <target name="E">
>     <ant antfile="dirE/build.xml" dir="dirE"/>
>   </target>
>
>   <target name="F" depends="E">
>     <ant antfile="dirF/build.xml" dir="dirF"/>
>   </target>
> </project>
>
> wouldn't work for you?
>
> -- Don
>
> __________________________________________________
> Do You Yahoo!?
> Listen to your Yahoo! Mail messages from any phone.
> http://phone.yahoo.com
>


Re: property

Posted by Don Taylor <do...@yahoo.com>.
--- Tarun Garg <ta...@induslogic.com> wrote:
> I have a big project with many subprojects in it.
> I've written a build.xml for each subproject and one build.xml for
> the main
> project.
> A lot of these subprojects are dependent on each other.
> Lets say I have subprojects A,B,C,D,E and F.
> A is dependent on B and C.
> B is dependent on D.
> C is dependent on D and E.
> D is dependent on E.
> F is dependent on E.
> 
> Now I want that the individual build.xml files for each subproject
> should
> completely build that subproject.
> For that I've used <Ant> task.
> So the compilation target of each build.xml depends on a target which
> calls
> ant for all the other subprojects that need be there.
> Now when I am writing the build.xml for the main project, I want to
> build
> all the subprojects.
> Here again I am using the <Ant> task.
> 
> The problem here is that ant calls the target again and again for a
> subproject every time it comes in the dependency of another
> subproject. This
> increases the build time considerably even when the subprojects are
> already
> uptodate.
> I tried to solve this problem by setting a property in every
> subproject and
> checking it whenever it is called again. But I have now discovered
> that the
> property set during one ant call does not carry forward to the other
> one.
> How can I solve this problem ?
> 
> 
> 
So are you saying that something like

<project name="main" basedir=".">
  <target name="A" depends="B,C">
    <ant antfile="dirA/build.xml" dir="dirA"/>
  </target>

  <target name="B" depends="D">
    <ant antfile="dirB/build.xml" dir="dirB"/>
  </target>
 
  <target name="C" depends="D,E">
    <ant antfile="dirC/build.xml" dir="dirC"/>
  </target>
 
  <target name="D" depends="E">
    <ant antfile="dirD/build.xml" dir="dirD"/>
  </target>

  <target name="E">
    <ant antfile="dirE/build.xml" dir="dirE"/>
  </target>

  <target name="F" depends="E">
    <ant antfile="dirF/build.xml" dir="dirF"/>
  </target>
</project>

wouldn't work for you? 

-- Don

__________________________________________________
Do You Yahoo!?
Listen to your Yahoo! Mail messages from any phone.
http://phone.yahoo.com