ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Murdoch" <adammurd...@yahoo.com>
Subject RE: What about dependecies?
Date Fri, 29 Sep 2000 13:01:40 GMT

Hi,

As far as jikes is concerned, if you give it a class A on the command line,
it will compile that source file and (optionally) all the classes that class
A depends on.  It will not, however, hunt down classes that are dependent on
class A and compile them.

So, if you have a class B that depends on class A (e.g. B implements A, or B
extends A, or B.method() throws A, etc) and you change class A, you still
have to name class B on the jikes command line.  Unfortunately, ant won't
let you do this unless B itself has changed. Or you've fooled ant into
getting the package structure wrong.

AFAIK this behaviour is pretty much how all java compilers behave (just with
differing degrees of accuracy in figuring out which the classes that A is
dependent on).  If there's a compiler out there that can travel back up the
dependency graph, please let me know!

So what options are there for dealing with this?  If your project is fairly
small, use jikes as your compiler and set up your javac task so that the
source directory structure does not match the package heirarchy.  For
example. rather than

<javac srcdir="src" ... />

use

<javac srcdir="src/com/foo" ... />

This way ant will attempt to compile everything every time, and jikes is
fast.  Really fast.

Alternatively, setup your javac task correctly and use a 'clean' target to
force a rebuild when changing core interfaces and base classes.

Unfortunately, there's no real good way for ant to solve this problem
without parsing all the Java source files, and then traversing the
dependency graph to figure out the set of files to hand off to the compiler.
You'd be hard pressed to build this in Java and have it end up being faster
than just recompiling everything from scratch with jikes or jvc.


Adam


-----Original Message-----
From: Carlos Quiroz [mailto:carlos.quiroz@rtse.com]
Sent: Friday, 29 September 2000 8:40 PM
To: 'ant-user@jakarta.apache.org'
Subject: RE: What about dependecies?


Ok, here it goes. I just change interface agian without changing
implementors

and ant -verbose is:

Ant version 1.2alpha3 compiled on September 27 2000

Searching for build.xml ...
Searching in D:\Projects\AIS\code
Buildfile: D:\Projects\AIS\code\build.xml
Detected Java Version: 1.3
Detected OS: Windows 2000
Project base dir set to: D:\Projects\AIS\code
Build sequence for target `main' is [prepare, compile, main]
Complete build sequence is [prepare, compile, main, clean, total-clean,
client, jarfile, deploy, backup]
    [javac] Compiling 2 source files to D:\Projects\AIS\code\build
    [javac] Using jikes compiler
    [javac] Compilation args: jikes -deprecation -d
D:\Projects\AIS\code\build -classpath
"D:\Projects\AIS\code\build;D:\Projects\AIS\code;D:\Projects\AIS\code\lib\ma
rket;D:\Projects\AIS\code\lib\gnu-classes.jar;D:\Projects\AIS\code\lib\feeds
haper.message.jar;D:\Projects\AIS\code\lib\fi.cgs.util.jar;D:\Java\jars\jaxp
.jar;D:\Java\jars\parser.jar;D:\Java\jakarta-tomcat\lib\servlet.jar;D:\Java\
jars;D:\Java\jars\xml4j.jar;D:\Java\jars\xerces.jar;D:\Java\jars\JMF2.1\lib\
jmf.jar;D:\Java\jars\Jindent.jar;D:\Java\jmk\jmk.jar;D:\Java\jakarta-ant\lib
\ant.jar;D:\Java\jakarta-ant\lib\jaxp.jar;D:\Java\jakarta-ant\lib\parser.jar
;D:\Java\jdk1.2.2\lib\tools.jar;C:\Program
Files\JavaSoft\JRE\1.3\lib\rt.jar;D:\Projects\AIS\code\src" -g -depend +F
    [javac] Files to be compiled:
    D:\Projects\AIS\code\src\com\rtse\ais\interfaces\FeedConnection.java
    D:\Projects\AIS\code\src\fi\cgs\widget\table\TableRowTableModel.java

compiling

BUILD SUCCESSFUL

Total time: 2 seconds


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Mime
View raw message