Bug 252641 - [build] Not possible to run an AspectJ-aware headless pde build
Summary: [build] Not possible to run an AspectJ-aware headless pde build
Status: RESOLVED FIXED
Alias: None
Product: AJDT
Classification: Tools
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement with 3 votes (vote)
Target Milestone: 2.0.2   Edit
Assignee: AJDT-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-29 15:02 EDT by Andrew Eisenberg CLA
Modified: 2010-02-09 13:29 EST (History)
7 users (show)

See Also:


Attachments
pde-build script (76.50 KB, application/x-java-archive)
2008-11-18 00:34 EST, Andrew Eisenberg CLA
no flags Details
New version of jar (77.14 KB, application/octet-stream)
2009-01-14 19:42 EST, Andrew Eisenberg CLA
no flags Details
NEW- org.eclipse.ajdt.pde.build plugin (291.48 KB, application/octet-stream)
2009-01-15 18:22 EST, Andrew Eisenberg CLA
no flags Details
org.eclipse.ajdt.pde.build plugin for 3.5 (360.98 KB, application/zip)
2009-07-07 23:44 EDT, Andrew Eisenberg CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Eisenberg CLA 2008-10-29 15:02:09 EDT
On the AJDT newsgroup, a question was asked about how to get a headless pde build to be aspectj aware.  

http://dev.eclipse.org/mhonarc/newsLists/news.eclipse.technology.ajdt/msg01849.html

This is currently not possible with the current release of AJDT.  However, internally, we use a modified pde builder to run our headless builds with the aspectj compiler.  This pde builder is not meant to be publicly released.  With some modification, I can make this builder public.

What kind of interest from the community is there for a headless pde builder for AspectJ?  Please vote or comment on this bug so that we can guage its importance.

If you require the builder immediately, contact me directly and I can send you our internal builder with instructions on how to use it.
Comment 1 Thomas Hofmann CLA 2008-11-04 10:18:13 EST
Hi,

in a project I am working on we use PDE build headless and we have lots of AspectJ projects. The development is currently based on RSA 7.0.x so it is Eclipse 3.2 based.

I made a patch to the pdebuild-ant.jar file to enable PDE to build a whole product with aspects.

In the future, I would be glad if I could just use what is there in Eclipse 3.4 and AJDT.

So I am voting for this bug.
Comment 2 Thomas Hofmann CLA 2008-11-05 03:45:12 EST
I need to correct myself regarding the comment I made above. We are using RSA 7.0.x based on Eclipse 3.2 for development but for the actual PDE build I made a patch for Eclipse 3.3 to build our product.
Comment 3 Andrew Eisenberg CLA 2008-11-05 10:59:20 EST
If this enhancement is implemented, it would have to wait until AJDT 1.7 and it would target Eclipse 3.5.  Would you be able to use this?
Comment 4 Andrew Eisenberg CLA 2008-11-18 00:34:15 EST
Created attachment 118114 [details]
pde-build script

Here is the pde-build jar for AspectJ aware headless building in eclipse 3.4.  I can't guarantee that it will work in all situations.  However, this is what we use to build AJDT itself.

To run, replace the file in eclipse/plugins/org.eclipse.pde.build_3.4.1.XXX/lib/pdebuild-ant.jar with this version.

Then you can export plugins as usual.

Please let me know if you have success with this.
Comment 5 Thomas Hofmann CLA 2008-12-08 15:13:30 EST
Once we migrate to an eclipse 3.4 based IDE I will provide you with feedback. Unfortunately, I cannot tell you when that will be.
Comment 6 Andrew Eisenberg CLA 2008-12-10 12:32:43 EST
Any progress with this?
Comment 7 Roman Legat CLA 2009-01-13 07:10:23 EST
Andrew, I tried using the pdebuild-ant.jar you provided but I'm getting a NPE: Caused by: java.lang.NullPointerException
        at org.eclipse.pde.internal.build.tasks.AJModelBuildScriptGenerator.bundleToCP(AJModelBuildScriptGenerator.java:1542)
        at org.eclipse.pde.internal.build.tasks.AJModelBuildScriptGenerator.generateCompilationTarget(AJModelBuildScriptGenerator.java:1206)
        at org.eclipse.pde.internal.build.tasks.AJModelBuildScriptGenerator.generateBuildJarsTarget(AJModelBuildScriptGenerator.java:1043)
        at org.eclipse.pde.internal.build.tasks.AJModelBuildScriptGenerator.generateBuildScript(AJModelBuildScriptGenerator.java:368)
        at org.eclipse.pde.internal.build.tasks.AJModelBuildScriptGenerator.generate(AJModelBuildScriptGenerator.java:242)

This occurs with eclipse 3.4.1 with ajdt 1.6.1 and 1.6.2 and I think this is related to the bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=244735

