Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 99357

Summary: import as source project creates invalid project
Product: [Eclipse Project] PDE Reporter: Christian Sell <cse>
Component: UIAssignee: PDE-UI-Inbox <pde-ui-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: bradleyjames, david_williams, hudsonr, isobe, ppshah
Version: 3.1   
Target Milestone: 3.1 RC4   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
patch none

Description Christian Sell CLA 2005-06-10 09:53:03 EDT
since 3.1 (RC1?), importing a plugin as a source project yields an invald
project. In particular, the project is missing the java nature and the java
builder. After adding these manually to the project file, asll is well.
Comment 1 Wassim Melhem CLA 2005-06-10 09:55:01 EDT
a plugin that has no code in it will result in a simple project.  No need to 
subject such a project to a Java builder.

What plugin are you referring to?
Comment 2 Christian Sell CLA 2005-06-10 11:16:14 EDT
in my case, I was importing org.eclipse.gef.examples.logic, which is a java
plugin  with lots of code. As I said, I had to manually fix the .project file so
that even  java search would work. Tried this several times.
Comment 3 Brad Reynolds CLA 2005-06-24 13:26:26 EDT
I had the same issue but it was with the org.eclipse.gef.examples.shapes.  I imported org.eclipse.gef 
and it was fine so I'm curious if it's something just with the GEF example projects or if it effects others 
as well.
Comment 4 Randy Hudson CLA 2005-06-26 10:24:46 EDT
This also affects importing the example as binary. What good is an example if 
it isn't indexed or editable by whoever imported it?

Wassim, please investigate and see if there is a containable workaround GEF can 
do to avoid this bug for 3.1, which would decrease the severity.
Comment 5 Wassim Melhem CLA 2005-06-26 10:41:07 EDT
Randy, I suspect (but haven't verified yet) this is happening because said 
plugin does not export any of its packages.  Would it be acceptable if you 
exported at least one package in said plugin's manifest.mf and marked it as 
internal?
Comment 6 Wassim Melhem CLA 2005-06-26 10:51:27 EDT
The current criteria for giving a plugin a Java nature upon import is:

1. it declares one or more libraries
OR
2. it exports > 1 package
OR
3. it exports >= 1 bundle listed in one of its Require-Bundle header.

Case #3 is too restrictive and is causing the problem here.  It should be 
modified to be 
3. if the plugin has a Require-Bundle header present, give it a Java nature.  
The would make sense since Require-Bundle "should" indicate that this plugin 
requires other plug-ins to compile and hence has Java code.

Note that there has been myths/confusions about what Require-Bundle should 
mean/imply, and it has been clarified recently by Jeff (bug 97383).
Comment 7 Wassim Melhem CLA 2005-06-26 11:06:39 EDT
Another workaround would be to add the header:
Bundle-Classpath: .
to the manifests of your samples.

With this workaround, case #1 in comment 6 will pass and you don't need to 
touch your exported packages.
Comment 8 Randy Hudson CLA 2005-06-26 13:25:02 EDT
In other words, and leaf-node plug-in shipped as a JAR is affected?
Comment 9 Randy Hudson CLA 2005-06-26 13:25:55 EDT
"and" --> "any"
Comment 10 Wassim Melhem CLA 2005-06-26 16:03:25 EDT
Any leaf-node that does not have a Bundle-Classpath header and does not 
reexport any of its dependencies is susceptible to this, yes.

Unfortunately, as annoying as this is and as trivial as the fix is, I cannot 
sell this as a post-RC4 stop-ship bug, since the workaround in comment 7 is 
acceptable until 3.1.1 is released.

Comment 11 David Williams CLA 2005-06-26 16:51:22 EDT
By "hacking" the already built jars in GEF samples
I have confirmed the workaround in comment 7 works ... with one important 
clarification. It should be 
Bundle-ClassPath: .
(capital P in path). I'm surprised its so case sensitive, and the 
PDE Editor doesn't even give a warning  :) 
So, as an aside, is there any PDE (or runtime?) debug option to turn on that
would list warnings in console if bundles contained unrecognized tags? or
attributes?

And to confirm ... the work-around is bascially the default value for
Bundle-ClassPath, right? So it could not effect the PDE generated auto-builds?

Comment 12 Wassim Melhem CLA 2005-06-26 16:59:46 EDT
Sorry for the typo in comment 7.  If you had used the Runtime page to add the 
library, you would have gotten the correct syntax.

We don't give a warning on any unrecognized header because you are allowed to 
have any header you want in the manifest.mf, including 'Bundle-Monkey' :-)

