jhm 2004/09/01 09:11:14 Modified: docs/manual/CoreTasks subant.html Log: Complex example Revision Changes Path 1.11 +68 -6 ant/docs/manual/CoreTasks/subant.html Index: subant.html =================================================================== RCS file: /home/cvs/ant/docs/manual/CoreTasks/subant.html,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- subant.html 12 Dec 2003 10:14:26 -0000 1.10 +++ subant.html 1 Sep 2004 16:11:14 -0000 1.11 @@ -1,4 +1,4 @@ - + @@ -114,9 +114,9 @@ Requirement - - - + + + @@ -410,6 +410,68 @@ setting the basedir to projects1, projects2, projects3

+ +

Now a little more complex - but useful - scenario. Assume that we have + a directory structure like this:

+
  +        root
  +          |  common.xml
  +          |  build.xml
  +          |
  +          +-- modules
  +                +-- modA
  +                |     +-- src
  +                +-- modB
  +                      +-- src
  +
  +        common.xml:
+ <project> + <property name="src.dir" value="src"/> + <property name="build.dir" value="build"/> + <property name="classes.dir" value="${build.dir}/classes"/> + + <target name="compile"> + <mkdir dir="${classes.dir}"/> + <javac srcdir="${src.dir}" destdir="${classes.dir}"/> + </target> + + <!-- more targets --> + </project> + + build.xml:
+ <project> + + <macrodef name="iterate"> + <attribute name="target"/> + <sequential> + <subant target="@{target}"> + <fileset dir="modules" includes="*/build.xml"/> + </subant> + </sequential> + </macrodef> + + + <target name="compile"> + <iterate target="compile"/> + </target> + + <!-- more targets --> + </project> + + modules/modA/build.xml:
+ <project name="modA"> + <import file="../../common.xml"/> + </project> +
+ +

This results in very small buildfiles in the modules, maintainable + buildfile (common.xml) and a clear project structure. Additionally + the root buildfile is capable to run the whole build over all + modules. +

+ + + @@ -429,7 +491,7 @@
- Copyright © 2000-2003, Apache Software Foundation + Copyright © 2000-2004, Apache Software Foundation
@@ -437,4 +499,4 @@ - + \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org