I created a command component for OSGi and using Apache Felix Shell. One command opens a new Thread which starts a SWT UI.
In the BND Config the SWT Bundle is required for building and to run this component. The Problem now is, that every developer has to change the config and include the SWT Bundle for their OS. Also for every OS a other packed Bundle is needed, where the only difference is a line in the Manifest of the jar, which other Bundles are required to launch.
Is there any trick in BND or OSGi, where i can set a build or run dependency dependent on the current running system?
Something like "org.eclipse.swt.{OS}.{WS}.{ARCH}" instead of "org.eclipse.swt.win32.win32.x86_64"? Or at least can I require a specific OS in the config? So that if a user uses a wrong bundle, it shows a nice error instead of a ClassNotFound Exception?
The solution described in another question (http://stackoverflow.com/questions/2706222/create-cross-platform-java-swt-application/5784073#5784073) doesn't work for me or better I don't know how this could be done with BND/OSGi.
Any Idea?
bnd can use includes. So create a standard configuration and include this in platform specific bndrun files.
bnd.bnd:
# standard set that uses macros for the places where specials need to be insered
-runbundles: \
....
${platformdeps}
windows.bndrun:
-include bnd.bnd
platformdeps = org.eclipse.swt.win.x86.jar
Anyway, look at bndtools. Neil Bartlett builds bndtools in bndtools without PDE. So he has bndrun files for all platforms.
There is also an ${if ... } macro or a ${replace } macro. If people would still pay for books instead of downloading pirated versions ... Until that small problem is solved, look at http://www.aqute.biz/Bnd/Bnd