Where's the source?

>> Tuesday, April 20, 2010

Eclipse.org has many repositories - where does the source reside for the bundles you're interested in?


Photo credit sanja gjenero

In 3.6M7, the PDE team implemented new functionality to allow you to enable including references to the source location in the manifests of your binary bundles. To enable this in your build, you need to invoke your build with bundles from I20100414-1200 or later and add the following

generateSourceReferences=true

to the build.properties of your builder. 

During the build process, PDE build generates a file called sourceReferences.properties in same directory as your generated fetch scripts that lists all repository information for the bundles compiled from source. It looks something like this:

#Tue Apr 20 09:23:19 EDT 2010
org.eclipse.help.appserver,0.0.0=scm\:cvs\:pserver\:dev.eclipse.org\:/cvsroot/eclipse\:org.eclipse.help.appserver;tag\=v20090429_1800
org.eclipse.ui.forms,0.0.0=scm\:cvs\:pserver\:dev.eclipse.org\:/cvsroot/eclipse\:org.eclipse.ui.forms;tag\=v20100419
org.eclipse.jdt.debug.ui,0.0.0=scm\:cvs\:pserver\:dev.eclipse.org\:/cvsroot/eclipse\:org.eclipse.jdt.debug.ui;tag\=v20100419
...

The source references are generated from the map files.  If you specify extssh connections in your map files, you may want to replace them in the sourceReferences.properties file with pserver connections in the postFetch phase. Only committers use ssh to connect to eclipse.org  :-)

The resulting bundles from the build will with have a new Eclipse-SourceReferences header in their manifests.  The manifest for the org.eclipse.osgi bundle from today's integration build is an example.



The source references in the manifest can be consumed by PDE when you import a binary bundle into your workspace, so you can easily find the source. When you import your bundles, you can select Import As Projects from a repository.


Select the bundle(s) to import


You'll be prompted if you want to import the version specified in the manifest or from HEAD. Since the bundles we are using are from an integration build and have the version specified, we'll use the v20100419 version.




You'll be prompted for a connection to use and then voila! Version 20100419 of org.eclipse.osgi will appear in your workspace.

This should be useful to people to find the source of the eclipse projects that they would like to contribute to or consume.  It would also be interesting to see how this works with other SCMs, all of our source resides in CVS. 

Thanks PDE team!

For more information see the following bugs
Support embedding repository information in released bundles 
Test generating source references in the build

6 comments:

Wolfgang 1:06 PM  

I would not have come across it without your post, thanks! That really is a time saver.

Very useful if you work with different target platforms w/o source attachment and want to do some debugging.

Antoine 4:48 PM  

That sounds really cool.
1. Would that work with git ? I never tried map files with it.
2. Does Eclipse need to be aware of the presence of the SCM ? Can one enter the entry himself ?

Kim Moir 7:55 AM  

Antoine,

1) If you are familiar with pde build, you know you must define a fetch factory to generate fetch scripts to retrieve source from a specific repository type.

http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.pde.doc.user/reference/extension-points/org_eclipse_pde_build_fetchFactories.html

For example, here are instructions for a SVN fetch factory

http://wiki.eclipse.org/Subversive_PDE_Fetch

So today, there isn't a fetch factory for git. There is a bug for this in the EGit bucket
https://bugs.eclipse.org/bugs/show_bug.cgi?id=289838

2) I think you are asking if you could modify the manifest to include the information manually. Is this what you are asking?

I talked to Andrew Niefer and this is possible. You would also have to use the pde ui extension point so pde ui could import from the git repository.

If you have more questions, I'd suggest asking on the pde-dev list list.

Antoine 7:59 AM  

OK!

I guess 1. will be addressed, 2. is cool :)

David Williams 7:37 AM  
This comment has been removed by the author.
David Williams 7:42 AM  

I found this post very helpful. I recently tried to change our map files, on the fly, after the "getMaps" task, to use ":local:" (when on eclipse.org build machine, as is supposed to be faster). But, that messed up our Eclipse-SourceReferences (they used ":local:" too, which is no good) so I had to back out that improvement. But, after reading this post, I see I could add back, and just do a second fixup in the post fetch task, and change sourceReferences.properties file then. Very helpful post. I would have never found that on my own.

Post a Comment

  © Blogger template Simple n' Sweet by Ourblogtemplates.com 2009

Back to TOP