We don't flag a missing Bundle-ClassPath header either because plug-ins are 
not required to have it of course.  So the runtime page is certainly highly 
recommended.

>the work-around is bascially the default value for Bundle-ClassPath, right?
Correct.  To the runtime, the dot is implicit when Bundle-ClassPath is 
missing.  
Comment 13 Randy Hudson CLA 2005-06-26 22:59:00 EDT
> Unfortunately, as annoying as this is and as trivial as the fix is, I cannot 
> sell this as a post-RC4 stop-ship bug, since the workaround in comment 7 is 
> acceptable until 3.1.1 is released.

We are also post-RC4. As far as acceptability of the workaround, we'll have 
test how it affects our build process.
Comment 14 Randy Hudson CLA 2005-06-26 23:13:11 EDT
> And to confirm ... the work-around is bascially the default value for
> Bundle-ClassPath, right? So it could not effect the PDE generated auto-builds?

The src portion of the build is not PDE-genned, right?
Comment 15 Wassim Melhem CLA 2005-06-27 03:30:28 EDT
Not sure what the question in comment 14 mean exactly, but I presume it is 
referring to the build.properties etc.

In which case, with the 'dot' workaround I am suggesting, your build process 
and build.properties are unaffected and would remain unchanged.
Comment 16 Konrad Kolosowski CLA 2005-06-27 13:53:33 EDT
Worth fixing in 3.1.  Wassim, can you attatch the patch.
Comment 17 Dejan Glozic CLA 2005-06-27 13:55:58 EDT
Please:

1) Attach a proposed patch
2) Describe a value/risk ratio 
3) Are there alternatives to fixing it (readme, workarounds, 3.1.1)
Comment 18 Wassim Melhem CLA 2005-06-27 13:56:22 EDT
Created attachment 24042 [details]
patch

This will take care of all the problems.

a project will be give a Java nature if any of the following conditions are
met:
1. declares >= 1 libraries
2. declares >= 1 dependencies
3. declares >= 1 Import-Package
4. exports >= 1 package.
Comment 19 Wassim Melhem CLA 2005-06-27 13:57:38 EDT
dejan, we got +1 from KevinH.
Comment 20 Dejan Glozic CLA 2005-06-27 13:58:21 EDT
The patch looks safe and the value is real.

+1
Comment 21 Wassim Melhem CLA 2005-06-27 14:14:53 EDT
*** Bug 101764 has been marked as a duplicate of this bug. ***
Comment 22 Konrad Kolosowski CLA 2005-06-27 14:25:09 EDT
+1. For the patch.  Logic looks good.  Code looks good.  All SDK plug-ins and 
examples import without problems.  The examples.undo has Java nature added.
Comment 23 Wassim Melhem CLA 2005-06-27 14:27:49 EDT
fixed.

I just verified that all gef projects are imported successfully with source 
and a java nature.

Randy, please note that gef.examples.flow and gef.examples.logic, as they 
appear in the build, are missing a line break at the end of the file.

This will cause the JRE parser and consequently PDE, to ignore the last header.

Please fix before you ship.

EMF had the same problem.

Something is happening during the build process.
Comment 24 Randy Hudson CLA 2005-06-27 23:23:53 EDT
Which files are you referring to in those projects? The manifests?
Comment 25 Wassim Melhem CLA 2005-06-27 23:32:47 EDT
In RC4, the manifest.mf for gef.examples.flow was missing a line break at the 
end causing the Eclipse-AutoStart header to be ignored by the JRE parser.

In 0627, all the gef plug-ins get a clean bill of health.