Difference between revisions of "Tycho/Demo Projects/RCP Application"

From Eclipsepedia

Jump to: navigation, search
Line 49: Line 49:
 
# A symbolic link <tt>hello_alias</tt> to the <tt>hello</tt> script is created in the root of the installation for Linux. (Due to [http://jira.codehaus.org/browse/MASSEMBLY-343 MASSEMBLY-343] links are resolved when the zip archive is created.).
 
# A symbolic link <tt>hello_alias</tt> to the <tt>hello</tt> script is created in the root of the installation for Linux. (Due to [http://jira.codehaus.org/browse/MASSEMBLY-343 MASSEMBLY-343] links are resolved when the zip archive is created.).
  
Note: Permissions and symbolic links will work if the projects are built on Linux.
+
Note: Permissions and symbolic links will only work if the project is built on a filesystem with support for permissions and symbolic links.
  
 
[[Category:Tycho|Demo Projects/RCP Application]]
 
[[Category:Tycho|Demo Projects/RCP Application]]
 
[[Category:Tycho Examples|Demo Projects/RCP Application]]
 
[[Category:Tycho Examples|Demo Projects/RCP Application]]

Revision as of 08:15, 15 March 2013

This page describes the RCP application in tycho-demo/itp04-rcp. The project shows how Tycho supports p2-enabled RCP applications, including how to add files to the root of an RCP application.

The RCP application contains a typical feature-based product (main.product) located in the module eclipse-repository. In the same module a category definition file (category.xml) specifies different categories for two features (example-feature and example-feature-2).

Executing mvn clean install on the root directory tycho-demo/itp04-rcp results in a p2 repository in the target folder of the eclipse-repository module (eclipse-repository/target/repository). The repository's content is defined by the product definition main.product and the category.xml in the root of the eclipse repository project.

Another build result is a ready-to-use installation of the product as a zip file (itp04-rcp/eclipse-repository/target/products/*.zip). These additional artifacts are created by two additional tycho-p2-director-plugin goals configured in the pom.xml of the eclipse-repository module:

<plugin>
	<groupId>org.eclipse.tycho</groupId>
	<artifactId>tycho-p2-director-plugin</artifactId>
	<version>${tycho-version}</version>
	<executions>
		<execution>
			<id>materialize-products</id>
			<goals>
				<goal>materialize-products</goal>
			</goals>
		</execution>
		<execution>
			<id>archive-products</id>
			<goals>
				<goal>archive-products</goal>
			</goals>
		</execution>
	</executions>
</plugin>

Unzipping the product archive itp04-rcp/eclipse-repository/target/products/example.product.id-win32.win32.x86_64.zip and starting the contained eclipse.exe will open a very small application window. Because the feature org.eclipse.equinox.p2.user.ui was added to the main.product file the application also contains the p2 menu entries and actions to update the product.

You can verify that this RCP demo application can be updated using P2:

  1. Install new Software... allows to install additional features into the RCP demo application. Just add the desired software site in the Available Software Sites preferences page and then select Help > Install new Software....
  2. Check for Updates allows to update this product. Create a new version to check this:
    • Increment the example product and feature version e.g. from 0.1.0 to 0.2.0 and build again the entire RCP.
    • In the running RCP demo application add the following url as Available Software Sites in the preferences: file:/<local path>/itp04-rcp/eclipse-repository/target/repository.
    • Select the added software site and press Reload.
    • Use Help > Check for Updates to confirm that product and included feature with a new version can be updated to the new version.
  • Adding root files*

Since 0.11.0, Tycho supports root properties according to [1]. (Limitations: root.folder properties are not supported)

The demo RCP application makes use of the root properties. The build.properties of example-feature, which is installed in the RCP application, has the following effect:

  1. The file example-feature/README.txt is added to the root of all product installations.
  2. Different execution environment specific files doc_linux.html and doc_win.html are added to a doc/ subfolder of the respective product installations. The sources of these files are example-feature/rootfiles/linux, respectively example-feature/rootfiles/windows.
  3. In the product installation for Linux, the executable flag is set for the file scripts/hello. (The file is included through the line root.linux.gtk.x86 = rootfiles/linux int the feature's build.properties.)
  4. A symbolic link hello_alias to the hello script is created in the root of the installation for Linux. (Due to MASSEMBLY-343 links are resolved when the zip archive is created.).

Note: Permissions and symbolic links will only work if the project is built on a filesystem with support for permissions and symbolic links.