Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Incremental Compilation 2

NOTE: 
I'm moving this thread onto AspectJ-users because I think users will benefit
and developers are watching. Most of the thread lies below for those who are
interested.

Thanks first to Wes for the pointers. Sorry I haven't responded  incremental
compilation took a temporary back seat to forcing weblogic to only reload
relevant classes after a compile. (with unknown success at the moment)

To Mik: in response to:
> Wes gives some great pointers below.  I'm wondering if there's something
> fundamental about your build process that prevents you from keeping the Ant
> script running in order to use the incremental building.

No, I think it will be possible to keep one script running while another
handles the rest of the build. I guess this is the preferred method of doing
things...?

What we really need is some way for iajc in tagfile mode to indicate that
it's finished. Wes addresses this below:

>> Maybe use -outjar to output the incremental compile.  Then
>> whenever that jar file is updated, run the subsequent builds.

This seems like a good idea, but it may disturb the above-mentioned weblogic
reloading behavior. Also, we segregate the classes into two "modules" after
compilation, which may make an outjar unattractive.


>> Or, AjcTask.doCompletionTasks() uses ajc.Main.setCompletionRunner()
>> to get notice of completion, so you could do something similar
>> with your own ajc.Main.main(..) driver outside of Ant.

Hmmmm... I don't quite follow this suggestion, will looking at the iajc task
source help me to grok?

>> And in either case you can define a message handler so they go
>> to you rather than System.[out|err].

Someone from our team was trying this today. I'll see if it works.

>> Perhaps more importantly, look at your pointcuts and such to
>> see if you are asking the compiler to to unnecessary work.
>> Try (when correct) to use && within() or && withincode() to provide
>> a fastmatch to avoid munging where it is not needed.

At this point I have one (very boring) aspect, so we're basically using ajc
as javac. But that's good to know for the future.

Back to mik:
> So we need to better understand the limitations the current
> modes impose.  I imagine that you're not the only one affected by
> difficulties in substituting ajc for javac, so please keep us informed of
> your experiences.

As far as limitations go, users shouldn't have to resort to the sort of
hacking described above to discover when iajc is done.* Compiling for us is
the start of a long set of transformations that deliver the code to the
server, and I imagine many builds are the same. Ideally iajc would have a
"donefile" that it could touch when it was done. Then other ant scripts
could <wait> for that file to change and begin post-processing.

* Some more thorough documentation of an example build process that uses
incremental mode would also help.

More updates once we make progress tomorrow.

Cheers,
Nick

On 1/15/04 11:04 PM, "Mik Kersten" <beatmik@xxxxxxxxx> wrote:

