Pregunta

I am currently trying to compile my Eclipse PDE projects. To do this i have to collect all the dependencies from the Require-Bundle instructions found in the projects and its dependencies. Now i have come across a problem that one of my projects fails if i want to compile it as it references the class org.eclipse.swt.graphics.Point from the org.eclipse.swt.win32.win32.x86 bundle. The problem seems to be that the dependency to org.eclipse.swt.win32.win32.x86 could not be resolved.

Using the dependency view of eclipse i can see that org.eclipse.ui depends on org.eclipse.swt and org.eclipse.swt depends on org.eclipse.swt.win32.win32.x86.

Here's my question:

I don't understand how eclipse knows that org.eclipse.swt depends on org.eclipse.swt.win32.win32.x86. The manifest file of org.eclipse.swt does not have a Require-Bundle (or other information related to the bundle org.eclipse.swt.win32.win32.x86) statement. So how does it know??

Thanks for you help,

Tim

¿Fue útil?

Solución

It's kind of an inverted dependency, because org.eclipse.swt.win32.win32.x86 is a fragment bundle that is hosted by the base org.eclipse.swt bundle and extends its API. The SWT base bundle is unusual because it contains no code at all... everything is in the platform-specific fragments.

This works in PDE because the base bundle contains the header "Eclipse-ExtensibleAPI: true". When PDE sees this header, it searches for fragments that can add API to the base bundle. Sadly if you are writing some kind of build process to automate PDE builds you will need to replicate the same logic.

Fortunately, at build time you don't need to worry about which platform you are compiling for: the signatures of all the classes and methods are the same across the supported platforms, so you can easily compile using the Win32 fragment even if you are compiling on a Mac (for example).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top