Bug 165964 - Process Bundle-NativeCode at resolve time
Summary: Process Bundle-NativeCode at resolve time
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Framework (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M2   Edit
Assignee: Thomas Watson CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks: 201273
  Show dependency tree
 
Reported: 2006-11-27 15:27 EST by Thomas Watson CLA
Modified: 2007-09-10 09:34 EDT (History)
2 users (show)

See Also:


Attachments
work in progress (37.58 KB, patch)
2007-08-29 18:38 EDT, Thomas Watson CLA
no flags Details | Diff
function complete (73.55 KB, patch)
2007-08-30 17:35 EDT, Thomas Watson CLA
no flags Details | Diff
test complete (141.00 KB, patch)
2007-09-05 13:31 EDT, Thomas Watson CLA
no flags Details | Diff
fix for Mac and Linux os versions (2.98 KB, patch)
2007-09-10 09:34 EDT, Thomas Watson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Watson CLA 2006-11-27 15:27:16 EST
Currently Bundle-NativeCode is processed at install time and a bundle fails to install if a valid native-code match is not found.  We should consider moving this processing to resolve-time and cause bundles that do not have matching native-code to be unresolved.

We did a similar change to Bundle-RequiredExecutionEnvironment.  This will help us adopt the Bundle-NativeCode header instead of using the Equinox specific native code lookup.

We should probably not do native code processing if the resolver mode is "development" for PDE.  CC'ing Wassim incase this change has effects PDE (I anticipate that it will not)
Comment 1 Thomas Watson CLA 2007-08-03 17:16:04 EDT
I opened an OSGi bug to consider changing this in the OSGi spec.
https://www2.osgi.org/members/bugzilla/show_bug.cgi?id=521
Comment 2 Thomas Watson CLA 2007-08-27 21:19:43 EDT
Once this bug is fixed we should start to migrate eclipse over to use the Bundle-NativeCode header.  We will need the PDE bug 201273 to make this easier.
Comment 3 Thomas Watson CLA 2007-08-29 18:38:06 EDT
Created attachment 77320 [details]
work in progress

I started this work.  Here is a snapshot of the changes required to do this.  

This patch modifies the State API to allow for native code specifications to be associated with BundleDescriptions and it processes and resolves them in the ResolverImpl.

Still lots of work around removing the old checks performed at install time.
Comment 4 Thomas Watson CLA 2007-08-30 15:03:02 EDT
One thing about the Bundle-NativeCode header is that it forces you to list the
native code paths that you want to use.  This will likely upset folks like SWT
that change the name of their library each and every time they recompile their
natives.  I'm not sure why they do that but if they want to move to
Bundle-NativeCode then they will have to update their bundle manifest with the
new library name each time they have a new library.
Comment 5 Thomas Watson CLA 2007-08-30 17:35:44 EDT
Created attachment 77419 [details]
function complete

Here is a function complete patch.  I removed the all the code from the Framework class which did the install-time verification of EE and native code.  It is now done after we have added the bundle to the State so that we can use the State API to perform the install-time checks required from the R4 specification.

If eclipse.ee.install.verify=false which it is by default, then the install-time checks are not done.

With this patch now any Eclipse bundle with native code can use the Bundle-NativeCode header instead of the Eclipse-PlatformFilter header.  For example this is the Bundle-NativeCode header which can be used for the swt win32 fragment

Bundle-NativeCode: 
 swt-awt-win32-3408.dll;
 swt-gdip-win32-3408.dll;
 swt-wgl-win32-3408.dll;
 swt-win32-3408.dll;
 swt-xpcominit-win32-3408.dll;
 swt-xulrunner-win32-3408.dll;
  selection-filter="(& (osgi.ws=win32) (osgi.os=win32) (osgi.arch=x86))"


A bit more commenting and javadoc work needs to be done before releasing this patch.
Comment 6 Thomas Watson CLA 2007-09-05 13:31:13 EDT
Created attachment 77745 [details]
test complete

This patch contains several bug fixes that were present in the previous patch.  It also has complete javadoc for all the newly added methods/classes in the State/Resolver API.

Several new native code tests are added to the automated tests.  This patch also passes the OSGi R4.1 testsuite when eclipse.ee.install.verify=true to perform the install time native code and EE checks.  By default this config property is set to false.
Comment 7 Thomas Watson CLA 2007-09-05 14:27:42 EDT
Patch released for 3.4 M2.  This is probably worth a new and noteworthy entry.
Comment 8 Thomas Watson CLA 2007-09-10 09:34:15 EDT
Created attachment 77981 [details]
fix for Mac and Linux os versions

The org.osgi.framework.processor should be set to the primary alias as defined by OSGi.  The org.osgi.framework.os.version needs to be verified for a correct version number and munged into a good version number if it cannot be parsed into an OSGi Version.

These issues were causing the automated testcases to fail on Linux and Mac.