Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Bundle-Classpath: filters on ws, os, arch, is this possible ?
Bundle-Classpath: filters on ws, os, arch, is this possible ? [message #73682] Mon, 25 September 2006 20:08 Go to next message
Darryl Miles is currently offline Darryl MilesFriend
Messages: 123
Registered: July 2009
Senior Member
[ Originally posted to eclipse.platform, but advised this is better forum. ]


Is this possible, I would like to filter with more than one
attribute ANDed together, I have tried the following (without any success).



Attempt #1: (based on http://wiki.eclipse.org/index.php/Adaptor_Hooks,
but it doesn't document $arch$ is valid but I need that too)

Bundle-ClassPath: mozilla_$ws$_$os$_$arch$.jar



Attempt #2: (based on OSGi spec, but I have only seen documention for
using a single match rule, like "foo.jar;(osgi.arch=x86)" but I need
more than one.

Bundle-ClassPath: mozilla_win32_win32_x86.jar;(& (osgi.arch=x86)
(osgi.ws=win32)),
mozilla_win32_win32_x86_64.jar;(& (osgi.arch=x86_64) (osgi.ws=win32)),
mozilla_win32_win32_ia64.jar;(& (osgi.arch=ia64) (osgi.ws=win32))



Attempt #3: (based on bugzilla entry
https://bugs.eclipse.org/bugs/show_bug.cgi?id=41071 again I need more
than one and preferabily the normalized osgi.* versions)

Bundle-ClassPath: mozilla_gtk_linux_x86.jar;filter="(& (osgi.arch=x86)
(osgi.ws=gtk) (osgi.os=linux))",
mozilla_gtk_linux_x86_64.jar;filter="(& (osgi.arch=x86_64)
(osgi.ws=gtk) (osgi.os=linux))",
mozilla_gtk_linux_ia64.jar;filter="(& (osgi.arch=ia64) (osgi.ws=gtk)
(osgi.os=linux))",



Attempt #4: (based on grepping the org.eclipse.osgi CVS source and
looking at other manifest attributes)

Bundle-ClassPath: mozilla_gtk_solaris_x86.jar;selection-filter="(&
(osgi.arch=x86) (osgi.os=solaris))",
mozilla_gtk_solaris_sparc.jar;selection-filter="(& (osgi.arch=sparc)
(osgi.os=solaris))",



These are all different permutations of snippets I have found but none
are having the effects I expect.

I am using Eclipse Platform version 3.2.


Darryl
Re: Bundle-Classpath: filters on ws, os, arch, is this possible ? [message #74627 is a reply to message #73682] Tue, 10 October 2006 15:37 Go to previous message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
Darryl L. Miles wrote:
>
> [ Originally posted to eclipse.platform, but advised this is better
> forum. ]
>
>
> Is this possible, I would like to filter with more than one
> attribute ANDed together, I have tried the following (without any success).
>
>
>
> Attempt #1: (based on http://wiki.eclipse.org/index.php/Adaptor_Hooks,
> but it doesn't document $arch$ is valid but I need that too)
>
> Bundle-ClassPath: mozilla_$ws$_$os$_$arch$.jar
>

The Eclipse jar lookup strategy does not work like this. The variable
substitution for classpath jars is available for supporting legacy
plugins. This is not really the recommended way to filter out code jars
(I'll get to best practices later ...)

Currently this only supports ws, os or nl and each variable is mutually
exclusive. The varables must be the first thing in the classpath entry.
For example:

Bundle-ClassPath: $os$/mozilla.jar, $ws$/wscode.jar, $nl$/nlcode.jar

The $os$ var will substitute the path according to the value of osgi.os
to look for the jar. For example, if osgi.os=win32 the following path
will be used to look for the jar

os/win32/mozilla.jar

The $ws$ var will substitute the path according to the value of osgi.ws
to look for the jar. For example, if osgi.ws=motif the following path
will be used to look for the jar

ws/motif/wscode.jar

The $nl$ var will substitute the path according to the value of osgi.nl
to look for the jar. For example, if osgi.nl=en_US the following paths
will be used to look for the jar

nl/en/US/nlcode.jar
nl/en/nlcode.jar
nl/nlcode.jar


>
>
> Attempt #2: (based on OSGi spec, but I have only seen documention for
> using a single match rule, like "foo.jar;(osgi.arch=x86)" but I need
> more than one.
>
> Bundle-ClassPath: mozilla_win32_win32_x86.jar;(& (osgi.arch=x86)
> (osgi.ws=win32)),
> mozilla_win32_win32_x86_64.jar;(& (osgi.arch=x86_64) (osgi.ws=win32)),
> mozilla_win32_win32_ia64.jar;(& (osgi.arch=ia64) (osgi.ws=win32))
>
>
>
> Attempt #3: (based on bugzilla entry
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=41071 again I need more
> than one and preferabily the normalized osgi.* versions)
>
> Bundle-ClassPath: mozilla_gtk_linux_x86.jar;filter="(& (osgi.arch=x86)
> (osgi.ws=gtk) (osgi.os=linux))",
> mozilla_gtk_linux_x86_64.jar;filter="(& (osgi.arch=x86_64)
> (osgi.ws=gtk) (osgi.os=linux))",
> mozilla_gtk_linux_ia64.jar;filter="(& (osgi.arch=ia64) (osgi.ws=gtk)
> (osgi.os=linux))",
>
>
>
> Attempt #4: (based on grepping the org.eclipse.osgi CVS source and
> looking at other manifest attributes)
>
> Bundle-ClassPath: mozilla_gtk_solaris_x86.jar;selection-filter="(&
> (osgi.arch=x86) (osgi.os=solaris))",
> mozilla_gtk_solaris_sparc.jar;selection-filter="(& (osgi.arch=sparc)
> (osgi.os=solaris))",
>

All of these attempts use the "selection-filter" concept which did not
end up making it into the final OSGi R4 specification. Instead the OSGi
Alliance decided that fragments were a better way to solve this problem

>
>
> These are all different permutations of snippets I have found but none
> are having the effects I expect.
>
> I am using Eclipse Platform version 3.2.

On Eclipse 3.2 I would recommend you use fragments to place your
platform specific code. You should place your platform neutral code
into a host bundle and then deliver platform specific code in to bundle
fragments. The fragments will append their code (from their own
Bundle-ClassPath header) to the content of the host bundle. In addition
you can add the Eclipse-PlatformFilter to effect the resolution state of
your fragments so that they only are available on the correct platform.
For example, if the fragment should only be used on win32 and x86 then
you can use the following header in your platform specific fragment.

Eclipse-PlatformFilter:
(& (osgi.ws=win32) (osgi.os=win32) (osgi.arch=x86))

The eclipse help has more information on this header. Also look at the
various swt platform fragments for examples of this headers use.

>
>
> Darryl
Previous Topic:Equinox with Axis
Next Topic:Custom priority ClassLoader extention ?
Goto Forum:
  


Current Time: Thu Apr 25 01:35:13 GMT 2024

Powered by FUDForum. Page generated in 0.03052 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top