Can you provide a jar with the newer AJModelBuildScriptGenerator which is contained in org.eclipse.ajdt.core_1.6.2.20090105113441.jar or give an advice how to do this on my own?
I'm also interested in the internal builder you're using.
Comment 8 Andrew Eisenberg CLA 2009-01-13 11:18:08 EST
The version of AJModelBiuldScriptGenerator that you are using is the most recent.

Are the weaver, ajde, and aj runtime included in your target platform?  Even if these bundles are not actually used in the final release, they are required to be in existance to compile against.

Let me know if this works.
Comment 9 Roman Legat CLA 2009-01-14 18:35:59 EST
I tried that, but the problem persists.

The NPE occurs at line AJModelBuildScriptGenerator:1542, method bundleToCP, with the source 
  if(bundle.getName().equals("org.apache.ant"))

Since the version here:

the http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ajdt/AJDT_src/org.eclipse.ajdt.core/src/org/eclipse/ajdt/core/exports/AJModelBuildScriptGenerator.java?root=Tools_Project&view=markup

contains a not null test on bundle.getSymbolicName() I thought it was newer and maybe could help here, sorry if I mixed things up.
Comment 10 Andrew Eisenberg CLA 2009-01-14 19:40:09 EST
The file you are looking at is not the one that is included in the jar attached to this bug.  Similar, but some slight differences.  That line is one of the differences.  As I said before, this jar was not designed to build anything but AJDT.
Comment 11 Andrew Eisenberg CLA 2009-01-14 19:42:17 EST
Created attachment 122612 [details]
New version of jar

This version of the jar makes changes to AJModelBuildScriptGenerator so that the null pointer exception should be avoided.  Please try this out and let me know if it works for you.
Comment 12 Andrew Eisenberg CLA 2009-01-15 18:22:03 EST
Created attachment 122760 [details]
NEW- org.eclipse.ajdt.pde.build plugin

This attachment contains the org.eclipse.ajdt.pde.build plugin.  This plugin provides aspectj-aware pde headless build capability for eclipse.  To use this plugin do the following:

1. unzip the plugin into your eclipse/dropins directory.
2. run eclipse once so that this plugin is recognized and installed by the P2 installer
3. in your headless build script, make sure that the eclipse antrunner points to the org.eclipse.ajdt.pde.build/scripts/build.xml ant script
4. ensure that the following property is available to ant: ajdt.pdebuild.home = <path_to_ajdt.pde_plugin>  (you can add this as a vm arg to -Dajdt.pdebuild.home=<path_to_ajdt.pde_plugin>)
5. run your build script

Several things to note here:
1. this plugin is meant for *headless* builds only
2. many of the ant tasks available in standard eclipse headless builds are available here, but the names are prefixed with "ajdt.".  Eg- eclipse.build becomes ajdt.eclipse.build
3. this plugin includes the sources, so you can browse and see how things are implemented
4. also take a look at the ant scripts

Please try this out and if this plugin is sufficient for your purpose, I will include this in AJDT 1.6.3 (perhaps as an optional add-on).
Comment 13 Andrew Eisenberg CLA 2009-07-07 23:44:28 EDT
Created attachment 141032 [details]
 org.eclipse.ajdt.pde.build plugin for 3.5

Updated  org.eclipse.ajdt.pde.build plugin for Eclipse 3.5.
Comment 14 Benjamin Freudenreich CLA 2009-07-21 07:38:07 EDT
Hi,

currently I am working in the team of Thomas Hofmann (see above) on the migration of PDE build scripts for Eclipse 3.3 to Eclipse 3.4.
Because of that I tried your provided "pdebuild-antnew.jar"-file to solve the descripted problem of not aspectj-aware PDE builds.
A new problem occurred while running our script, which includes some targets to sign jars. For that job the class org.eclipse.pde.internal.build.jarprocessor.JarProcessorTask.class is required, but the class couldn't be found.
The folder "jarprocessor" exists in the original jar-file, but is missing in your modified version.
Is there a reason for that? How is it possible to sign jars wihtout that class?

Thanks!
Comment 15 Andrew Eisenberg CLA 2009-07-21 09:46:37 EDT
Benjamin,

