You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Eugene Voytitsky <vi...@sunbay.com> on 2002/06/04 12:30:03 UTC

Hello All,

Is it possible to tune <javac srcdir="${src_dir}"> task such that:
* in case of build.compiler==(classic||modern)
  Ant WON'T pass compilation argument
  '-sourcepath ${src_dir}' to javac.exe
* in case of build.compiler==jikes
  Ant WON'T append '${src_dir}' to -classpath
???

Explanation
===========

All source files of my project reside in one place
($HOME/<project_name>/code/). But project contains
multiple modules (module contains one or more packages).
Each of modules is released/deployed/etc
separately but there are dependencies between some modules.

Suppose situation:
1. module A has released version 1.0.0 (A_1.0.0.jar),
and source files of module A modified
since version 1.0.0 had been released, moreover
current working (in development) version of A
not compatible with version 1.0.0
2. module B depends on module A and requires version 1.0.0
so A_1.0.0.jar in classpath of Ant <javac> task compiling B
(of course I specified to compile src of B only)

BUT because of both module A and B have same ${src_dir}
javac.exe/jikes.exe consider that
*.java of A is newest than *.class in A_1.0.0.jar
and recompile all necessary *.java of A!!!
But compiling of module B failed because it isn't compatible
with current working version of A.

Any suggestions
(except of 'cvs co' or 'copy' module B to temp dir)
??

I experimented with command line generated by Ant directly
in cmd.exe and found that if my question above is answerable
(with positive answer) then my problem is solvable. :)

Thanks in advance.

-- 
Best regards,
Eugene Voytitsky                          mailto:viy@sunbay.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Re[4]:

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 13 Jun 2002, Eugene Voytitsky <vi...@sunbay.com> wrote:

> Evidently this (and <javadoc>) fixes not included in last
> nightly build at
> http://cvs.apache.org/~bodewig/gump/ant1.5beta/20020613/

correct, I fixed them after the build (they'll be there tomorrow).

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re[4]:

Posted by Eugene Voytitsky <vi...@sunbay.com>.
Hello Stefan,

Thursday, June 13, 2002, 3:14:07 PM, you wrote:

>> sourcepath="" works great with build.compiler==(classic||modern)
>> BUT with build.compiler==jikes I still have a problem:
>> '${src_dir}' is appended to the end of classpath passed to jikes.

SB> Fixed in the 1.5 branch now.

Evidently this (and <javadoc>) fixes not included in last
nightly build at
http://cvs.apache.org/~bodewig/gump/ant1.5beta/20020613/

Because it doesn't work correctly...

-- 
Best regards,
Eugene Voytitsky                            mailto:viy@sunbay.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Re[2]:

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 5 Jun 2002, Eugene Voytitsky <vi...@sunbay.com> wrote:

> sourcepath="" works great with build.compiler==(classic||modern)
> BUT with build.compiler==jikes I still have a problem:
> '${src_dir}' is appended to the end of classpath passed to jikes.

Fixed in the 1.5 branch now.

> PS. As I understood there isn't solution for Ant 1.4.1 at all?

Correct.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re[2]:

Posted by Eugene Voytitsky <vi...@sunbay.com>.
Hello Stefan,

Tuesday, June 04, 2002, 5:12:57 PM, you wrote:

>> Is it possible to tune <javac srcdir="${src_dir}"> task such that:
>> * in case of build.compiler==(classic||modern)
>>   Ant WON'T pass compilation argument
>>   '-sourcepath ${src_dir}' to javac.exe
>> * in case of build.compiler==jikes
>>   Ant WON'T append '${src_dir}' to -classpath
>> ???

SB> Use Ant 1.5beta2 and set the sourcepath attribute to "".

Thanks a lot.
Why I didn't read 1.5b2 docs at first? I don't know :)

sourcepath="" works great with build.compiler==(classic||modern)
BUT with build.compiler==jikes I still have a problem:
'${src_dir}' is appended to the end of classpath passed to jikes.

Is there a way to solve problem with jikes too?

PS. As I understood there isn't solution for Ant 1.4.1 at all?

-- 
Best regards,
Eugene Voytitsky                            mailto:viy@sunbay.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re:

Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 4 Jun 2002, Eugene Voytitsky <vi...@sunbay.com> wrote:

> Is it possible to tune <javac srcdir="${src_dir}"> task such that:
> * in case of build.compiler==(classic||modern)
>   Ant WON'T pass compilation argument
>   '-sourcepath ${src_dir}' to javac.exe
> * in case of build.compiler==jikes
>   Ant WON'T append '${src_dir}' to -classpath
> ???

Use Ant 1.5beta2 and set the sourcepath attribute to "".

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re[2]:

Posted by Eugene Voytitsky <vi...@sunbay.com>.
Hello Scott,

Tuesday, June 04, 2002, 7:44:48 PM, you wrote:

Thanks for your detailed advices.

SE> In this case, you really want completely seperate source directories for
SE> A and B, with different build files.

You are right. When I'll start new project I'll think twice about
module dependencies. But now I participate in old project and am
trying to switch build process from *.cmd to Ant,
so unfortunately I can't change src structure.

PS. Is there some weakness in such isolation of source directories?

-- 
Best regards,
Eugene Voytitsky                            mailto:viy@sunbay.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re:

Posted by Scott Ellsworth <sc...@alodar.com>.
On Tuesday, June 4, 2002, at 03:30  AM, Eugene Voytitsky wrote:

> 1. module A has released version 1.0.0 (A_1.0.0.jar),
> and source files of module A modified
> since version 1.0.0 had been released, moreover
> current working (in development) version of A
> not compatible with version 1.0.0
> 2. module B depends on module A and requires version 1.0.0 so 
> A_1.0.0.jar in classpath of Ant <javac> task compiling B (of course I 
> specified to compile src of B only)

In this case, you really want completely seperate source directories for 
A and B, with different build files.  You can then have a master build 
file that calls each subfile in dependency order, but having

> BUT because of both module A and B have same ${src_dir}
> javac.exe/jikes.exe [will compile anything in src-dir as needed]

pretty much forces the rebuilds you are discovering.  Even if there is 
an easy workaround, I suspect over the long term, you will be happier 
having different build scripts, or at least complete source isolation 
between any two modules that might need to be compiled separately.

We ended up isolating our cross-module dependencies in a master build 
script, and our targets into one standard build file driven by four 
properties to tell it where and what to do.

top
-build
--masterbuild.xml
--standardbuild.xml
-libraries
-products
-toplevelone
--projecta
---projectabuild.xml
---projectasrc
--projectb
---projectbbuild.xml
---projectbsrc
-topleveltwo
--projectc
---projectcbuild.xml
---projectcsrc
--projectd
---projectdbuild.xml
---projectdsrc

masterbuild knows the dependencies of a, b, c	, and d, and calls 
targets in standard-build that build in complete isolation in projecta, 
projectb, projectc, and projectd.  (This is done via properties.)

Each project deploys to the products dir, and uses libraries in the 
libraries dir.  Thus, if b depends on a, b knows that it will find 
projecta.jar in products once projecta's build is done.

If b has gotten to where it will not compile with the current a source, 
then I just do not use the masterbuild target that knows of the 
dependency until it is fixed.

For general use, we use only masterbuild, which calls targets in 
standardbuild, but it is possible to create projectabuild.xml if 
desired.  Just like masterbuild, all a projectbuild file does is set the 
magic four properties to tell it which directory to work in, what to 
compile and what is in the classpath.  All the real work is done in 
standardbuild.

Scott


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>