Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[buckminster-dev] Tutorial for building an RCP from hudson

Hi,

since I know from my own experience now that it is a non trivial task to build a working RCP application from a CI system like hudson, I'd like to create a wiki page about that. In this example I'd like to show the necessary steps to not only create a p2 repository from the org.eclipse.buckminster.tutorial.mailapp but actually build the product itself (utilizing the buckminster plugin for hudson).
However, I ran into some problems when I tried to build the application.
Invoking to p2 director to create the product from the repository built by buckminster produced the following error:

!MESSAGE Missing requirement: Equinox Provisioning Engine 1.0.100.v20090525 (org.eclipse.equinox.p2.engine 1.0.100.v20090525) requires 'package org.eclipse.equinox.internal.p2.persistence 0.0.0' but it could not be found

In order to make it run, I had to remove all plugins listed in org.eclipse.buckminster.tutorial.rcpp2.feature and instead include the org.eclipse.equinox.p2.user.ui feature and the org.apache.commons.logging plugin.

On top of that I added a cspecx and an ant script that invokes the p2 director to the org.eclipse.buckminster.tutorial.mailapp.product.feature.

A patch with the modification and the 2 new files is attached.

Now while this was sufficient to build the product from eclipse using Buckminster -> invoke action -> create.product.zip I'd like to get this more "real world ready" by showing how I'd integrate that into Hudson CI server.

For that demonstration I would like to use a new cquery and resource map for two reasons: 1. on your company's build system you need complete control over your artifacts so you probably don't want buckminster to fetch artifacts from all over the world

2. In my opinion it is not the best approach to have buckminster check-out stuff from your VCS if you are using a system like hudson. Not only that it's not immediatly visible where your workspace materializes from in the jobs configuration page, you're also losing the valuable feature that hudson shows you the change logs since the last build. In my build environment, I therefore let hudson check out the necessary modules and do only a local resolution with buckminster. Spoken in terms of rmaps, the only provider I'm using is this and it's always the same for all my products: <provider readerType="local" componentTypes="osgi.bundle,eclipse.feature" mutable="true" source="true">
        <uri format="file:///{0}/{1}/">
            <bc:propertyRef key="workspace.root" />
            <bc:propertyRef key="buckminster.component" />
        </uri>
    </provider>
All other resolutions are done with just the target platform provided by the setPref command.

Now why I'm writing all this:
First of all, do you think a tutorial like that would make sense in the wiki? And if so, do you agree with the way I'm building things, or should I change something for the wiki page?

To make the example really useful for people, the mail app would need to be buildable and I'd need the extra files available in SVN (see attached patch). Would you be willing to apply the patch and eventually host the new cquery that points to the simplified local-resolution rmap (I'll deliver both if you are ok with my general approach) so that they will be available for public?

