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

Bug 367431

Summary: Tycho Compiler Doesn't Include Extension Bundle Packages When RequiredExecutionEnvironment Set
Product: z_Archived Reporter: Matt Roy <mooseroy>
Component: TychoAssignee: Igor Fedorenko <igor>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: anthony.dahanne, borislavarnaudov, igor, jan.sievers, lukasz.koniecki, piotr.jaworowski, sebastien.angers, tombrus
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Test Project demonstrating the problem none

Description Matt Roy CLA 2011-12-22 10:48:56 EST
Build Identifier: 0.14.0-SNAPSHOT

When a bundle depends on jdk packages, such as sun.* or com.sun.*, it is common to create an extension-bundle to export these system packages.  This is done by creating a bundle fragment with a "Fragment-Host: system.bundle; extension:=framework", which exports the desired packages.

When building with tycho, if a bundle's manifest defines a Bundle-RequiredExecutionEnvironment, it does not seem that the compiler takes into account the packages defined within these extension bundles.  

Dependency resolution for the bundle's import-packages does work when an extension-bundle is present in the build target platform.  This was tested by building without the extension-bundle in the build target platform, and an build error occurs saying that the import, like com.sun.net.ssl.internal.ssl, could not be satisfied.  When the extension-bundle is included in the build target platform, the dependency is satisfied, but the compiler fails saying there is an Access restriction for com.sun.net.ssl.internal.ssl.  

A test project will be attached to demonstrate the problem.

Reproducible: Always
Comment 1 Matt Roy CLA 2011-12-22 10:49:44 EST
Created attachment 208737 [details]
Test Project demonstrating the problem
Comment 2 Igor Fedorenko CLA 2012-01-08 23:03:29 EST
Can you point me at any documentation (OSGi specs, preferably) that explains expected behaviour of "Fragment-Host: system.bundle; extension:=framework". This will require special handling in tycho-compiler-plugin and I need to understand the problem before I can implement a solution.

Another possibility is to provide a way to disable compiler bootclasspath access rules, but this is obviously suboptimal.
Comment 3 Matt Roy CLA 2012-01-09 07:38:59 EST
I believe it is defined in section "3.15 Extension Bundles" of the core osgi spec.

http://blog.meschberger.ch/2008/10/osgi-bundles-require-classes-from.html is a good blog post that explained it when I was looking.
Comment 4 Igor Fedorenko CLA 2012-01-20 06:07:26 EST
*** Bug 369187 has been marked as a duplicate of this bug. ***
Comment 5 Jan Sievers CLA 2012-01-30 14:31:51 EST
I wonder if bug 369880 may be related. This one is about an equinox runtime issue but the circumstances (framework extension fragment with/without BREE) seem similar.
Comment 6 Igor Fedorenko CLA 2012-02-01 09:41:06 EST
I am having difficulties getting provided example project compiling in eclipse workspace. Does PDE support extension:=framework ?
Comment 7 Matt Roy CLA 2012-02-01 11:04:34 EST
The extension bundle works in the PDE as part of a larger internal project I am working one, so I will have to spend some time to figure out why the simple project is not working.
Comment 8 Igor Fedorenko CLA 2012-02-01 15:03:02 EST
Should be fixed now. http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/commit/?id=a4e844502a489038dae97cd8613b7d0904c3a5ea.

I am still curious to see how this works in PDE.