How do I get a plugin with platform specific code to deploy to the correct platform using an eclipse p2 repository?

StackOverflow https://stackoverflow.com/questions/14481940

Question

I have an Eclipse Feature that I'm building that contains a few plugins. One of the plugins uses the import package statement to declare a dependency on another plugin.

The other plugin has platform specific code and exists in another feature that I'm building. I have two plugins in this feature that have the platform specific code. One for os=win32 arch=x86 and the other for os=win32 arch=x86_64

Both features are being built and using Tycho and they both have p2 repositories that are successfully available.

So, I made a composite repository that points to both of these repositories, and then I use the "Install New Software..." command in my RCP app and point to the composite repository to install the first feature I mentioned.

The issue is that when the installation is done, the plugin that has the platform specific code has failed to install correctly. Specifically, the plugin for the x86 system shows up on my 64bit machine.

Was it helpful?

Solution

In your feature.xml, choose the plugin with platform specific code and add a platform filter. the filters are available on the right side (once you select the plugin). You can choose filters such as:

  1. OS
  2. WS
  3. Language
  4. Architecture

When your feature is published, p2 will generate the appropriate filters.

OTHER TIPS

I found the answer.

I needed a p2.inf file sitting next to my feature.xml file in the first feature I mentioned in the question.

And in that p2.inf file, I needed this text...

requires.1.namespace=org.eclipse.equinox.p2.iu
requires.1.name=com.myplatform.specfic.bundle.win32.x86   
requires.1.filter=(&(osgi.os=win32) (osgi.arch=x86))

requires.1.namespace=org.eclipse.equinox.p2.iu
requires.1.name=com.myplatform.specfic.bundle.win32.x86_64
requires.1.filter=(&(osgi.os=win32) (osgi.arch=x86_64))

I added this file to the build.properties as well to make sure it was included in the deployed feature

Then when I deployed the p2 repository and performed the install into my RCP application, the correct plugin was placed onto my 64 bit machine.

UPDATE: I was wrong here. This is NOT the correct answer. The incorrect plugin still gets installed on some machines.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top