Well, something 'smells' in what you describe (in the Martin Fowler way ;-).
You say that p2 depends on p1 & p3, but you need to compile it first! That's
strange. Your <javac> task if indeed p2 depends on p1 & p3 will probably end
up compiling p1 & p3 code between it will 'see' p2 depends on classes in p1
& p3, and find these classes thanks to the sourcepath attribute (src in your
case) passed by Ant to SUN's Java compiler. And if your <classpath
id="our.classpath" /> contains p1 and p3 classes, then which would you need
to compile p2 before? Either I don't understand something, or you have
circular dependencies... Then again, you talked about Java source code
generation in the mix, so I'm probably missing something. --DD

-----Original Message-----
From: Chris Bailey [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, May 23, 2002 5:38 PM
To: Ant Users List
Subject: RE: How to compile one package in common root?

I believe I have it working now.  I just needed to get the includes and
excludes properly defined.  Part of what was throwing me off was how many
darn dependencies this package has in the other code, so when it did compile
stuff, it compiled tons of other Java sources (that it depended on).  But,
just in case there is a better way, here's what I have:

root
    src
        company  (start of source code package hierarchy)
            p1
            p2
            p3

I needed to build the stuff in say p2 before p1 and p3.  p2 had some
dependencies in p1 and p3.  I wound up with essentially this:

<javac srcdir="src" ...>
    <include name="company/p2/*.java" />
    <classpath refid="our.classpath" />
</javac>

Seems to work just fine.  But, let me know if something is not right with
that, or there are other/better ways, etc...

-----Original Message-----
From: Dominique Devienne [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 23, 2002 3:19 PM
To: 'Ant Users List'
Subject: RE: How to compile one package in common root?


Could you demonstrate you package hierarchy and what needs to be
compiled/translated first, second, third, etc... a bit more practically? By
that I mean example package names (mangled if you want, which what sources
before to what logical module) and pseudo (ant) code to describe the build
steps order. That would help me understand your problem (rather than
re-reading your email ;-). --DD

-----Original Message-----
From: Chris Bailey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 23, 2002 11:36 AM
To: [EMAIL PROTECTED]
Subject: How to compile one package in common root?

I saw the note under the javac task in the Ant docs, and I also searched the
mailing list archives, so I apologize if this has been covered (if so, and
you can point me to the thread in the archives, thanks in advance!)...

I am converting a project that uses make to Ant.  The code is not as well
organized and separated as we'd like...  There is a common source root.
Then, we have a package under that that is actually some
"compilers"/translators we use to transform XML into Java code.  However,
these compilers also make use of other source files in the common source, so
I can't easily separate them out.  But, I need to compile these before the
rest of the code, so that I can use them to process some of the XML and turn
that into java, and then let all the non-compiler Java source files get
compiled.

I had planned to create a top level/root build.xml that does the normal
build, and a build-compilers.xml that built the compilers (build.xml would
call build-compilers before doing it's compile task).  But, I can't seem to
get the includes/srcdir/src/excludes stuff right for the build-compilers.xml
build file.  Can someone explain the best way to do this?  I am also open to
other ways of achieving this...

____
Chris Bailey       mailto:[EMAIL PROTECTED]
Code Intensity       http://www.codeintensity.com
Voice: 916-415-0471             FAX: 508-267-5841


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to