ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: compiling packages in an explicit order with javac
Date Fri, 21 Nov 2003 19:40:13 GMT
> From: Stirling, Scott [mailto:scott.stirling@workscape.com]
>
> It's amazing (to me) that more engineers aren't tuned into package design
> concerns and their importance.  It may be because it originates (I think)
> with Robert Martin's C++ Report articles which predate a lot of the Java
> folks I've worked with (it predates me too, but somehow I know about it
> and they don't). 

I myself sorely miss C++ report as well...

> Maybe that "compilewithwalls" task will help too, or you could emulate
> whatever it does.

You can emulate a simple <compilewithwalls> with Ant 1.6beta, by setting
sourcepath to "" explicitly. You do have to output to different directories
though, instead of a single build/classes dir:

    <macrodef name="compile">
      <attribute name="name" />
      <attribute name="fork" />
      <attribute name="srcpath" />

      <element name="javac-elements" />

      <sequential>
        <mkdir dir="build/classes/${name}" />
        <javac source="1.4" sourcepath=""
               destdir="build/classes/${name}"
               deprecation="false" debug="true" verbose="false"
               includeAntRuntime="false" fork="true"
memoryMaximumSize="512m">
          <src path="src/java" />

          <javac-elements />
        </javac>
      </sequential>
    </macrodef>

    <!-- A is stand-alone -->
    <compile name="a" fork="false">
      <javac-elements>
        <include name="com/acme/a/**"/>
        <classpath refid="classpath" />
      </javac-elements>
    </compile>

    <!-- B depends on A -->
    <compile name="b" fork="false">
      <javac-elements>
        <include name="com/acme/b/**"/>
        <classpath>
          <pathelement location="build/classes/a" />
          <path refid="classpath" />
        </classpath>
      </javac-elements>
    </compile>

    etc...

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


Mime
View raw message