The pde build plugin was never intended to support jar signing (it wasn't our intention *not* to support it either).  It was just not implemented.  I'll take a look at it this week and see if there is anything I can do about that.

You are working on 3.4, right?
Comment 16 Benjamin Freudenreich CLA 2009-07-21 10:18:40 EDT
Hey Andrew,

thanks for the fast response!

You are right, I am working on Eclipse 3.4.

I await your replay intently.
Comment 17 Benjamin Freudenreich CLA 2009-07-23 09:45:43 EDT
Hey!

Today, I have just tried to solve the problem with jar-signing by copying the jarprocessor-folder from the original pdebuild-ant.jar into your provided one.
Obviously, it works!
Comment 18 Benjamin Freudenreich CLA 2009-08-03 05:45:50 EDT
Hello Andrew,

after trying your first described solution with the the pdebuild-antnew.jar, which was successful, I attempted the second way with your org.eclipse.ajdt.pde.build plugin.
At the first step, I got an exception.
But after some research, I found out, that there is a mistake in the productBuild.xml file in the script folder. In line seven the value of the property "allElementsFile" has to be corrected to "${ajdt.pdebuild.scripts}/productBuild/allElements.xml". The prefix ${ajdt.pdebuild.scripts} is just missing.
Now, your plugin in addition with the corrected productBuild.xml is working.

It would be great if your plugin gets an regluar one, which is inclusive of the next AJDT releases.

Thank you!
Comment 19 Andrew Eisenberg CLA 2009-09-30 14:37:07 EDT
Move to the 2.0.2 release.
Comment 20 Andrew Eisenberg CLA 2009-12-03 12:01:30 EST
Working on this now.  An optional ajdt-pde feature should be available soon.
Comment 21 Andrew Eisenberg CLA 2009-12-06 00:03:05 EST
Done.

Latest dev build for 3.5 stream includes pde build scripts in the update site.  Look in the Optional category of the update site.
Comment 22 Alain CLA 2009-12-10 09:43:33 EST
Hi,

I use the buckminster headless build to build my eclipse product.
The buckminster build uses a headless eclipse environment to build the products.

The problem with the org.eclipse.pde.build is, that it does not implement the required extension point "org.eclipse.core.resources.builders" in order to serve the "org.eclipse.ajdt.core.ajbuilder" buildcommand (in the .project file).

Is there a plan to support the org.eclipse.ajdt.core.ajbuilder headlessly?

Thanks for your response,
Alain
Comment 23 Andrew Eisenberg CLA 2009-12-10 11:29:18 EST
(In reply to comment #22)
> Is there a plan to support the org.eclipse.ajdt.core.ajbuilder headlessly?
This is not something we have thought about yet, but it is something that we can do.  I would appreciate it if you could raise an enhancement request for this.
Comment 24 Alain CLA 2009-12-11 04:12:11 EST
(In reply to comment #23)
Thanks a lot for your answer.
This task is very critical at my place, because the migration of our product-build-environment to buckminster will fail if we can't build the plugins using aspectj. Where should I raise this enhancement request? As bug in this bugzila?

Could you plese tell me, how long it will take, until it will be possible to get a (dev)release of such a headless-ajbuilder feature?

Thanks, Alain.
Comment 25 Andrew Eisenberg CLA 2009-12-11 11:58:48 EST
(In reply to comment #24)
> Where should I raise this enhancement request? As bug in
> this bugzila?
Yes, please do.

> Could you plese tell me, how long it will take, until it will be possible to
> get a (dev)release of such a headless-ajbuilder feature?
I don't want to give any estimates since I don't know the scope of this problem.  I have never used Buckminster, and I don't know what the requirements are.

If you have some experience with Buckminster and can sketch out a solution or point me in the right direction, this would vastly speed up the process.
Comment 26 Andrew Eisenberg CLA 2009-12-11 12:03:53 EST
> If you have some experience with Buckminster and can sketch out a solution or
> point me in the right direction, this would vastly speed up the process.

And what I mean here is for you to describe *exactly* what you need.  What extension point should AJDT be extending that it is not?  What API should it expose that it is not?  What precisely is the behavior that you require that is non-existent?
Comment 27 Alain CLA 2009-12-14 03:16:38 EST
Thanks for your answer.
I opened a issue:

Bug 297713 -  AJDT for Headless Buckminster build process

Regards, Alain.
Comment 28 Thomas Hofmann CLA 2010-02-09 06:10:00 EST
Hi Andrew,

I'm am into this once more finally trying to move our PDE build process for an RCP application to RSA 7.5.

I started of with the version Benjamin modified. I needed to make some more tweaks (I don't know why) but now it looks like I cannot continue any further. The ajde.classpath in the generated build.xml files is always empty. Therefore, the iajc task is not found.

I saw bug 288020 and I wonder if that has to do with it.

I would now like to know if there is some newer version that has fixes (especially bug 288020) built into it and where I can find it. I looked in my plugins dir but nothing is there.

I would then begin from scratch using the latest version and reporting back what I find one issue at a time.
Comment 29 Thomas Hofmann CLA 2010-02-09 06:11:42 EST
As you might know RSA 7.5 is based on Eclipse 3.4.x but there are some differences in regard of the location the bundles are stored on disk.
Comment 30 Andrew Eisenberg CLA 2010-02-09 13:29:37 EST
Hi Thomas,

The fix for bug 288020 was back ported to 3.4.  If you are using RSA as the build Eclipse, make sure that the ajde bundle is in your target platform.  You also need to make sure that all of ajde's required bundles are in your target platform.  These are:

org.apache.ant,
org.eclipse.core.resources,
org.eclipse.core.runtime,
org.eclipse.core.runtime.compatibility,
org.eclipse.text,
org.aspectj.weaver

Please let me know if this helps you.  Unfortunately, I cannot spend too much time on this because I am on leave, taking care of my new baby girl.  :)

However, I would be interested in knowing what changes you made to the build scripts.