Eclipse RCP: build.properties for multiple platforms

寵の児 提交于 2019-12-24 00:59:20

问题


I'm developing an Eclipse RCP application. The application should run on Windows and Linux.

There are several plugins in this application that contain native artifacts. To contain these artifacts in a binary build (jar), one should specify them in build.properties file.
Currently I include both Linux and Windows native artifacts in build.properties and then in runtime I choose which one to load. However, I don't like this approach as it causes unnecessary files to present in both Linux and Windows builds.

Is there a way to specify target platform in build.properties? So that for Linux build it would include Linux artifacts and for Windows build it would include Windows artifacts?
Alternatively, is there a way to maintain two copies of build.properties - one for Linux build and second for Windows build?


回答1:


The usual way to do this is to have separate plugins (or plugin fragments) for each platform with a platform filter which restricts when the plugin is available:

For example, in the MANIFEST.MF

Eclipse-PlatformFilter: (& (osgi.ws=cocoa) (osgi.os=macosx) (osgi.arch=x86_64) )

restricts the plugin to only Mac OS X 64 bit, Cocoa.

This is what SWT does. There is a base org.eclipse.swt plugin which doesn't contain any code and then multiple plugin fragments extending that plugin (such as org.eclipse.swt.cocoa.macosx.x86_64). Each fragment contains the SWT code for a platform, all implementing the same classes.

Eclipse only loads the plugin for the current platform so you don't have to do any work choosing what to use.



来源:https://stackoverflow.com/questions/35989328/eclipse-rcp-build-properties-for-multiple-platforms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!