ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Judy Sowell <jsow...@avolent.com>
Subject RE: Example of multi-directory build?
Date Tue, 27 Nov 2001 18:51:43 GMT
I think what you might need is to use "antcall" and "antfile". Here is a
snippet of a build.xml file which is at some top level, but has targets
which show there are build.xml files at sub directories. See the compile
target and the targets which it "calls".

<?xml version="1.0"?> 
<project name="MyTestProject" default="compile" basedir=".">

  <!-- set user properties -->
  <property file="${user.home}${file.separator}build.properties" />

  <!-- set global properties for this build -->
  <property name="src" value="." />
  <property name="build" value="${prj.build.dir}" />
  <property name="targetname" value="compile" />

  <target name="prepare">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}" />
  </target>

  <target name="compile" depends="prepare">
    <!-- Compile the java code from ${src} into ${build} -->
    <antcall target="platform"/>
    <antcall target="apps"/>
    <antcall target="tools"/>
  </target>

  <target name="platform">
    <!-- Compile the java code from platform into ${build} -->
    <ant antfile="${qa.regression.src}/platform/build.xml"
dir="${qa.regression.src}/platform" target="compile" />
  </target>

  <target name="apps">
    <!-- Compile the java code into ${build} -->
    <ant antfile="${qa.regression.src}/apps/build.xml"
dir="${qa.regression.src}/apps" target="compile" />
  </target>

  <target name="tools">
    <!-- Compile the java code into ${build} -->
    <ant antfile="${qa.regression.src}/tools/build.xml"
dir="${qa.regression.src}/tools" target="compile" />
  </target>

</project>
  

-----Original Message-----
From: Chris Bailey [mailto:chris@codeintensity.com]
Sent: Tuesday, November 27, 2001 9:36 AM
To: ant-user@jakarta.apache.org
Subject: Example of multi-directory build?


Recently there was a thread about where to look for example build files to
learn how best to structure your own.  I'm hoping to find a more specific
suggestion...  I am wanting to convert a system that uses make to use Ant.
Right now there are is a top level makefile which basically just lists all
the subdirectories (only one level), of which each contain a makefile.  The
top level file (actually a file it includes) contains all the rules (the
individual directory makefiles all include this rules file as well).

The deal is that I want to be able to build just one directory (as in cd
into that dir, and type make), or build the entire thing by building from
the top level.  All subdirectories have the same build process, just
different sets of source files.

So, I'm looking for an example of how best to do this with Ant.  I'm new to
Ant, so maybe this is trivial, but being able to see another example (and/or
have folks suggest approaches) would be helpful.  Thanks in advance...

____
Chris Bailey        mailto:chris@codeintensity.com
Code Intensity      http://www.codeintensity.com


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

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


Mime
View raw message