> Nick,
> 
> Wes gives some great pointers below.  I'm wondering if there's something
> fundamental about your build process that prevents you from keeping the Ant
> script running in order to use the incremental building.  Making iajc behave
> more similarly to javac might be possible if we externalized the last
> compile's dependency structure and some other state currently kept
> in-memory.  I can't recall us considering that, and it could be a fair
> amount of work.  So we need to better understand the limitations the current
> modes impose.  I imagine that you're not the only one affected by
> difficulties in substituting ajc for javac, so please keep us informed of
> your experiences.
> 
> Thanks,
> 
> Mik
> 
>> -----Original Message-----
>> From: aspectj-dev-admin@xxxxxxxxxxx [mailto:aspectj-dev-admin@xxxxxxxxxxx]
>> On Behalf Of Wes Isberg
>> Sent: Thursday, January 15, 2004 6:50 PM
>> To: aspectj-dev@xxxxxxxxxxx
>> Subject: Re: [aspectj-dev] incrimental compilation
>> 
>> Faster compiles, from incremental builds or ...
>> 
>> Maybe use -outjar to output the incremental compile.  Then
>> whenever that jar file is updated, run the subsequent builds.
>> 
>> Or, AjcTask.doCompletionTasks() uses ajc.Main.setCompletionRunner()
>> to get notice of completion, so you could do something similar
>> with your own ajc.Main.main(..) driver outside of Ant.
>> 
>> And in either case you can define a message handler so they go
>> to you rather than System.[out|err].
>> 
>> Perhaps more importantly, look at your pointcuts and such to
>> see if you are asking the compiler to to unnecessary work.
>> Try (when correct) to use && within() or && withincode() to provide
>> a fastmatch to avoid munging where it is not needed. For
>> more information on that, see section 7 in Erik/Jim's paper
>> 
>>    http://hugunin.net/papers/aosd-2004-fixedSubmission.pdf
>> 
>> A more modular build - compile each module, compile aspects to
>> binary, weave each module - might also help.
>> 
>> Performance is one aim of 1.2, so relief is on the horizon,
>> but AFAIK there are no huge performance optimizations in
>> the tree now.
>> 
>> Wes
>> 
>> Nicholas Lesiecki wrote:
>> 
>>> Ok, admittedly iajc will not (in 1.1) behave like javac.
>>> 
>>> Does anyone have any good examples of how to recreate the desired
>> behavior
>>> (fast compiles)? In other words, do you launch one ant script and leave
>> it
>>> idling while launching another to do post-processing, packaging, and
>>> deployment? How does the second script know when the first is done with
>> an
>>> incremental compile? Has anyone done this and relied upon it for their
>> main
>>> build?
>>> 
>>> The reason I'm asking: VMS (my company) just introduced AspectJ to the
>>> project this week and the main complaint is slow incremental compiles
>> during
>>> the compile-deploy-test cycle.
>>> 
>>> If we manage to figure it out before someone assists, I'll post the
>> solution
>>> here.
>>> 
>>> Cheers,
>>> Nick
>>> 
>>> On 1/15/04 1:56 PM, "Wes Isberg" <wes@xxxxxxxxxxxxxx> wrote:
>>> 
>>> 
>>>> The AspectJ compiler does not support a mode like the
>>>> Javac Ant task where the set of input files are pruned to
>>>> remove files that haven't changed since a corresponding
>>>> .class file changed.  That can produce incorrect file
>>>> sets even for Javac, and AspectJ always needs to know
>>>> precisely which files it is supposed to be compiling,
>>>> since aspects potentially affect any class.  (This is
>>>> covered in the AspectJ FAQ.)
>>>> 
>>>> You have another option:  Use the Ant task "tagfile" option,
>>>> and modify the tagfile whenever you want to kick off another
>>>> incremental build.  This will leave the compiler
>>>> "idling", but that's the only way to make us of
>>>> the in-memory cache for incremental compilation.
>>>> 
>>>> See the ant task docs for more details.
>>>> 
>>>> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-
>> home/doc/devgu
>>>> ide/antTasks.html
>>>> 
>>>> Wes
>>>> 
>>>> Peter Litvak wrote:
>>>> 
>>>> 
>>>>> Hi,
>>>>> 
>>>>> 
>>>>> 
>>>>> Is there any way to get an incremental compilation with AspectJ
>> compiler
>>>>> using ANT task? The incremental mode that described in the
>> documentation is
>>>>> not what I need. In that mode you have to run your build script and
>> then
>>>>> after full compilation is done the compiler is sitting there and
>> waiting
>>>>> until you press 'r' to rebuild (then it rebuilds only changed files) or
>> 'q'
>>>>> to quit. This is so called "online" mode. Where I need an "offline"
>> mode
>>>>> because I use ANT build script from an IDE other than Eclipse and I
>> cannot
>>>>> have the compiler to idle.
>>>>> 
>>>>> Basically I want to make AspectJ Ant task to behave pretty much like
>> regular
>>>>> javac task.
>>>>> 
>>>>> 
>>>>> 
>>>>> Any suggestions?
>>>>> 
>>>>> Thank you,
>>>>> Peter
>>>> 
>>>> _______________________________________________
>>>> aspectj-dev mailing list
>>>> aspectj-dev@xxxxxxxxxxx
>>>> http://dev.eclipse.org/mailman/listinfo/aspectj-dev
>>> 
>>> 
>> 
>> _______________________________________________
>> aspectj-dev mailing list
>> aspectj-dev@xxxxxxxxxxx
>> http://dev.eclipse.org/mailman/listinfo/aspectj-dev
> 
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-dev

-- 
Nicholas Lesiecki
Software Craftsman, specializing in J2EE,
Agile Methods, and aspect-oriented programming

Check out my books:
* Mastering AspectJ: http://tinyurl.com/66vf
* Java Tools for Extreme Programming: http://tinyurl.com/66vt

Check out my articles on AspectJ:
* http://tinyurl.com/66vu and http://tinyurl.com/66vv



Back to the top