ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Levy-Lambert <anto...@antbuild.com>
Subject AW: AW: AW: AW: two diff't JDKs
Date Tue, 28 Oct 2003 14:37:47 GMT
I have had had a first glance at the code.
I feel also that this issue is a bug, and this bug is almost certainly
affecting ant 1.6 which is not good.
Why it is not good is that ant 1.6 can only run under JDK >= 1.2 and that it
looks like you need to run ant 1.5.4 under JDK 1.1 to be able to compile JDK
1.1 source code.
Here is the routine which produces the log message which you noticed. The
javadoc worries me.
    /**
     * The implementation for this particular task.
     *
     * <p>Defaults to the build.compiler property but can be overridden
     * via the compiler and fork attributes.</p>
     *
     * <p>If fork has been set to true, the result will be extJavac
     * and not classic or java1.2 - no matter what the compiler
     * attribute looks like.</p>
     *
     * @see #getCompilerVersion
     *
     * @since Ant 1.5
     */
    public String getCompiler() {
        String compilerImpl = getCompilerVersion();
        if (fork) {
            if (isJdkCompiler(compilerImpl)) {
                if (facade.hasBeenSet()) {
                    log("Since fork is true, ignoring compiler setting.",
                        Project.MSG_WARN);
                }
                compilerImpl = "extJavac";
            } else {
                log("Since compiler setting isn't classic or modern,"
                    + "ignoring fork setting.", Project.MSG_WARN);
            }
        }
        return compilerImpl;
    }

JavacExternal.java, the external javac adapter invokes this :
        setupModernJavacCommandlineSwitches(cmd);
so it looks like it is not OK for javac 1.1

This might be fixed by creating a new compiler adapter for javac 1.1
external or by adding an attribute in the JavacExternal.java to tell it to
prepare a command line for javac 1.1.

Cheers,

Antoine


-----Ursprungliche Nachricht-----
Von: Erik Price [mailto:profkyne@yahoo.com]
Gesendet: Dienstag, 28. Oktober 2003 13:27
An: Ant Users List
Betreff: Re: AW: AW: AW: two diff't JDKs



--- Antoine_Levy-Lambert <antoine@antbuild.com> wrote:
> Hi Erik,
> I think that you need to use both the compiler !!!and!!! the
> executable
> attributes of <javac> in order to be able to compile properly with
> javac
> 1.1.
> The problem that you are experiencing is that ant is sending command
> line
> arguments to javac 1.1 in the 1.2 format which javac 1.1 does not
> understand.
> So do <javac executable="c:/jdk1.1/bin/javac.exe" compiler="classic"
> ...>
> and it should work fine for you.
> The executable attribute tells ant where physically the compiler
> lives.
> The compiler attribute tells ant how to talk to the compiler.


Antoine, that makes a lot of sense, since I do suspect that the 1.1
compiler is not being called correctly.  However, there is a problem --
apparently if you set fork="yes", it ignores the value of the
"compiler" attribute.  When I try it, I get a log message saying so,
and the same problem occurs.

So I tried removing the "fork" attribute (even though that doesn't make
sense since we need to fork in order to use an external compiler) just
in case there might have been a problem in the documentation/log
message.  Sure enough, it appears that the
DefaultCompilerAdapter.executeExternalCompile() method never gets
called.

This leads me to the following conclusions:

1. In order to use the 1.1 compiler, "fork" must be set to "yes" and
"compiler" must be set to "classic".
2. Setting "compiler" to "classic" is ignored if the "fork" attribute
is set to "yes".
3. Setting the fork attribute to "no" doesn't call the external
compiler (at least, it doesn't seem to call executeExternalCompile()
from DefaultCompilerAdapter, according to my experimentation with the
1.5.4 source).

It seems that this problem is a bug, and would not exist if setting
"fork" to "yes" did not cause the "compiler" attribute to be ignored.
Do you know why it is ignored?

Thanks for your help!


Erik

=====
--
Copyright.  Copy right.
The right to copy.  That's all it is.
Contrary to popular belief, there's no such thing as intellectual
"property".

__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

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



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


Mime
View raw message