Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 298799 - headless build + generate.plugin = 'unlinked' source plugin
Summary: headless build + generate.plugin = 'unlinked' source plugin
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: Build (show other bugs)
Version: 3.4   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.6 M5   Edit
Assignee: pde-build-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-04 16:39 EST by Volker Wegert CLA
Modified: 2010-01-05 17:42 EST (History)
3 users (show)

See Also:


Attachments
documentation patch (1.59 KB, patch)
2010-01-05 16:52 EST, Volker Wegert CLA
aniefer: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Wegert CLA 2010-01-04 16:39:25 EST
Build Identifier: 20090920-1017

When generating a source plug-in during the headless PDE build, the sources are not "linked" correctly to the plug-ins so that neither navigation into the source nor import as source project work correctly. Bug or user error?

Reproducible: Always

Steps to Reproduce:
- Create a new plug-in project org.example.ui. Choose the template "Hello, World Command".
- Edit the build.properties of the plug-in org.example.ui. For the source build, select at least src.
- Create a new feature project named org.example and add org.example.ui.
- Edit the file build.properties of the feature org.example and append the line "generate.plugin@org.example.source = org.example"
- Edit the feature.xml file. Copy the plug-in element and have the feature also include org.example.source.
- Create a folder somewhere with sub-folders plugins and features. Copy the entire org.example project into features and the entire org.example.ui project into plugins
- Run the following command, with ${ECLIPSE} pointing to the actual Eclipse installation.
java -jar ${ECLIPSE}/plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar \
     -application org.eclipse.ant.core.antRunner \
     -buildfile ${ECLIPSE}/plugins/org.eclipse.pde.build_3.5.1.R35x_20090820/scripts/build.xml \
     -Dbuilder=${ECLIPSE}/plugins/org.eclipse.pde.build_3.5.1.R35x_20090820/templates/headless-build \
     -DtopLevelElementId=org.example \
     -DbuildDirectory=${FOLDER_WITH_PLUGINS_AND_FEATURES_CREATED_BEFORE}
     -Dbase=${ECLIPSE} \
     -DbaseLocation=${ECLIPSE} \
     -Dbaseos=macosx (or whatever) \
     -Dbasews=cocoa (or whatever) \
     -Dbasearch=x86 (or whatever)
- Examine the plugin directory: It contains a folder org.example.source_<version> with the selected sources.
- Examine the generated zip file: It contains the jar'ed source plug-in which in turn again contains the sources.
- Copy the contents of the zip file to the dropins folder and re-start Eclipse with a different workspace. Verify that the sample command is present.
- Create a new empty plug-in project. 
- Add a dependency to org.example.ui.
- Select Navigate --> Open Type and enter SampleHandler. 
---> Instead of the Java source, the class file editor appears.
- Open the Plug-In Development Perspective. From the Plug-Ins View, select org.example.ui, right-click, import as source project.
---> The generated project does not contain the sources. It does not even contain a source folder.
Comment 1 Andrew Niefer CLA 2010-01-04 17:58:04 EST
First comments without trying the import:
1) This is generating an old-style source plugin, I believe these are required to be in folder form, not jared.  In the feature.xml, try setting unpack="true" on the inclusion of the org.example.source plugin.  I suspect this is the source of the import problems.

2) You don't need to select "src" for the source build in the build.properties.  The source files we compiled from will be automatically included, you only need to select any other files you want included.  


You may want to consider generating individual source bundles instead of the old source plugins.  See http://wiki.eclipse.org/PDEBuild/Individual_Source_Bundles 
Changes would be:
org.example/feature.xml
   <plugin id="org.example.ui.source" version="0.0.0" unpack="false" />
org.example/build.properties : 
 individualSourceBundles=true
 generate.plugin@org.example.ui.source=org.example.ui
Comment 2 Volker Wegert CLA 2010-01-05 16:52:22 EST
Created attachment 155378 [details]
documentation patch

1) Yes, that solved the issue - thanks. I'd propose to add this to the documentation - see patch attached.
2) Didn't know that, thanks!
3) Is there a rule of thumb when to use or when not to use the new-style source bundles? I see lots of statements like "it allows us to", but do I have to? Will the old style be deprecated somewhen?
Comment 3 Andrew Niefer CLA 2010-01-05 17:42:28 EST
I have released the doc change with additional words at the top of the page:

"Starting in 3.4, Eclipse has shipped with individual source bundles which
allow for more flexible delivery of source. See the "Individual Source Bundles"
page for details. Traditional folder-shaped source plug-ins can still be built
as outlined below."

I don't think you have to change if you don't want.  The old style plug-ins do
have all the source in one spot which might be convenient depending on how you
plan to distribute it.

I don't think there are any real reasons to deprecate the old shape if people
are happy with it, though PDE/UI may have more to say on that since they have
to support importing them.