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

Bug 352201

Summary: [refactoring] Share classes between tycho-embedder-api and tycho.p2.resolver.facade
Product: z_Archived Reporter: Tobias Oberlies <t-oberlies>
Component: TychoAssignee: Tobias Oberlies <t-oberlies>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Tobias Oberlies CLA 2011-07-15 07:56:00 EDT
Currently it is not possible to share classes between the tycho-embedder-api bundle and the org.eclipse.tycho.p2.resolver.facade bundle.

As a result, there are redundant structures for logically the same thing, e.g. P2ResolutionResult which is later translated to a DefaultTargetPlatform (implementing TargetPlatform). If model classes like ArtifactDescriptor from tycho-embedder-api could be referenced from tycho.p2.resolver.facade, it would be possible to move the TargetPlatform to tycho.p2.resolver.facade and hence get rid of the copy step.

Since tycho-embedder-api has dependencies on Maven, it won't be possible to reference it from the tycho.p2.resolver.facade (which must only reference things available in both class loader worlds - Maven and OSGi). The other way round is not desirable, because tycho-embedder-api is (meant to be) an external API and tycho.p2.resolver.facade isn't. The solution could be a new Tycho-built facade bundle visible from both modules.
Comment 1 Tobias Oberlies CLA 2011-11-18 12:30:54 EST
The first step of this is done: the common ancestor module now exists as org.eclipse.tycho.embedder.facade.

Making real use of that facade is still pending, but this is waiting for the discussions on bug 364134.
Comment 2 Tobias Oberlies CLA 2011-11-25 12:53:42 EST
The name "embedder.facade" doesn't really match, because that module is not a facade: there is nothing behind it. The module just contains a bunch of classes shared between the OSGi and Maven class loader. Therefore I currently prefer org.eclipse.tycho.embedder.shared.

The other "org.eclipse.tycho.*.facade" modules should then also be renamed to ".shared" for consistency. Packages which really serve as facade, e.g. org.eclipse.tycho.p2.tools.director.facade could obviously keep their name ending in ".facade".
Comment 3 Tobias Oberlies CLA 2011-11-30 03:23:54 EST
"embedder.facade" has been renamed to "embedder.shared" with commit feda050.

The package org.eclipse.tycho exists in both org.eclipse.tycho.embedder.shared and tycho-embedder-api - this still needs to be fixed.
Comment 4 Tobias Oberlies CLA 2011-12-06 11:09:07 EST
(In reply to comment #3)
> The package org.eclipse.tycho exists in both org.eclipse.tycho.embedder.shared
> and tycho-embedder-api - this still needs to be fixed.
Fixed with commit c722606
Comment 5 Tobias Oberlies CLA 2011-12-30 10:20:17 EST
Sharing classes between the tycho-embedder-api and the other *.shared bundles is possible. This allows for example to get rid of redundant constant definitions in P2Resolver (see 3b2f544).

Further refactorings may follow, but not as part of this bug.