fragments for platform specific code [message #327474] |
Mon, 21 April 2008 20:18 |
Carolyn Duby Messages: 30 Registered: July 2009 |
Member |
|
|
I am using Eclipse version 3.3.
I have some platform specific code that I need to call from an Eclipse
plugin. The platform specific code has a JNI interface with a .jar file
and associated native .dlls. I created a fragment to hold the .jar file
and the native .dlls. (See the manifest below)
The host plugin references a class in the fragment's .jar file. In the
fragment manifest.mf, I exported the package containing the class
(com.reprisesoftware.rlm) and included the jar file(rlm.jar) in the bundle
classpath. However, the host plugin did not compile because the compiler
did not recognize the import com.reprisesoftware.rlm. This package should
have been provided by the fragment. In order to get the plugin and
fragment to compile, I had to add the jar file in the fragment in the
extra classpath of the build.properties file for the host plugin. For
example:
ars.extra.classpath =
platform:/plugin/com.pathfinder.eclipseIntegration.licensing .win32.win32.x86/rlm.jar
This doesn't seem right. The documentation for fragments indicates that
the .jars included in fragments should be merged into the host plugin.
How can this work when I add a new platform like Linux?
It seems like there should be a better way but I'm out of ideas.
Can anyone help?
Here is the manifest.mf for the fragment:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: X86 Fragment
Bundle-SymbolicName:
com.pathfinder.eclipseIntegration.licensing.win32.win32.x86
Bundle-Version: 1.0.0
Bundle-Vendor: Pathfinder Solutions, LLC
Fragment-Host:
com.pathfinder.eclipseIntegration.licensing;bundle-version="7.0.0 "
Eclipse-PlatformFilter: (&(osgi.ws=win32) (osgi.os=win32) (osgi.arch=x86))
Bundle-ClassPath: .,
rlm.jar
Export-Package: com.reprisesoftware.rlm
Here is the build.properties for the host plugin:
source.licensing.jar = src/
output.licensing.jar = bin/
bin.includes = plugin.xml,\
META-INF/,\
licensing.jar,\
rlm.jar,\
about.html
jars.compile.order = licensing.jar,\
rlm.jar
jars.extra.classpath =
platform:/plugin/com.pathfinder.eclipseIntegration.licensing .win32.win32.x86/rlm.jar
|
|
|
Re: fragments for platform specific code [message #327557 is a reply to message #327474] |
Thu, 24 April 2008 16:03 |
Marco Maccaferri Messages: 147 Registered: July 2009 |
Senior Member |
|
|
On 21/04/2008 22:18 Carolyn Duby ha scritto:
> The host plugin references a class in the fragment's .jar file. In the
> fragment manifest.mf, I exported the package containing the class
> (com.reprisesoftware.rlm) and included the jar file(rlm.jar) in the bundle
> classpath. However, the host plugin did not compile because the compiler
> did not recognize the import com.reprisesoftware.rlm. This package should
> have been provided by the fragment. In order to get the plugin and
> fragment to compile, I had to add the jar file in the fragment in the
> extra classpath of the build.properties file for the host plugin. For
> example:
I think that you need to both export the package from the fragment (as
it seems you have already done), and import it as a package dependency
on the host plugin.
In a project with similar requirements, I took another approach, I have
placed the classes that are calling the JNI code in the host plugin (the
classes are the same for all platforms, only the native code changes),
and the native .DLL and .so libraries in the fragments.
If you need platform-specific classes, then I suggest to take a look at
how the SWT plugin and fragments are setup.
Hope this helps.
Regards,
Marco.
|
|
|
Powered by
FUDForum. Page generated in 0.03338 seconds