You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Sean Kelly <ke...@ad1440.net> on 2001/11/01 16:24:16 UTC

Nesting

Ant People:

(If this is something you've discussed already, forgive
my redundance.)

Something that's bugged me about Ant's <target> is the
depends attribute:

  <target name="all"
    depends="all.prep, all.build, all.archive">
    ...
  </target>
  <target name="all.prep">
    ...
  </target>
  <target name="all.build">
    ...

To me, that seems too awfully make-esque:

  all: all.prep all.build all.archive
  all.prep:
          ...
  all.build:
          ...

Editing, organizing, and debugging an Ant build.xml file
with lots of dependencies can get tricky.  How about
leveraging the fact that this is XML and elements nest:

  <target name="all">
    <target name="prep">
      ...
    </target>
    <target name="build">
      ...
    </target>
    <target name="archive">
      ...
    </target>
  </target>

Now, indentation can be used to tell where you are in
what.  Heck, you could even generate nested task names
(all.prep, all.prep.stamp, all.prep.dirs, ...) to allow
the developer to specify precise substeps to run, or to
have foreign depend attributes refer to internal
targets.  I'll leave the scoping issues to you.

(Just a thought.)

--
Sean Kelly
Independent Consultant




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>