Jump to: navigation, search

PDEBuild/Individual Source Bundles

Starting in Eclipse 3.4, source can now be shipped as individual bundles instead of the old way of one bundle containing the source for multiple plug-ins. This allows us to be more flexible around how source is delivered, and has the happy side effect of reducing the path length problems sometimes encountered when using Feature Qualifier Suffixes.

This page outlines the steps necessary to generate individual source bundles when building your project. See the help page for a review of the old way of generating source.

individualSourceBundles

In your build configuration's build.properties file, set the property

individualSourceBundles=true

This tells pde.build that you want to generate the new-style source bundles. If you are lucky, this is all that is required. However, generally, things are never that easy.

generate.feature

In a feature's build.properties file, the generate.feature property tells pde.build to generate a source feature.

generate.feature@<source feature id> = <feature id> [, feature@<feature id>] [, plugin@<plugin id>[;version=<pluginVersion>][;unpack="false"]]

When generating individual source bundles, this property remains as before, the difference will be noticed in the resulting source feature. Before, the source feature would have included 1 source plugin + a source fragment for each platform being built. In the new way, the source feature will include a source bundle for each plug-in/fragment listed in the original feature.

Plug-ins that were included in the source feature via the plugin@ syntax will not get corresponding source bundles. This is useful for adding doc plug-ins to the source feature.

Some plug-ins that were included in the originating feature (ie doc plugins) may not have source and should be excluded from the generated source feature. This can be accomplished with the addition of exclude@<plugin id> arguments to the generate.feature property.

Example:

generate.feature@org.eclipse.jdt.source=org.eclipse.jdt, plugin@org.eclipse.jdt.doc.isv;unpack="false",exclude@org.eclipse.jdt.doc.user

generate.plugin

The generate.plugin generates a source bundle based on a given feature. When generating individual source bundles, this changes to be based on a given plug-in:

generate.plugin@<source plug-in id>=<plug-in id>

The generate.plugin property was used by features to include source without having a source feature (even though behind the scenes an entire source feature was generated). When generating individual source bundle, features will need to include a *.source bundle for each plug-in along with a corresponding generate.plugin property for each one.

Or, the generate.plugin property can be changed to a generate.feature property and the source feature included. By default a generated source feature does not have a bin.includes and will be excluded from the build.

Example: The sdk.examples feature used to look like this:

   <feature id="org.eclipse.sdk.examples"  ... > 
        ....
       <plugin id="org.eclipse.sdk.examples.source"  version="0.0.0"/>
       <plugin id="org.eclipse.sdk.examples.source.win32.win32.x86" version="0.0.0"/>
   </feature>

   generate.plugin@org.eclipse.sdk.examples.source=org.eclipse.sdk.examples

This changes to:

   <feature id="org.eclipse.sdk.examples" ...>
      ...
      <includes id="org.eclipse.sdk.examples.source" version="0.0.0"/>
      ...
   </feature>
   generate.feature@org.eclipse.sdk.examples.source=org.eclipse.sdk.examples

Or:

   <feature id="org.eclipse.sdk.examples" ...>
      ...
      <plugin id="org.eclipse.compare.examples.source"  version="0.0.0"/>
      <plugin id="org.eclipse.debug.examples.core.source" version="0.0.0"/>
      <plugin id="org.eclipse.swt.examples.source" version="0.0.0"/>
   </feature>

   generate.plugin@org.eclipse.compare.examples.source=org.eclipse.compare.examples
   generate.plugin@org.eclipse.debug.examples.core.source=org.eclipse.debug.examples.core
   generate.plugin@org.eclipse.swt.examples.source=org.eclipse.swt.examples

generateSourceBundle

Specific plug-ins may not require source bundles because they don't actually contain source. This may occur with platform specific fragments that only contain a native library. In this case, the bundles may be excluded by the feature as outlined above in generate.feature.

Or, bundles can explicitly specify in their own build.properties file that no source bundle should be generated for them:

generateSourceBundle=false

src.zip in CVS (Custom Content)

Some bundles (for example org.junit4, or org.eclipse.osgi.util) have a src.zip in CVS that is included in the source bundle via the src.includes property. When building individual source bundles, this src.zip should be unzipped into the root of the source bundle. This can be accomplished using customBuildCallbacks in the plug-in:

build.properties:
    customBuildCallbacks=customBuildCallbacks.xml

customBuildCallbacks.xml:
   ...
   	<target name="post.gather.sources">
		<unzip src="${target.folder}/src.zip" dest="${target.folder}" overwrite="false"/>
		<delete file="${destination.temp.folder}/src.zip" />	
	</target>
   ...

As an extension to "src.zip in CVS" above this, custom content can always be included in the generated source bundle using the src.includes property and the port.gather.source custom callback.

Branding for the Source Feature

Previously, the generated source plug-in served as a branding plug-in for the generated source feature. Branding files (about.properties, eclipse32.gif, etc) were provided using the sourceTemplatePlugin directory in the original feature.

When generating individual source bundles, the branding plugin for the source feature will be the source bundle corresponding to the original branding plugin. The files from the sourceTemplatePlugin directory will be copied into this branding source plugin.

sourceTemplatePlugin vs sourceTemplateBundle

Previously, the contents of the sourceTemplatePlugin directory of the original feature was copied into the source plug-in. When generating individual source bundles, this remains true only for the branding source bundle (see above).

For all the other source bundles, the contents of a sourceTemplateBundle directory will be copied over.