Best regards and thanks for your time,
Johannes
### Eclipse Workspace Patch 1.0
#P org.eclipse.buckminster.tutorial.mailapp.product.feature
Index: buckminster.cspex
===================================================================
--- buckminster.cspex	(revision 0)
+++ buckminster.cspex	(revision 0)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<cspecExtension
+	xmlns:com="http://www.eclipse.org/buckminster/Common-1.0";
+	xmlns="http://www.eclipse.org/buckminster/CSpec-1.0";>
+
+	<actions>
+		<public name="create.product" actor="ant">
+            <actorProperties>
+                <property key="buildFile" value="build/product.ant"/>
+                <property key="targets" value="create.product"/>
+            </actorProperties>
+            <properties>
+                <property key="profile" value="MailProfile"/>
+                <property key="iu" value="org.eclipse.buckminster.tutorial.mailapp.product"/>
+            </properties>
+			<prerequisites alias="repository">
+				<attribute name="site.p2"/>
+			</prerequisites>
+            <products alias="destination" base="${buckminster.output}">
+            	<path path="MailApp/"/>
+            </products>
+		</public>
+		<public name="create.product.zip" actor="ant">
+            <actorProperties>
+                <property key="buildFileId" value="buckminster.pdetasks"/>
+                <property key="targets" value="create.zip"/>
+            </actorProperties>
+			<prerequisites alias="action.requirements">
+				<attribute name="create.product"/>
+			</prerequisites>
+            <products alias="action.output" base="${buckminster.output}">
+            	<path path="MailApp.zip"/>
+            </products>
+		</public>
+	</actions>
+</cspecExtension>
Index: build/product.ant
===================================================================
--- build/product.ant	(revision 0)
+++ build/product.ant	(revision 0)
@@ -0,0 +1,50 @@
+<project>
+	 <pathconvert property="equinox.launcher.jar">
+	   <first count="1">
+	     <sort>
+	       <fileset dir="${eclipse.home}/plugins" includes="**/org.eclipse.equinox.launcher_*.jar"/>
+	       <reverse xmlns="antlib:org.apache.tools.ant.types.resources.comparators">
+	         <date/>
+	       </reverse>
+	     </sort>
+	   </first>
+	 </pathconvert>
+
+	<target name="create.product">
+		<property name="destination" location="${sp:destination}"/>
+		<delete dir="${destination}"></delete>
+		<makeurl property="repository" file="${sp:repository}"/>
+		<mkdir dir="${destination}"/>
+		<echoproperties ></echoproperties>
+		<echo message="${equinox.launcher.jar}"/>
+		<echo message="${repository}"/>
+		<echo message="${destination}"/>
+		<java jar="${equinox.launcher.jar}" fork="true" failonerror="true" >
+			<arg value="-application"/>
+			<arg value="org.eclipse.equinox.p2.director"/>
+			<arg value="-artifactRepository"/>
+			<arg value="file:${repository}"/>
+			<arg value="-metadataRepository"/>
+			<arg value="file:${repository}"/>
+			<arg value="-destination"/>
+			<arg value="${destination}"/>
+			<arg value="-bundlepool"/>
+			<arg value="${destination}"/>
+			<arg value="-profile"/>
+			<arg value="${profile}"/>
+			<arg value="-profileProperties" />
+			<arg value="org.eclipse.update.install.features=true" />
+			<arg value="-installIU"/>
+			<arg value="${iu}"/>
+			<arg value="-p2.os" />
+			<arg value="${target.os}" />
+			<arg value="-p2.ws" />
+			<arg value="${target.ws}" />
+			<arg value="-p2.arch" />
+			<arg value="${target.arch}" />
+			<arg value="-consoleLog"/>
+			<jvmarg value="-Declipse.p2.data.area=${destination}/p2"/>
+			<jvmarg value="-Declipse.p2.profile=${profile}"/>
+		</java>
+	</target>
+</project>
\ No newline at end of file
#P org.eclipse.buckminster.tutorial.rcpp2.feature
Index: feature.xml
===================================================================
--- feature.xml	(revision 10406)
+++ feature.xml	(working copy)
@@ -16,242 +16,12 @@
       [Enter License Description here.]
    </license>
 
-   <plugin
-         id="org.eclipse.equinox.common"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.ecf"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.ecf.filetransfer"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.registry"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.osgi.services"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.core.net"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
+   <includes
+         id="org.eclipse.equinox.p2.user.ui"
+         version="0.0.0"/>
 
    <plugin
-         id="org.eclipse.equinox.p2.core"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.p2.director"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.p2.engine"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.p2.garbagecollector"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.p2.metadata.repository"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.p2.metadata"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.frameworkadmin"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.p2.artifact.repository"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.p2.publisher"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.p2.ui"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.frameworkadmin.equinox"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.simpleconfigurator"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.ecf.provider.filetransfer"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.p2.exemplarysetup"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.p2.touchpoint.eclipse"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.p2.touchpoint.natives"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.p2.ui.sdk"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.simpleconfigurator.manipulator"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.sat4j.core"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.sat4j.pb"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.security"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.security.macosx"
-         os="macosx"
-         arch="ppc,x86,x86_64"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         fragment="true"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.security.ui"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.preferences"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.p2.jarprocessor"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.equinox.app"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.eclipse.ecf.identity"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="com.ibm.icu"
+         id="org.apache.commons.logging"
          download-size="0"
          install-size="0"
          version="0.0.0"

Back to the top