Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "GraphitiBuildProcessDescription"

(Graphiti Build Process)
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
= Graphiti Build Process  =
 
= Graphiti Build Process  =
  
This page describes the Graphiti build setup. Thanks to the Teneo and CDO guys for providing a template for setting up a first version of our build and an excellent description of it (the [http://wiki.eclipse.org/Teneo/Teneo_Build_Setup Teneo build description] was also used as a template for this page). Graphiti uses [http://www.eclipse.org/buckminster/ Buckminster] and the [http://wiki.eclipse.org/Hudson Eclipse Hudson] for its continous build. The job [https://hudson.eclipse.org/hudson/job/gmp-graphiti-nightly/ gmp-graphiti-nightly] is used to build Graphiti's head version. To understand the content of this page it is necessary to understand the main Buckminster concepts. These are described in detail in the [http://www.eclipse.org/downloads/download.php?file=/tools/buckminster/doc/BuckyBook.pdf Bucky Book]. Some Buckminster concepts can seem fairly abstract initially, the 'Understanding Buckminster' section below may help here.  
+
This page describes the Graphiti build setup. Thanks to the Teneo and CDO guys for providing a template for setting up a first version of our build and an excellent description of it (the [http://wiki.eclipse.org/Teneo/Teneo_Build_Setup Teneo build description] was also used as a template for this page). Graphiti uses [http://www.eclipse.org/buckminster/ Buckminster] and the [http://wiki.eclipse.org/graphiti/ Graphiti Hudson instance] for its continuous build. The job [https://hudson.eclipse.org/graphiti/job/graphiti.nightly/ graphiti.nightly] is used to build Graphiti's head version. To understand the content of this page it is necessary to understand the main Buckminster concepts. These are described in detail in the [http://www.eclipse.org/downloads/download.php?file=/tools/buckminster/doc/BuckyBook.pdf Bucky Book]. Some Buckminster concepts can seem fairly abstract initially, the 'Understanding Buckminster' section below may help here.  
  
 
== Local Execution<br>  ==
 
== Local Execution<br>  ==
Line 7: Line 7:
 
It should be possible to do a local Graphiti build. [TODO: describe the necessary steps]<br>  
 
It should be possible to do a local Graphiti build. [TODO: describe the necessary steps]<br>  
  
== Understanding Buckminster ==
+
== Understanding Buckminster ==
  
This section may help to make it a bit clearer how Buckminster works. The main functionality (for use within the Graphiti build):  
+
This section may help to make it a clearer how Buckminster works. The main functionality (for use within the Graphiti build):  
  
 
*Buckminster creates workspaces and target platforms for running the build and test. These workspaces are the same or similar to what you see in your IDE.  
 
*Buckminster creates workspaces and target platforms for running the build and test. These workspaces are the same or similar to what you see in your IDE.  
Line 23: Line 23:
 
*'''mspec file''': This file is the starting point. It specifies which cquery file to use and also how the plugins/development projects downloaded as part of resolving the cquery file should be treated, or materialized. Materialized means: where to place the downloaded plugins/development projects, in the workspace or in the target platform.
 
*'''mspec file''': This file is the starting point. It specifies which cquery file to use and also how the plugins/development projects downloaded as part of resolving the cquery file should be treated, or materialized. Materialized means: where to place the downloaded plugins/development projects, in the workspace or in the target platform.
  
&lt;h4&gt;Main Build Steps&lt;/h4&gt;<br>&lt;p&gt;The Graphiti build process is executed through an ant script<br>which calls Buckminster for the main build steps. The ant script goes<br>through the following steps.&lt;/p&gt;<br>&lt;ol&gt;<br> &lt;li&gt;Download the p2 director and using the director, download<br> buckminster&lt;/li&gt;<br> &lt;li&gt;Download the development projects from CVS and use them to<br> create a workspace with a target platform&lt;/li&gt;<br> &lt;li&gt;Download/retrieve the dependencies and set them in the target<br> platform&lt;/li&gt;<br> &lt;li&gt;Build the software (including the test plugins)&lt;/li&gt;<br> &lt;li&gt;Build the update site&lt;/li&gt;<br> &lt;li&gt;Create downloadable zips&lt;/li&gt;<br> &lt;li&gt;Run the test cases and convert the test results to a format<br> which can be read by Hudson&lt;/li&gt;<br>&lt;/ol&gt;
+
== Main Build Steps ==
  
&lt;p&gt;The following sections describe the necessary files for the<br>build: the ant xml files and the buckminster files.&lt;/p&gt;
+
The Graphiti build job executes 2 build steps: the first one is a Linux shell script that sets up the environment for the build job, the second one defines the Buckminster steps to process. The latter will be describes in more detail below, here are just a few reamrks for the shell script part:
  
&lt;h4&gt;Structure of build projects/features&lt;/h4&gt;<br>&lt;p&gt;The build infrastructure for Graphiti is centered around a releng<br>project containing the ant build.xml file and the main Buckminster<br>files. A number of other feature projects are used to define which<br>plugins are part of the build, part of the update site and which are<br>part of the tests. The releng and feature projects can be found in the<br>CVS location<br>dev.eclipse.org/cvsroot/modeling/org.eclipse.gmp/org.eclipse.gmp.graphiti<br>in the folders releng (releng project) and features (feature projects).&lt;/p&gt;
+
*It starts off with deleting the remains from previous builds
 +
*Then it creates a properties file containing all the properties defined in the properties file retrieved from the releng project plus defining some more.
  
&lt;p&gt;The org.eclipse.graphiti.releng project contains the ant and the<br>buckminster files for the build and test steps. The content of this<br>project and the buckminster setup is described in more detail below.<br>This project is the most important one to look at when trying to<br>understand Graphiti's build setup. The feature projects are used to<br>structure the output of the build in the correct way, i.e. which<br>features/plugins are made available via an update site, which<br>features/plugins are involved in testing etc. Here is a summary of these<br>feature projects:&lt;/p&gt;<br>&lt;ul&gt;<br> &lt;li&gt;&lt;b&gt;org.eclipse.graphiti.site&lt;/b&gt; - Defines the update site and<br> the main features. This project contains a buckminster.cspex file to<br> define extra dependencies for stuff added via package imports (this is<br> described in more detail below). The included features are:<br> &lt;ul&gt;<br> &lt;li&gt;org.eclipse.graphiti.feature - The Graphiti runtime feature&lt;/li&gt;<br> &lt;li&gt;org.eclipse.graphiti.feature.examples - The documentation and<br> the tutorial plugin for Graphiti&lt;/li&gt;<br> &lt;/ul&gt;<br> &lt;li&gt;&lt;b&gt;org.eclipse.graphiti.tests-feature&lt;/b&gt; - Contains the test<br> plugins and their dependencies. The test plugins contain test launch<br> configurations (see below running test cases).&lt;/li&gt;<br>&lt;/ul&gt;
+
The next step of the build is the main part. It is a Buckminster script that performs several steps:  
  
&lt;h4&gt;Main build project: org.eclipse.graphiti.releng&lt;/h4&gt;<br>&lt;p&gt;After downloading the main build project from cvs you can see<br>that it consists of several files in the root and the xsl subfolder.<br>Here is a summary for the meaning of different files:&lt;/p&gt;<br>&lt;ul&gt;<br> &lt;li&gt;&lt;b&gt;build.properties:&lt;/b&gt; defines several properties related to<br> how to sign plugins and where to download the director and buckminster<br> applications. Used within the central build.&lt;/li&gt;<br> &lt;li&gt;&lt;b&gt;local.properties:&lt;/b&gt; defines several properties related to<br> how to sign plugins and where to download the director and buckminster<br> applications. Used within the local build.&lt;/li&gt;<br> &lt;li&gt;&lt;b&gt;build.xml:&lt;/b&gt; the main build file which drives the build<br> and test phases. Its content is described in more detail below.&lt;/li&gt;<br>&lt;/ul&gt;<br>&lt;p&gt;The Graphiti build consists of three steps: 1) build the Graphiti<br>plugins and features, 2) use these build results to set up a P2 update<br>site and 3) run the tests. The build.xml file has 3 main targets:&lt;/p&gt;<br>&lt;ul&gt;<br> &lt;li&gt;test: is the main target, builds the core plugins, creates an<br> update site and runs the test cases&lt;/li&gt;<br> &lt;li&gt;promote.sites: copies the created update site to another<br> location where it is available for everyone, again uses Buckminster to<br> do so&lt;/li&gt;<br> &lt;li&gt;clean.all: cleans the tools and output directories, uses<br> standard ant remove directory commands&lt;/li&gt;<br>&lt;/ul&gt;<br>&lt;p&gt;The interesting one is the test command, this one is explained in<br>more detail.&lt;/p&gt;
+
*Set the Java compliance level to Java 6
 +
*Define the folder for the target platform (where BuckminstAllJunitUiTests.launcher syncs all binary usages to)
 +
*Import an API baseline definition. The definition file resides in the releng project and defines different baselines according to the current version. Note that in the 0.7.x codelines no baseline definition file exists, so in case you do a 0.7.x build you will need to comment out this line.
 +
*Do the actual import of the sources and binaries: download the development projects from CVS and use them to create a workspace and download/retrieve the dependencies to the target platform.  
 +
*Do the Java build  
 +
*Create the JavaDoc (happens via a Buckminster call to execute an Ant script defined in the releng project.  
 +
*Creates the site by performing the Buckminster command site.p2.zip. This will first create the site.p2, the - if enabled - sign the site, create teh site.signed and the site.p2.zip file.  
 +
*Create an html and xml index for the site (stating which features and plugins in which version is contained). This again happens via a Buckminster call to execute an ANt script resideing in the releng project.  
 +
*Start the test runs. There are currently 3 test suites executed defined via launch configs:
 +
**AllJunitTests.launch: Starts the JUnit tests for the plugin org.eclipse.graphiti<br>  
 +
**AllJunitUiTests.launch: Starts the JUnit tests for the plugin org.eclipse.graphiti.ui<br>  
 +
**AllBotTests.launch: Starts the SWTBot tests for the complete framework<br>  
 +
*Copy the build result to the last_success folder. This again happens via a Buckminster call to n Ant script defined in the releng project
 +
*The actual promotion (publishing the site to the Eclipse download area (head or dev download site as stated on the [http://www.eclipse.org/graphiti/download.php Graphiti Downloads page]) is done by a cron job defined for user mwenz that runs once a day in the evening. The reason is that the hudson job does not have write permission for the downloads area.
  
&lt;p&gt;This test target depends on the target site.p2 and triggers the<br>test runs for Graphiti (there are 3 of them: a JUnit test run for each<br>the plugins org.eclipse.graphiti and org.eclipse.graphiti.ui and a<br>SWTBot-based test).&lt;/p&gt;
+
By using a Buckminster script we get the setup of Buckminster for free. We use the Buckminster 3.7 installation on the Eclipse Hudson. The following sections describe the necessary files for the build.  
  
&lt;p&gt;Before the site.p2 command is run which triggers a build using<br>Buckminster, creates an update site again by using Buckminster and<br>providing human readable content descriptions.&lt;/p&gt;
+
=== Structure of build projects/features  ===
  
&lt;p&gt;This step again depends on the "provision" step which sets up all<br>the relevant variables (e.g. from the properties files), installs the<br>Buckminster Director application, the actual Buckminster installation<br>and collects the target platform and workspace to do the build.&lt;/p&gt;
+
The build infrastructure for Graphiti is centered around a releng project containing the all necessary files. A number of other feature projects are used to define which plugins are part of the build, part of the update site and which are part of the tests. The releng and feature projects can be found in the CVS location ''dev.eclipse.org/cvsroot/modeling/org.eclipse.gmp/org.eclipse.gmp.graphiti'' in the folders releng (for the releng project) and features (for the feature projects).
  
&lt;h5&gt;&lt;b&gt;Build:&lt;/b&gt;&lt;/h5&gt;<br>&lt;p&gt;The build setup consists of the following files:&lt;/p&gt;<br>&lt;ul&gt;<br> &lt;li&gt;&lt;b&gt;build.cquery:&lt;/b&gt; this files defines the root request<br> project. It is the releng project that again defines the dependencies<br> which projects to retrieve from cvs; this is mainly the site feature<br> with its complete dependency tree. The content of the root feature<br> project in the feature.xml (and an additional dependency definition<br> file, a cspex file, see below) specifies which development projects to<br> download.&lt;/li&gt;<br> &lt;li&gt;&lt;b&gt;build.mspec:&lt;/b&gt; this file specifies that dependencies<br> which are source (source="true") should be materialized in the<br> workspace, while the other dependencies are materialized in the target<br> platform.&lt;/li&gt;<br> &lt;li&gt;&lt;b&gt;build.rmap:&lt;/b&gt; defines where and how development projects<br> and dependencies can be downloaded. This file for example lists cvs<br> locations and several update sites.&lt;/li&gt;<br>&lt;/ul&gt;<br>&lt;p&gt;The mspec file is the starting point for Buckminster. Its<br>content:&lt;/p&gt;<br>&lt;pre&gt;<br> &lt;code&gt;<br>&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;<br>&amp;lt;mspec:mspec xmlns:mspec="http://www.eclipse.org/buckminster/MetaData-1.0" installLocation="" materializer="p2" name="build.mspec" url="build.cquery"&amp;gt;<br> &amp;lt;mspec:property key="target.os" value="*"/&amp;gt;<br> &amp;lt;mspec:property key="target.ws" value="*"/&amp;gt;<br> &amp;lt;mspec:property key="target.arch" value="*"/&amp;gt;<br> &amp;lt;mspec:mspecNode materializer="workspace" filter="(buckminster.source=true)"/&amp;gt;<br>&amp;lt;/mspec:mspec&amp;gt;<br> &lt;/code&gt;<br>&lt;/pre&gt;
+
The ''org.eclipse.graphiti.releng'' project contains the Buckminster files for the build and test steps. The content of this project and the buckminster setup is described in more detail below. This project is the most important one to look at when trying to understand Graphiti's build setup. The feature projects are used to structure the output of the build in the correct way, i.e. which features/plugins are made available via an update site, which features/plugins are involved in testing etc. Here is a summary of these feature projects:  
  
&lt;p&gt;This file specifies two things: firstly, which query file to use,<br>the cquery file is explained below, it defines which root feature<br>project to download as a starting point for the build and secondly, how<br>to materialize: as a default materialize to the target platform<br>(materializer="p2"), only if source is "true" materialize to the<br>workspace. As noted above the mspec file defines which cquery file to<br>use; here's the content of the cquery file:&lt;/p&gt;<br>&lt;pre&gt;<br> &lt;code&gt;<br>&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;<br>&amp;lt;cq:componentQuery xmlns:cq="http://www.eclipse.org/buckminster/CQuery-1.0" resourceMap="build.rmap"&amp;gt;<br> &amp;lt;cq:rootRequest name="org.eclipse.graphiti.releng" componentType="buckminster"/&amp;gt;<br> &amp;lt;cq:advisorNode namePattern="^org\.eclipse\.graphiti(\..+)?\.source*" skipComponent="true"/&amp;gt;<br> &amp;lt;cq:advisorNode namePattern=".*" useMaterialization="false" useTargetPlatform="false"/&amp;gt;<br>&amp;lt;/cq:componentQuery&amp;gt;<br> &lt;/code&gt;<br>&lt;/pre&gt;<br>&lt;p&gt;The cquery file defines which rmap file to use, the rmap file<br>specifies the download locations (update sites) and cvs locations to<br>download dependencies. Buckminster needs a root project to use as a<br>starting point which is defined by the rootRequest tag. The advisorNode<br>tag is used to tell Buckminster to ignore dependencies (defined in<br>feature.xml files) which have a pattern starting with<br>org.eclipse.graphiti and ending with source. This is needed because the<br>SDK feature projects contain these dependencies. However, these *.source<br>plugins/features do not exist in cvs but are created by<br>Buckminster/Eclipse during the build. So they should be ignored when<br>downloading dependencies. See &lt;a<br> href="http://www.eclipse.org/forums/index.php?t=tree&amp;th=162136&amp;"&gt;here&lt;/a&gt;<br>for a thread on the Buckminster newsgroup on this.&lt;/p&gt;
+
*''org.eclipse.graphiti.site'' - Defines the update site and the main features. This project contains a buckminster.cspex file to define extra dependencies for stuff added via package imports (this is described in more detail below). The included features are:  
 +
**org.eclipse.graphiti.feature - The Graphiti runtime feature<br>  
 +
**org.eclipse.graphiti.feature.examples - The documentation and the tutorial plugin for Graphiti<br>  
 +
*''org.eclipse.graphiti.tests-feature'' - Contains the test plugins and their dependencies. The test plugins contain test launch configurations (see below running test cases).<br>
  
&lt;p&gt;The rmap file describes where Buckminster can download the<br>development projects and dependencies. For example the following snippet<br>defines the cvs location for the Graphiti plugins (note also the<br>source="true" attribute which signals Buckminster to treat these<br>dependencies as source and put them in the workspace (see the mspec file<br>above)).&lt;/p&gt;<br>&lt;pre&gt;<br> &lt;code&gt;<br> &amp;lt;rm:searchPath name="releng"&amp;gt;<br> &amp;lt;rm:provider componentTypes="buckminster,osgi.bundle" readerType="cvs"&amp;gt;<br> &amp;lt;rm:uri format="{0},org.eclipse.gmp/org.eclipse.gmp.graphiti/releng/{1}"&amp;gt;<br> &amp;lt;bc:propertyRef key="cvs.repository"/&amp;gt;<br> &amp;lt;bc:propertyRef key="buckminster.component"/&amp;gt;<br> &amp;lt;/rm:uri&amp;gt;<br> &amp;lt;/rm:provider&amp;gt;<br> &amp;lt;rm:provider componentTypes="eclipse.feature" readerType="cvs"&amp;gt;<br> &amp;lt;rm:uri format="{0},org.eclipse.gmp/org.eclipse.gmp.graphiti/features/{1}"&amp;gt;<br> &amp;lt;bc:propertyRef key="cvs.repository"/&amp;gt;<br> &amp;lt;bc:propertyRef key="buckminster.component"/&amp;gt;<br> &amp;lt;/rm:uri&amp;gt;<br> &amp;lt;/rm:provider&amp;gt;<br> &amp;lt;/rm:searchPath&amp;gt;<br> &lt;/code&gt;<br>&lt;/pre&gt;
+
=== Main build project: org.eclipse.graphiti.releng<br> ===
  
&lt;p&gt;Then create the p2 site, note that the top feature used for the<br>site is not included in the site (as a default, see an option a few<br>lines further down).&lt;/p&gt;<br>&lt;pre&gt;<br> &lt;code&gt;<br>&amp;lt;buckminster command="perform" workspace="${workspacePath}"&amp;gt;<br> &amp;lt;cmdargs&amp;gt;<br> &amp;lt;arg value="org.eclipse.graphiti.site#site.p2" /&amp;gt;<br> &amp;lt;/cmdargs&amp;gt;<br>&amp;lt;/buckminster&amp;gt;<br> &lt;/code&gt;<br>&lt;/pre&gt;
+
After downloading the main build project from cvs you can see that it consists of several files in the root and the xsl subfolder. Here is a summary for the meaning of different files:<br>  
  
&lt;p&gt;This concludes the build step. The next step is testing using the<br>output from the build process.&lt;/p&gt;
+
*''build.mspec:'' This file is the starting point for Buckminster. This file specifies two things: firstly, which query file to use, the cquery file is explained below, it defines which root feature project to download as a starting point for the build and secondly, how to materialize: as a default materialize to the target platform (materializer="p2"), only if source is "true" materialize to the workspace.
 +
*''build.cquery:'' The cquery file defines which rmap file to use, the rmap file specifies the download locations (update sites) and cvs locations to download dependencies. Buckminster needs a root project to use as a starting point which is defined by the rootRequest tag. The advisorNode tag is used to tell Buckminster to ignore dependencies (defined in feature.xml files) which have a pattern starting with org.eclipse.graphiti and ending with source. This is needed because the SDK feature projects contain these dependencies. However, these *.source plugins/features do not exist in cvs but are created by Buckminster/Eclipse during the build. So they should be ignored when downloading dependencies. See [http://www.eclipse.org/forums/index.php?t=tree&th=162136& www.eclipse.org/forums/index.php] for a thread on the Buckminster newsgroup on this. Besides it can give additional hints for the retrieval of components (e.g. you can define a branch for the source retrieval here).<br>
 +
*''APIbaseLine.target:'' defines a target platform that will be used as the API baseline for the build
 +
*''buckminster.ant'': Defines the Ant tasks used in the build (e.g create the JavaDoc,create the index files, copy build results)
 +
*''buckminster.cspec:'' defines additional dependencies and the actions to trigger for the Ant tasks in buckminster.ant
 +
*''build.properties:'' defines several properties related to how to sign plugins and where the download folder reside (both to download dependencies from and to upload the build result to. This file is used within the central build on the Eclipse Hudson.<br>
 +
*''build.rmap:'' Defines the update sites and CVS locations were to download the different components from (applies for both source and binary components)
 +
*''local.properties:'' same as ''build.properties'' but intended to be used for local builds.<br>
  
&lt;h5&gt;Test:&lt;/h5&gt;<br>&lt;p&gt;The test task finally call the tests on the previously build<br>plugins.&lt;/p&gt;
+
=== Test Calls<br> ===
  
&lt;p&gt;The build.xml has a "test" target which performs the necessary<br>steps to run the test cases. The emma command will run junit with code<br>coverage checking. See a later section on code coverage setup. Instead<br>of the emma command, the command 'junit' could also have been used (but<br>then no code coverage report is created of course). The junit test run<br>itself consists of calling a launch configuration and defining the<br>output of the test results. The launch configuration has been created<br>manually and checked into cvs.&lt;/p&gt;<br>&lt;pre&gt;<br> &lt;code&gt;<br>&amp;lt;buckminster command="emma" workspace="${workspacePath}"&amp;gt;<br> &amp;lt;cmdargs&amp;gt;<br> &amp;lt;arg value="-l" /&amp;gt;<br> &amp;lt;arg value="org.eclipse.graphiti.tests/AllJunitTests.launch" /&amp;gt;<br> &amp;lt;arg value="-o" /&amp;gt;<br> &amp;lt;arg value="${testResultsPath}/output/JUnit-graphiti-results.xml" /&amp;gt;<br> &amp;lt;arg value="--stdout" /&amp;gt;<br> &amp;lt;arg value="${testResultsPath}/output/JUnit-graphiti-stdout.txt" /&amp;gt;<br> &amp;lt;arg value="--stderr" /&amp;gt;<br> &amp;lt;arg value="${testResultsPath}/output/JUnit-graphiti-stderr.txt" /&amp;gt;<br> &amp;lt;arg value="--xml" /&amp;gt;<br> &amp;lt;arg value="${testResultsPath}/output/JUnit-graphiti-coverageReport.xml" /&amp;gt;<br> &amp;lt;arg value="--flatXML"/&amp;gt;<br> &amp;lt;/cmdargs&amp;gt;<br>&amp;lt;/buckminster&amp;gt;<br> &lt;/code&gt;<br>&lt;/pre&gt;<br>&lt;p&gt;The flatXML argument is used to convert the output from the tests<br>to a result which can be read by Hudson.&lt;/p&gt;
+
The flatXML argument is used to convert the output from the tests to a result which can be read by Hudson.
  
&lt;h4&gt;Defining dependencies: buckminster.cspex&lt;/h4&gt;<br>&lt;p&gt;Buckminster uses the explicit plugin dependencies in the<br>MANIFEST.MF to download related project and binary dependencies.<br>Buckminster can however not directly/automatically resolve dependencies<br>defined by the import-packages directive. This is logical as Buckminster<br>can not identify the plugins to download, just on the basis of the<br>package name. To solve this, it is possible to define additional<br>dependencies using a so-called buckminster.cspex file. The Graphiti<br>build has a buckminster.cspex file in two feature projects and in the<br>releng project:&lt;/p&gt;<br>&lt;ul&gt;<br> &lt;li&gt;org.eclipse.graphiti.site-feature&lt;/li&gt;<br> &lt;li&gt;org.eclipse.graphiti.tests-feature&lt;/li&gt;<br> &lt;li&gt;org.eclipse.graphiti.releng&lt;/li&gt;<br>&lt;/ul&gt;<br>&lt;p&gt;The releng project is used in therootRequest of the cquery file<br>and delegates to the two feature projects. Note, the file containing the<br>additional dependencies must be called buckminster.cspex.&lt;/p&gt;<br>&lt;p&gt;This cspex file defines dependencies on several eclipse features.<br>The rmap file define where to find these features (i.e. which update<br>site for example).&lt;/p&gt;
+
=== Defining Additional Dependencies: buckminster.cspex ===
  
&lt;h4&gt;Testing&lt;/h4&gt;<br>&lt;p&gt;Testcases are run through Buckminster using a launch<br>configuration (so Buckminster calls a launch configuration). Graphiti<br>has 3 launch configurations one for running JUnit tests for the core<br>plugin (org.eclipse.graphiti), one for running JUnit tests for the UI<br>plugin (org.eclipse.graphiti.ui) and one for running the SWTBot tests<br>for the complete framework (UI tests).&lt;/p&gt;<br>&lt;p&gt;The launch configuration is easy to create, after running your<br>test suite in Eclipse, a run configuration should be present in the<br>window Run &gt; Run Configurations. To store the run/launch configuration<br>in a file: in the last tab of the configuration (Common), the save as<br>location is set to a shared file in a project. The file is checked-in<br>into cvs. This shared file is then used as the input to the test run<br>through buckminster, see the call for running the tests above. The<br>output location is specified with the -o parameter. The xml in the<br>output location is used by Hudson to create a test report.&lt;/p&gt;
+
Buckminster uses the explicit plugin dependencies in the MANIFEST.MF to download related project and binary dependencies. Buckminster can however not directly/automatically resolve dependencies defined by the import-packages directive. This is logical as Buckminster can not identify the plugins to download, just on the basis of the package name. To solve this, it is possible to define additional dependencies using a so-called buckminster.cspex file. The Graphiti build has a buckminster.cspex file in two feature projects:
  
&lt;h4&gt;Defining and creating an update site&lt;/h4&gt;<br>&lt;p&gt;The Graphiti build creates an update site, which site is defined<br>through a feature project: the org.eclipse.graphiti.site project. It has<br>one important file:&lt;/p&gt;<br>&lt;ul&gt;<br> &lt;li&gt;feature.xml: defines which features are part of the update<br> site&lt;/li&gt;<br>&lt;/ul&gt;<br>&lt;p&gt;The feature.xml contains 2 features:&lt;/p&gt;<br>&lt;ul&gt;<br> &lt;li&gt;org.eclipse.graphiti.feature&lt;/li&gt;<br> &lt;li&gt;org.eclipse.graphiti.feature.examples&lt;/li&gt;<br>&lt;/ul&gt;<br>&lt;p&gt;To build the update site the build xml file contains the<br>following snippet:&lt;/p&gt;<br>&lt;pre&gt;<br> &lt;code&gt;<br>&amp;lt;buckminster command="perform" workspace="${workspacePath}"&gt;<br> &amp;lt;cmdargs&gt;<br> &amp;lt;arg value="org.eclipse.graphiti.site:eclipse.feature#site.p2" /&gt;<br> &amp;lt;/cmdargs&gt;<br>&amp;lt;/buckminster&gt;<br> &lt;/code&gt;<br>&lt;/pre&gt;<br>&lt;p&gt;Buckminster is called with the org.eclipse.graphiti.site feature<br>(note feature id is used here, not the project name - here thi sis not<br>relevant since they are the same, but they might differ), and the<br>site.p2 call. As a default (is option controlled) the content of the<br>passed in feature is used for the content of the site, so the feature<br>project (org.eclipse.graphiti.site) itself is not part of the update<br>site.&lt;/p&gt;
+
*org.eclipse.graphiti.site
 +
*org.eclipse.graphiti.tests-feature
  
&lt;h4&gt;Code Coverage&lt;/h4&gt;<br>&lt;p&gt;It is quite easy to enable code coverage analysis as part of the<br>test run. This section explains how to set it up.&lt;/p&gt;<br>&lt;p&gt;First make sure that the<br>org.eclipse.buckminster.emma.headless.feature.feature.group feature is<br>installed as part of the Buckminster install. See the<br>install.buckminster target in Graphiti's build.xml. To enable code<br>coverage analysis in Buckminster you have to use the 'emma' command<br>instead of the 'junit' command when calling Buckminster and pass an<br>extra xml parameter with the output location of the code coverage<br>analysis.&lt;/p&gt;
+
The releng project is used in the rootRequest of the cquery file and delegates to the two feature projects. Note, the file containing the additional dependencies must be called buckminster.cspex. This cspex file defines dependencies on several eclipse features. The rmap file define where to find these features (i.e. which update site for example).
  
<br>
+
=== Testing ===
  
<br>
+
Testcases are run through Buckminster using a launch configuration (so Buckminster calls a launch configuration). Graphiti has 3 launch configurations one for running JUnit tests for the core plugin (org.eclipse.graphiti), one for running JUnit tests for the UI plugin (org.eclipse.graphiti.ui) and one for running the SWTBot tests for the complete framework (UI tests).
 +
 
 +
The launch configuration is easy to create, after running your test suite in Eclipse, a run configuration should be present in the window Run &gt; Run Configurations. To store the run/launch configuration in a file: in the last tab of the configuration (Common), the save as location is set to a shared file in a project. The file is checked-in into CVS. This shared file is then used as the input to the test run through buckminster, see the call for running the tests above. The output location is specified with the -o parameter. The xml in the output location is used by Hudson to create a test report.
 +
 
 +
=== Defining and creating an update site ===
 +
 
 +
The Graphiti build creates an update site, which site is defined through a feature project: the org.eclipse.graphiti.site project. It has one important file names feature.xml; it defines which features are part of the update site and contains 2 features:
 +
 
 +
*org.eclipse.graphiti.feature
 +
*org.eclipse.graphiti.feature.examples
 +
 
 +
To build the update site the build job calls the Buckminster action site.p2.zip which does all necessary stpe for creating the site and archive. Buckminster is called with the org.eclipse.graphiti.site feature (note feature id is used here, not the project name - here this is not relevant since they are the same, but they might differ). As a default (is option controlled) the content of the passed in feature is used for the content of the site, so the feature<br>project (org.eclipse.graphiti.site) itself is not part of the update site.

Revision as of 07:26, 22 November 2013

Graphiti Build Process

This page describes the Graphiti build setup. Thanks to the Teneo and CDO guys for providing a template for setting up a first version of our build and an excellent description of it (the Teneo build description was also used as a template for this page). Graphiti uses Buckminster and the Graphiti Hudson instance for its continuous build. The job graphiti.nightly is used to build Graphiti's head version. To understand the content of this page it is necessary to understand the main Buckminster concepts. These are described in detail in the Bucky Book. Some Buckminster concepts can seem fairly abstract initially, the 'Understanding Buckminster' section below may help here.

Local Execution

It should be possible to do a local Graphiti build. [TODO: describe the necessary steps]

Understanding Buckminster

This section may help to make it a clearer how Buckminster works. The main functionality (for use within the Graphiti build):

  • Buckminster creates workspaces and target platforms for running the build and test. These workspaces are the same or similar to what you see in your IDE.
  • Buckminster uses the includes and dependency definitions in the MANIFEST.MF (for a plugin project) and the feature.xml (for a feature project) to download related projects or binaries. Additional dependencies are defined in a buckminster.cspex file. The build and buckminster files only refer to so-called root feature projects. The includes and dependencies of those projects then automatically drive the download of all other relevant projects and binaries into the workspace and target platform.
  • Buckminster can search many types of locations for dependencies. The locations and their search order are defined in a configuration file (the graphiti.rmap files in the build and test subfolders). Development projects are downloaded from cvs while binary dependencies are coming from update sites.
  • When downloading dependencies, Buckminster determines which dependency to place in the workspace (as a development project) and which dependencies to place in the target platform. The choice where to place what is defined in the graphiti.rmap file using the attribute 'source' with the value 'true', which signals a dependency to be a source (so should be placed in the workspace).
  • Buckminster has several commands which can be executed against a workspace/target platform, for example run tests, build a p2.site etc.

A short description on the meaning of some files in the Graphiti build:

  • rmap file: Defines where and how to download dependencies and development projects, contains cvs locations, update site url's and specifies an order in which these locations are searched. Also identifies which sources are considered to contain sources (i.e. development projects) and which are used for binary dependencies.
  • cquery file: Defines which rmap file to use and defines the root (feature) project, the content (defined via the feature.xml) and the dependencies of the content are downloaded.
  • mspec file: This file is the starting point. It specifies which cquery file to use and also how the plugins/development projects downloaded as part of resolving the cquery file should be treated, or materialized. Materialized means: where to place the downloaded plugins/development projects, in the workspace or in the target platform.

Main Build Steps

The Graphiti build job executes 2 build steps: the first one is a Linux shell script that sets up the environment for the build job, the second one defines the Buckminster steps to process. The latter will be describes in more detail below, here are just a few reamrks for the shell script part:

  • It starts off with deleting the remains from previous builds
  • Then it creates a properties file containing all the properties defined in the properties file retrieved from the releng project plus defining some more.

The next step of the build is the main part. It is a Buckminster script that performs several steps:

  • Set the Java compliance level to Java 6
  • Define the folder for the target platform (where BuckminstAllJunitUiTests.launcher syncs all binary usages to)
  • Import an API baseline definition. The definition file resides in the releng project and defines different baselines according to the current version. Note that in the 0.7.x codelines no baseline definition file exists, so in case you do a 0.7.x build you will need to comment out this line.
  • Do the actual import of the sources and binaries: download the development projects from CVS and use them to create a workspace and download/retrieve the dependencies to the target platform.
  • Do the Java build
  • Create the JavaDoc (happens via a Buckminster call to execute an Ant script defined in the releng project.
  • Creates the site by performing the Buckminster command site.p2.zip. This will first create the site.p2, the - if enabled - sign the site, create teh site.signed and the site.p2.zip file.
  • Create an html and xml index for the site (stating which features and plugins in which version is contained). This again happens via a Buckminster call to execute an ANt script resideing in the releng project.
  • Start the test runs. There are currently 3 test suites executed defined via launch configs:
    • AllJunitTests.launch: Starts the JUnit tests for the plugin org.eclipse.graphiti
    • AllJunitUiTests.launch: Starts the JUnit tests for the plugin org.eclipse.graphiti.ui
    • AllBotTests.launch: Starts the SWTBot tests for the complete framework
  • Copy the build result to the last_success folder. This again happens via a Buckminster call to n Ant script defined in the releng project
  • The actual promotion (publishing the site to the Eclipse download area (head or dev download site as stated on the Graphiti Downloads page) is done by a cron job defined for user mwenz that runs once a day in the evening. The reason is that the hudson job does not have write permission for the downloads area.

By using a Buckminster script we get the setup of Buckminster for free. We use the Buckminster 3.7 installation on the Eclipse Hudson. The following sections describe the necessary files for the build.

Structure of build projects/features

The build infrastructure for Graphiti is centered around a releng project containing the all necessary files. A number of other feature projects are used to define which plugins are part of the build, part of the update site and which are part of the tests. The releng and feature projects can be found in the CVS location dev.eclipse.org/cvsroot/modeling/org.eclipse.gmp/org.eclipse.gmp.graphiti in the folders releng (for the releng project) and features (for the feature projects).

The org.eclipse.graphiti.releng project contains the Buckminster files for the build and test steps. The content of this project and the buckminster setup is described in more detail below. This project is the most important one to look at when trying to understand Graphiti's build setup. The feature projects are used to structure the output of the build in the correct way, i.e. which features/plugins are made available via an update site, which features/plugins are involved in testing etc. Here is a summary of these feature projects:

  • org.eclipse.graphiti.site - Defines the update site and the main features. This project contains a buckminster.cspex file to define extra dependencies for stuff added via package imports (this is described in more detail below). The included features are:
    • org.eclipse.graphiti.feature - The Graphiti runtime feature
    • org.eclipse.graphiti.feature.examples - The documentation and the tutorial plugin for Graphiti
  • org.eclipse.graphiti.tests-feature - Contains the test plugins and their dependencies. The test plugins contain test launch configurations (see below running test cases).

Main build project: org.eclipse.graphiti.releng

After downloading the main build project from cvs you can see that it consists of several files in the root and the xsl subfolder. Here is a summary for the meaning of different files:

  • build.mspec: This file is the starting point for Buckminster. This file specifies two things: firstly, which query file to use, the cquery file is explained below, it defines which root feature project to download as a starting point for the build and secondly, how to materialize: as a default materialize to the target platform (materializer="p2"), only if source is "true" materialize to the workspace.
  • build.cquery: The cquery file defines which rmap file to use, the rmap file specifies the download locations (update sites) and cvs locations to download dependencies. Buckminster needs a root project to use as a starting point which is defined by the rootRequest tag. The advisorNode tag is used to tell Buckminster to ignore dependencies (defined in feature.xml files) which have a pattern starting with org.eclipse.graphiti and ending with source. This is needed because the SDK feature projects contain these dependencies. However, these *.source plugins/features do not exist in cvs but are created by Buckminster/Eclipse during the build. So they should be ignored when downloading dependencies. See www.eclipse.org/forums/index.php for a thread on the Buckminster newsgroup on this. Besides it can give additional hints for the retrieval of components (e.g. you can define a branch for the source retrieval here).
  • APIbaseLine.target: defines a target platform that will be used as the API baseline for the build
  • buckminster.ant: Defines the Ant tasks used in the build (e.g create the JavaDoc,create the index files, copy build results)
  • buckminster.cspec: defines additional dependencies and the actions to trigger for the Ant tasks in buckminster.ant
  • build.properties: defines several properties related to how to sign plugins and where the download folder reside (both to download dependencies from and to upload the build result to. This file is used within the central build on the Eclipse Hudson.
  • build.rmap: Defines the update sites and CVS locations were to download the different components from (applies for both source and binary components)
  • local.properties: same as build.properties but intended to be used for local builds.

Test Calls

The flatXML argument is used to convert the output from the tests to a result which can be read by Hudson.

Defining Additional Dependencies: buckminster.cspex

Buckminster uses the explicit plugin dependencies in the MANIFEST.MF to download related project and binary dependencies. Buckminster can however not directly/automatically resolve dependencies defined by the import-packages directive. This is logical as Buckminster can not identify the plugins to download, just on the basis of the package name. To solve this, it is possible to define additional dependencies using a so-called buckminster.cspex file. The Graphiti build has a buckminster.cspex file in two feature projects:

  • org.eclipse.graphiti.site
  • org.eclipse.graphiti.tests-feature

The releng project is used in the rootRequest of the cquery file and delegates to the two feature projects. Note, the file containing the additional dependencies must be called buckminster.cspex. This cspex file defines dependencies on several eclipse features. The rmap file define where to find these features (i.e. which update site for example).

Testing

Testcases are run through Buckminster using a launch configuration (so Buckminster calls a launch configuration). Graphiti has 3 launch configurations one for running JUnit tests for the core plugin (org.eclipse.graphiti), one for running JUnit tests for the UI plugin (org.eclipse.graphiti.ui) and one for running the SWTBot tests for the complete framework (UI tests).

The launch configuration is easy to create, after running your test suite in Eclipse, a run configuration should be present in the window Run > Run Configurations. To store the run/launch configuration in a file: in the last tab of the configuration (Common), the save as location is set to a shared file in a project. The file is checked-in into CVS. This shared file is then used as the input to the test run through buckminster, see the call for running the tests above. The output location is specified with the -o parameter. The xml in the output location is used by Hudson to create a test report.

Defining and creating an update site

The Graphiti build creates an update site, which site is defined through a feature project: the org.eclipse.graphiti.site project. It has one important file names feature.xml; it defines which features are part of the update site and contains 2 features:

  • org.eclipse.graphiti.feature
  • org.eclipse.graphiti.feature.examples

To build the update site the build job calls the Buckminster action site.p2.zip which does all necessary stpe for creating the site and archive. Buckminster is called with the org.eclipse.graphiti.site feature (note feature id is used here, not the project name - here this is not relevant since they are the same, but they might differ). As a default (is option controlled) the content of the passed in feature is used for the content of the site, so the feature
project (org.eclipse.graphiti.site) itself is not part of the update site.

Back to the top