You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by lo...@bnpparibas.com on 2002/11/28 09:58:07 UTC
javac task
Hello,
One thing I would like to know is the way the files to be compiled are
managed.
Explanations:
Take the following src directory structure:
src -+
+- org -+
+- foo -+- Foo.java
+- Foo2.java
Now if the Foo.java file has the package name: org.foo
and Foo2.java has no package name, then:
after the compilation, we'll have in a build directory:
build -+ Foo2.class
+- org -+
+- foo -+- Foo.class
Now, if I re run ant (same task), I'll get the Foo2.class compiled,
why? Can't the javac task manage a package check to perform
best file-set-compilation-dependencies?
Here is the command window output:
C:\Foo>ant -version
Apache Ant version 1.5.1 compiled on October 2 2002
C:\Foo>ant
Buildfile: build.xml
compile:
[mkdir] Created dir: C:\Foo\build
[javac] Compiling 2 source files to C:\Foo\build
[javac] C:\Foo\src\org\foo\Foo.java
[javac] C:\Foo\src\org\foo\Foo2.java
BUILD SUCCESSFUL
Total time: 3 seconds
C:\Foo>ant
Buildfile: build.xml
compile:
[javac] Compiling 1 source file to C:\Foo\build
[javac] C:\Foo\src\org\foo\Foo2.java
BUILD SUCCESSFUL
Total time: 3 seconds
and the archive contains all the files.
(See attached file: foo.zip)
Cheers,
Lo�c
This message and any attachments (the "message") is
intended solely for the addressees and is confidential.
If you receive this message in error, please delete it and
immediately notify the sender. Any use not in accord with
its purpose, any dissemination or disclosure, either whole
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message.
BNP PARIBAS (and its subsidiaries) shall (will) not
therefore be liable for the message if modified.
---------------------------------------------
Ce message et toutes les pieces jointes (ci-apres le
"message") sont etablis a l'intention exclusive de ses
destinataires et sont confidentiels. Si vous recevez ce
message par erreur, merci de le detruire et d'en avertir
immediatement l'expediteur. Toute utilisation de ce
message non conforme a sa destination, toute diffusion
ou toute publication, totale ou partielle, est interdite, sauf
autorisation expresse. L'internet ne permettant pas
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce
message, dans l'hypothese ou il aurait ete modifie.
Re: javac task
Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: <lo...@bnpparibas.com>
To: <an...@jakarta.apache.org>
Sent: Thursday, November 28, 2002 00:58
Subject: javac task
>Hello,
>One thing I would like to know is the way the files to be compiled are
>managed.
There is no way anyone would countenance fixing the dependency checking to
handle files that are in the wrong place according to the java lang rules.
The only thing we could possibly consider doing is have something look at
the source of every file and whenever a file is in the 'wrong' place, fail
the build with a 'hey, this file has the wrong package name' error. But that
would slow down every build and be a regression against those cases where
people had stuff in the wrong place and didnt care about rebuild issues.
But recompilation is only a fraction of the reason why it is wrong to have
stuff in the wrong place, and therefore not our problem to fix it,
>Take the following src directory structure:
>src -+- org - +- foo -+- Foo.java
> +- Foo2.java
>Now if the Foo.java file has the package name: org.foo
>and Foo2.java has no package name
then what happens if Foo.java goes:
import Foo2.java; ?
the underlying javac compiler knows about dir structure and demand compiles
dependency files if they are in the right place. But if they arent it doesnt
know what to do, and the compiler dies.
so: if you keep stuff out of place, it aint just ant's problem, and you do
need to fix it. sorry
-steve
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>