JackPGreen
JackPGreen

Reputation: 1139

Eclipse RCP Product File - how to handle multiple platforms with platform specific dependencies

I have an Eclipse RCP application, whose .product file contains references to native SWT plugins.

   <plugins>
      <plugin id="org.eclipse.equinox.launcher.win32.win32.x86_64" fragment="true"/>
      <plugin id="org.eclipse.swt.win32.win32.x86_64" fragment="true"/>
   </plugins>

However, on other platforms (e.g. Mac) those plugins cannot be resolved. If you use the Mac version of that plugin (e.g. org.eclipse.swt.cocoa.macosx.x86_64) everything works fine.

Is there some way I specify different plugins for different environments, or a more generic plugin?

I appreciate that when it comes to deploying multi-platform RCP products, things get complex - but at the moment I'm just trying to make it as simple as possible for developers on multiple platforms to get up and running with the application, rather than end users.

Upvotes: 0

Views: 446

Answers (2)

JackPGreen
JackPGreen

Reputation: 1139

Based on the solution provided by greg-449, I noticed that you can have multiple contradicting plugins without issue - i.e. both Windows & Mac plugins can be specified and at runtime Eclipse will use whatever it can find.

This means that by specifying both plugins, despite one always being displayed as an error (as it's unresolvable on that platform), it works fine.

Upvotes: 0

greg-449
greg-449

Reputation: 111142

Use a feature based product file rather than plug-in based.

The feature.xml file defining a feature can specify the OS / GUI / architecture.

This is what the standard Eclipse org.eclipse.e4.rcp feature.xml has for the SWT plug-in / fragments:

<plugin
      id="org.eclipse.equinox.launcher.cocoa.macosx.x86_64"
      os="macosx"
      ws="cocoa"
      arch="x86_64"
      download-size="40"
      install-size="88"
      version="1.1.1100.v20190907-0426"
      fragment="true"/>

<plugin
      id="org.eclipse.equinox.launcher.gtk.linux.ppc64le"
      os="linux"
      ws="gtk"
      arch="ppc64le"
      download-size="76"
      install-size="253"
      version="1.1.1100.v20190907-0426"
      fragment="true"/>

<plugin
      id="org.eclipse.equinox.launcher.gtk.linux.x86_64"
      os="linux"
      ws="gtk"
      arch="x86_64"
      download-size="69"
      install-size="166"
      version="1.1.1100.v20190907-0426"
      fragment="true"/>

<plugin
      id="org.eclipse.equinox.launcher.win32.win32.x86_64"
      os="win32"
      ws="win32"
      arch="x86_64"
      download-size="80"
      install-size="161"
      version="1.1.1100.v20190907-0426"
      fragment="true"/>

<plugin
      id="org.eclipse.swt"
      download-size="16"
      install-size="32"
      version="3.114.0.v20200304-0601"
      unpack="false"/>

Upvotes: 1

Related Questions