9.2. Exporting for Other PlatformsBut what about your friends who use different operating or window systems or run on different hardware? They can't run the Hyperbola you just built because it contains platform-specific code. To package for other platforms, you either need to run on that platform, which is hard to manage, or you must have the code for those platforms on your machine. This is a typical cross-platform development scenario. The first problem is to acquire all the platform-specific Eclipse code needed for these other platforms. Fortunately, the Eclipse platform team supplies a delta pack for every release. The delta pack contains all parts of the Eclipse SDK that are platform-specific. So, for example, if you are on Windows and want to export Hyperbola for Linux/GTK, you need the delta pack. Note The issue of platform-specific code shows up for several plug-ins in the Eclipse platform. SWT, for example, has considerable amounts of platform-specific code. Several other plug-ins have platform-specific fragments that deliver natives and Java code to support optimizations. In some cases (e.g., Resources), the plug-ins work fine without the platform fragments, but with the fragments they are faster or support enhanced function. The CD with this book includes the Eclipse 3.1 delta pack. You can also get it from the Eclipse downloads site, http://eclipse.org/downloads, by going to the Eclipse Platform downloads page. Scroll down to the section labeled Eclipse RCP SDK and download the RCP delta pack. It should be in a file similar to: eclipse-RCP-3.1-delta-pack.zipThere is only one delta pack since by definition it covers every platform. Get the file from the download site or the CD and expand it over top of your target to add in the files for the other platforms. Note When you expand the delta pack, you will likely be prompted whether or not to replace various plug-ins that are already installed. You can safely answer either way, assuming you got the delta pack version that matches your target version. All that is left is to tell Eclipse about the new plug-ins and fragments. Update the target platform definition by going to the Window > Preferences > Plug-in Development > Target Platform preference page. The target location is already set, so just click Reload. PDE reloads the plug-ins and fragments from the target location and discovers the new elements from the delta pack. Check that the list contains several new plug-ins for other platforms and click OK to dismiss the Preferences dialog. You may notice some error log entries when PDE reloads the target platform. This is caused by PDE attempting to reconcile the new target elements but finding that various plug-ins are missing. This is expected. The delta pack contains platform-specific parts for all of the Eclipse SDK, not just the RCP. Note In Chapter 3, "Tutorial Introduction," we talked about the importance of keeping your target and development Eclipse installs separate. Using the delta pack is a fine example that motivates that practice. If you were using the development Eclipse install as a target, the simple default setup, the above steps would have added the delta pack to the development install. As a result, the development environment would be cluttered with extra and irrelevant plug-ins. Now your target has all the plug-ins, fragments, and launchers for every platform supported by Eclipse, but you have to set up your product to use them. Return to the Hyperbola product editor and switch to the Configuration page. In the Plug-ins and Fragments section, click Add... and select all the SWT-related elements listed, that is, all elements starting with "org.eclipse.swt". These are the SWT implementations for all supported platforms. Since SWT is the only platform-specific part of Hyperbola, that is all you need. Save the product configuration and open the Export wizard from the Overview page. Open the Export wizard as before and this time check the Export for multiple platforms option. Complete the first page of the wizard as before and click Next to get to the Cross-platform export page shown in Figure 9-3. Select the set of platforms for which you want to export and click Finish. Figure 9-3. Cross-platform export
The export output goes to archives or directories specific to the related platform. For example, the Windows output appears in the directory named c:\win32.win32.x86\Hyperbola 1.0. |