Time for action – switching to a specific version

The target platform created in the previous section is based on the Eclipse instance. It is much better to create a target platform for a specific version of Eclipse so that dependencies and testing can be performed against a specific version.

  1. Open the com.packtpub.e4.target.mars.target target definition file and remove the org.eclipse.e4.rcp, org.eclipse.platform and org.eclipse.rcp features, which correspond to the features in the current Eclipse instance.
  2. Click on Add and choose Software Site. In the Work with field, enter the update site for Eclipse Mars http://download.eclipse.org/releases/mars/ and then choose the Eclipse e4 Rich Client Platform (org.eclipse.e4.rcp), Eclipse Platform (org.eclipse.platform), and Eclipse RCP (org.eclipse.rcp) features from this list:
    Time for action – switching to a specific version
  3. After the update dialog has finished downloading the requirements, click on Set as Target Platform again to rebuild the projects with the Mars-specific version of Eclipse.

What just happened?

Instead of depending on the current version of Eclipse, target platforms can be used to point to a remote update site that provides a specific version of Eclipse. Although the same feature names are used, the versions of those features will correspond to those present in the named version of Eclipse.

This enables additional platforms to be created; for example, it is possible to create a target platform for Eclipse Neon or for future releases. Testing between different versions of Eclipse is then a case of switching between different target versions and running the tests appropriately, instead of having to have multiple versions of Eclipse downloaded.

Note

Although it is not necessary to have a target platform in its own project, when Tycho is used to build the application in Chapter 12, Automated Builds with Tycho, having the targets in their own projects allows them to be used in separate builds.

Have a go hero – configuring target platforms for other releases

Create new projects, com.packtpub.e4.target.neon and com.packtpub.e4.target.luna, along with the corresponding .target files, that correspond to the download releases http://download.eclipse.org/releases/neon/ and http://download.eclipse.org/releases/luna/ respectively. Switch the target platform to each of these and rebuild the workspace. Does it build as expected?

Tip

Building (and testing) against different versions of the platform will allow platform-specific dependencies to be identified and then fixed. Eclipse applications and plug-ins are often backward compatible with the past two released versions, and being able to test against older versions is the way to identify when dependencies creep in.

It is also possible to use explicit version numbers when defining the feature set of a target platform. This will ensure that a specific version of Eclipse is used, even if newer update sites are available on the remote site.

Pop quiz – understanding features, applications, and products

Q1. What is the keyword used in the version number that gets replaced by the timestamp?

Q2. What files get generated in an update site build?

Q3. What is the name of the file that allows an update site to be categorized?

Q4. What is the difference between feature requires and includes?

Q5. What is the difference between an application and a product?

Q6. What is an application's entry point?

Q7. What is a target definition and why is it used?

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.70.93