Retroweaver, mixed compilation environments and compilation order

Background: Suppose you have a project with lots of modules; some of them are new and maintained, some of them are old code and aren't touched unless neccessary. Some of those new modules are written against JDK 1.5, taking advantage of all the new language modules, and these depend on otherwise stable "library" modules, which are being slowly modified to take advantage of some new features (generics in particular).

The Retroweaver Plugin supports a different set of options for each module since the 1.2 release, which seems like a great boon to a project like this. Everything would work, if IDEA called the plugin in the correct order, but it doesn't.

Making things a little more concrete, here are the modules, and their configuration:

- lib_backend: A shared library, used by both new and old modules. This module takes advantages of the 1.5 new language features, but doesn't use any new API's.
- web_interface: A web application, designed to run under Weblogic 8.0 (and thus, JDK 1.4). No 1.5 language features or API's are used.
- backoffice: A standalone, JMX-managed application written with all bells and whistles of JDK 1.5

In the perfect world, the retroweaver configuration for these modules should have been:

- lib_backend: Compile with 1.5, retroweave to 1.4
- web_interface: Compile with 1.4, no retroweaving
- backoffice: Compile with 1.5, no retroweaving

Now the important part: IDEA will compile the modules in the correct order (lib_backend first, then the others), but will only call additional compilers (like the one contributed by the retroweaver plugin) after all modules have been compiled. This poses trouble because the lib_backend classes won't be retroweaved by the time the web_interface compilation starts, and the JDK 1.4 compiler will complain about wrong class versions.

As a temporary workaround, I've set the web_interface module to compile with 1.5 and retroweave to 1.4, but since the module doesn't use any 1.5 features itself, I didn't want to have to do that.

JetBrains, is there anyway the Retroweaver compiler (a ClassInstrumentingCompiler) could be called after each module (or module group, in the case of circular dependent modules) is compiled? Or any other way to make it work as explained above?

7 comments
Comment actions Permalink

Bump! Anyone?

0
Comment actions Permalink

JetBrains, is there anyway the Retroweaver compiler (a ClassInstrumentingCompiler) could be called after each module (or module
group, in the case of circular dependent modules) is compiled? Or any other way to make it work as explained above?


If a compiler needs to process code according to module dependencies, it should sort modules and process their output paths in
certain order. We could open a utility allowing you to build modules graph according to dependencies between them.


--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0
Comment actions Permalink

If a compiler needs to process code according to
module dependencies, it should sort modules and
process their output paths in
certain order. We could open a utility allowing you
to build modules graph according to dependencies
between them.


That's not my problem -- the retroweaver compiler doesn't care about module order. However, the (built-in) javac compiler cares.

The problem here is that IDEA is calling the javac compiler for all modules, and only when all modules finish compliing, the retroweaver compiler gets called. For everything to work as intended, my compiler needs to be called after javac finished compiling each module.

Trying to make things a little more visual. If my project is composed of "Module A" and "Module B", and Module B depends on Module A, IDEA currently calls:

javac Module A
javac Module B
retroweaver Modules A + B

But what I need is:

javac Module A
retroweaver Module A
javac Module B
retroweaver Module B

0
Comment actions Permalink

I'm afraid that with current API this is not possible. We'll think if we could provide the API before the release.
I see one solution for now: compile everything with jdk 1.5 and retroweave all modules then

--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

"Marcus Brito" <mbrito@gmail.com> wrote in message news:24773464.1120579568029.JavaMail.itn@is.intellij.net...
>> If a compiler needs to process code according to
>> module dependencies, it should sort modules and
>> process their output paths in
>> certain order. We could open a utility allowing you
>> to build modules graph according to dependencies
>> between them.
>

That's not my problem -- the retroweaver compiler doesn't care about module order. However, the (built-in) javac compiler cares.

>

The problem here is that IDEA is calling the javac compiler for all modules, and only when all modules finish compliing, the
retroweaver compiler gets called. For everything to work as intended, my compiler needs to be called after javac finished
compiling each module.

>

Trying to make things a little more visual. If my project is composed of "Module A" and "Module B", and Module B depends on Module
A, IDEA currently calls:

>

javac Module A
javac Module B
retroweaver Modules A + B

>

But what I need is:

>

javac Module A
retroweaver Module A
javac Module B
retroweaver Module B



0
Comment actions Permalink

I'm afraid that with current API this is not
possible. We'll think if we could provide the API
before the release.
I see one solution for now: compile everything with
jdk 1.5 and retroweave all modules then


Thanks for your attention, Eugene. Hopefully this thread alone should be enough to help people hitting the problem described. As of compiling everything with JDK 1.5 and then retroweaving, that's exactly what I'm doing, as I said in the OP.

For now, I'll cross my fingers and hope this API will be ready before release. Right now, I think CodeGuide is the only IDE that can compile 1.5 source to 1.4 bytecode, and it would be great to add IDEA to this list :)

0
Comment actions Permalink

Marcus Brito wrote:
>>I'm afraid that with current API this is not
>>possible. We'll think if we could provide the API
>>before the release.
>>I see one solution for now: compile everything with
>>jdk 1.5 and retroweave all modules then


Thanks for your attention, Eugene. Hopefully this thread alone should be enough to help people hitting the problem described. As of compiling everything with JDK 1.5 and then retroweaving, that's exactly what I'm doing, as I said in the OP.

For now, I'll cross my fingers and hope this API will be ready before release. Right now, I think CodeGuide is the only IDE that can compile 1.5 source to 1.4 bytecode, and it would be great to add IDEA to this list :)


Well, IDEA can do it by setting up post-build Ant task using RetroWeaver
task.

0
Comment actions Permalink

Well, IDEA can do it by setting up post-build Ant
task using RetroWeaver
task.


Any IDE can do it using an ant task. To have something more tightly integrated with IDEA's build system was the motivation behind my plugin, in the first place.

0

Please sign in to leave a comment.