ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: Javac: multiple source roots & filesets
Date Wed, 26 Apr 2006 11:48:40 GMT
Wildish, Joe STASCO-OTO/72 wrote:

> java root_a/One.java root_b/Two.java root_b/Three.java
> 
> javac handles this OK (ie. it is not privy to root_a/Two.java, so does not attempt to
compile it). 


Like I warned, this is not always the case

java.exe will pull in any java files it sees fit to compile something, 
provided they are laid out in a proper hierarchy. This is why you dont 
need to specify the exact order to compile files.

As sun say in the javac.html page "javac can silently compile source 
files not mentioned on the command line."

That's why using the command line to selectively filter stuff is a bad 
thing. Even at the terminal prompt, you can get burned.

 >Is the javac task not simply mimicking this behaviour? In which case, 
I should be able to emulate this within a target...?
 >

javac does other things like dependency checking, wrapping around other 
compilers and the like. you can always use <exec> to call javac if you 
want.

Personally, I think what you are trying to do is dangerous. It looks 
like you're trying to have per-platform/per-release customisation by 
producing different .class files for different systems. There are better 
ways to do this that are cleaner and more manageable
  -use the SCM system and branch
  -use an interface/implementation pattern and compile different 
implementations
  -tease the file that changes out into its own location (or even 
separate JAR), so you just include what you want,
   instead of trying to exclude things.

Now, if <src> doesnt let you support multiple fileset sources then that 
may be a defect we need to fix, but I dont think your use case is 
something to encourage. Sorry.

-steve

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


Mime
View raw message