ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: javac problems (Is there a better way?)
Date Tue, 17 Jul 2001 06:40:26 GMT
On Fri, 13 Jul 2001, Dani Zweig <dani@laminarsoft.com> wrote:

> a. I want to compile some of my classes with jdk1.2 and some with
> jdk1.3.  I can create two javac tasks, one setting build.compiler to
> "classic" and the second setting it to "modern".

Is this really enough for you?  Setting the build.compiler switch to
classic will make Ant use the "classic" compiler, but it will be the
one from the JDK you've used to start Ant - probably the classic
compiler of JDK 1.3.

You can get away with a single build file and antcall:

<target name="compile-1.2">
  your 1.2 javac task here
</target>

<target name="compile-1.3">
  your 1.3 javac task here
</target>

<target name="compile">
  <antcall target="compile-1.2">
    <param name="build.compiler" value="classic" />
  </antcall>
  <antcall target="compile-1.3">
    <param name="build.compiler" value="modern" />
  </antcall>
</target>

You can skip one of the two antcalls in favor of a depends attribute
if you know which setting of build.compiler will be the default.

If you really need two different JDKs, set the includeruntime and
includeantruntime attributes of <javac> to false and add tools.jar as
well as rt.jar of the required JDK to the classpath of that task
explicitly.

Your second point:

[src/foo/real-source-try and src/bar/real-source-tree - compile it
using having multiple <src> elements]

> However, this breaks down when we try to produce patterns that will
> identify **/*.java in foo and only a few files in bar without
> reverting to making 'src' the srcdir.  Is there a better way?

Probably not - maybe include-files can help here?

Stefan

Mime
View raw message