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

Bug 330256

Summary: Make "Organize Manifest" wizard run with Orbit projects
Product: [Eclipse Project] PDE Reporter: Gunnar Wagenknecht <gunnar>
Component: UIAssignee: PDE-UI-Inbox <pde-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3 CC: david_williams, dj.houghton, d_a_carver
Version: 3.7   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug
Bug Depends on: 330278    
Bug Blocks:    
Attachments:
Description Flags
patch for ManifestUtils
none
patch for re-scanning of class files
none
patch for re-scanning of class files none

Description Gunnar Wagenknecht CLA 2010-11-15 10:26:07 EST
The "Organize Manifest" is intended to aid with import/export packages. There are some issues which prevent it from being used for Orbit projects. 

The typical Orbit layout is

build.properties:
output.. = .
bin.includes = META-INF/,\
               com/,\
               plugin.properties,\
               about.html,\
               about_files/

In the above case "com" is the first level package folder with all sub-packages containing class files.

There is no source folder but a class folder.
<classpathentry exported="true" kind="lib" path="" sourcepath="source-bundle"/>

It seems that this is an issue for the "Organize Manifest" wizard.
Comment 1 Gunnar Wagenknecht CLA 2010-11-15 10:41:22 EST
One issue is that when "Ensure that all packages appear in the MANIFEST.MF is checked" new packages are not found and added.

The cause for this seems to be in ManifestUtils.findPackageFragmentRoots(IManifestHeader, IProject) which requires for '.' to have a "source.." entry.
Comment 2 Gunnar Wagenknecht CLA 2010-11-15 11:06:47 EST
Another issue is that it's not possible to re-scan class files for dependencies. For example, when a new version is committed to Orbit it's not possible to re-scan for additional or maybe now obsolete dependencies.

It should be possible to also include class files into the analysis. That's what I'd expect when running the wizard.

The wizard currently only uses the AddNewDependenciesOperation. However, when creating a new bundle project based on existing jars a modified version of the AddNewBinaryDependenciesOperation seems to be used. I think this should be also executed as part of the wizard.
Comment 3 Gunnar Wagenknecht CLA 2010-11-15 11:21:23 EST
Created attachment 183133 [details]
patch for ManifestUtils

This patch addresses the issue in ManifestUtils. If no source entry is found in the 'build.properties' it will be tested if the library is a binary one.

I wonder if the surrounding if block can be removed:



if (!lib.equals(".")) { //$NON-NLS-1$
	try {
		root = javaProject.getPackageFragmentRoot(project.getFile(lib));
	} catch (IllegalArgumentException e) {
		return new IPackageFragmentRoot[0];
	}
}
if (root != null && root.exists()) {
	pkgFragRoots.add(root);
} else {
	...
}
Comment 4 Gunnar Wagenknecht CLA 2010-11-15 12:17:06 EST
Created attachment 183143 [details]
patch for re-scanning of class files

This patch adds scanning of binary dependencies to the wizard. It also ensures that *all* found dependencies are added to the import package section by adding non-resolvable packages as optional imports.

This is what I would expect from the "Organize Manifest" wizard for binary (i.e., Orbit) projects.
Comment 5 Gunnar Wagenknecht CLA 2010-11-15 15:13:30 EST
Discovered a bug in PackageFinder while working on the second patch. Opend bug 330278 to track this.
Comment 6 Gunnar Wagenknecht CLA 2010-11-15 15:24:06 EST
Created attachment 183160 [details]
patch for re-scanning of class files

updated patch
Comment 7 Gunnar Wagenknecht CLA 2010-11-15 16:30:00 EST
I wonder if I should include special handling for "about_files" folder. PDE now discovers it (correctly) as missing export package. :)

However, that really is dedicated to Orbit and it doesn't feel right to hack such an exclude list into PDE. Thoughts?
Comment 8 Eclipse Webmaster CLA 2019-09-06 15:35:47 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
Comment 9 Julian Honnen CLA 2019-09-09 02:29:53 EDT
Please remove the stalebug flag, if this issue is still relevant and can be reproduced on the latest release.