Difference between revisions of "Building Rodin Headless"

From Event-B
Jump to navigationJump to search
imported>Tommy
imported>Tommy
m
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
# Fetch the sources from the repository and make a source archive with them.
 
# Fetch the sources from the repository and make a source archive with them.
 
# Build the platform headless from this set of sources using Apache Ant.
 
# Build the platform headless from this set of sources using Apache Ant.
 +
 +
==Requirements==
 +
* Apache Maven 3 should be installed on the platform that will run the build.
  
 
==Pre Build Verifications==
 
==Pre Build Verifications==
Line 10: Line 13:
 
* versions of plug-ins, features and product obey [http://wiki.eclipse.org/Version_Numbering Eclipse versioning policy]
 
* versions of plug-ins, features and product obey [http://wiki.eclipse.org/Version_Numbering Eclipse versioning policy]
 
* API Tooling build against previous Rodin release produces no errors on any plug-in
 
* API Tooling build against previous Rodin release produces no errors on any plug-in
 +
* Rodin build process is managed using Apache maven and Tycho. One should verify that maven artifact versions match the plug-in versions (defined in plug-in MANIFEST.MF files)
 
* the correct Eclipse version is referenced in the p2 configuration (org.rodinp.platform/p2.inf) and matches the one defined whithin the parent pom file (<tt>org.eventb.parent/pom.xml</tt>) :
 
* the correct Eclipse version is referenced in the p2 configuration (org.rodinp.platform/p2.inf) and matches the one defined whithin the parent pom file (<tt>org.eventb.parent/pom.xml</tt>) :
  
Line 27: Line 31:
 
* branding plug-ins display the correct Eclipse version (text information found in several about.properties/plugin.properties files)
 
* branding plug-ins display the correct Eclipse version (text information found in several about.properties/plugin.properties files)
 
* documentation is up to date for /org.rodinp.platform/html/root.html
 
* documentation is up to date for /org.rodinp.platform/html/root.html
* generated documentation matches latest wiki sources for
+
* generated documentation matches latest wiki sources for <tt>org.eventb.keyboard/doc</tt>
** /org.eventb.keyboard/doc
+
* make sure a valid destination folder is specified in <tt>org.eventb.parent/pom.xml</tt>. This destination folder will host the built platforms, the update-site and the development target platform.
 +
Example :
 +
<www-basedir>/tmp/rodin-build/rodin-3.0</www-basedir>
 +
 
 +
The variable used in Maven scripts is then <tt>${www-basedir}</tt>
  
 
When everything works, any changes to the sources made during this verification process are pushed to the Source Forge repository.
 
When everything works, any changes to the sources made during this verification process are pushed to the Source Forge repository.
  
==Build Parameters==
+
'''N.B.''' Several information are defined and manipulated for each build. Here below is a memo to help understand them :
 
+
# the platform version which defines a milestone identifier for the Rodin platform. Example of platform versions are <tt>1.0</tt> and <tt>2.3RC1</tt>.
Several parameters need to be defined for each build:
+
# the Git commit number which permits to know very precisely which source versions are used for the build.
# the platform version, that is the user-visible version which is displayed in ''About Rodin Platform''. Example of versions are <tt>1.0</tt> and <tt>2.3RC1</tt>.
 
# the Git commit number, which permits to know very precisely which source versions are used for the build.
 
 
# the Git branch from which the commit can be checked out
 
# the Git branch from which the commit can be checked out
# the full platform version used for provisioning. This version is made of the platform version and the commit number, separated by a dot. Example of full versions are <tt>2.8RC1.r365721c</tt> and <tt>2.8.1.r6f52165</tt>.
+
# the full platform version used for provisioning, and which is the user-visible version which is displayed in ''About Rodin Platform''. This version is made of the platform version and the commit number, separated by a dot. Example of full versions are <tt>2.8RC1.bh1420</tt> and <tt>2.8.1.hgf52f65</tt>.
  
 
==Fetching Sources==
 
==Fetching Sources==
  
Sources are fetched from Subversion using the script below.  The script can be run on any Unix machine and takes the first two parameters described above (i.e., platform version and subversion revision).  For instance, to build Rodin 1.1, the script was invoked as
+
Create a directory that will contain the sources and be used to build the platform.<br />
fetchSources 1.1 7661
+
Example :
 
+
  mkdir Rodin3.0BuildDirectory
The script itself is
 
<nowiki>#!/bin/sh
 
#
 
#  Fetch sources of the Rodin Platform from the Subversion repository on
 
#  SourceForge.
 
#
 
 
. ./version.sh
 
 
GITROOT=ssh://pcb//git/c572/RodinCore.git
 
 
fatal() {
 
    echo "$@" >&2
 
    exit 1
 
}
 
 
checkCommit() {
 
    if expr "$GIT_COMMIT" : '^[0-9a-f][0-9a-f]*$' >/dev/null; then
 
        : OK
 
    else
 
        fatal "Invalid GIT commit: $GIT_COMMIT"
 
    fi
 
}
 
   
 
fetchSources() {
 
    mkdir gitrepo || fatal "Some sources have already been checked out."
 
    git clone --branch $GIT_BRANCH $GITROOT gitrepo
 
    cd gitrepo
 
    git checkout $GIT_COMMIT
 
 
    mkdir ../sources
 
    cp -R org.rodinp.releng ../sources
 
 
    cat org.rodinp.releng/rodin-core.psf | 
 
    grep "^<project" |
 
    sed -e 's/.*\,master\,//' -e 's/\".*//' |
 
    xargs -i cp -R {} ../sources
 
 
    cd ..
 
}
 
 
checkCommit
 
fetchSources
 
 
cd sources
 
zip -q -r "../rodin-${VERSION}-sources.zip" *</nowiki>
 
 
 
==Installing Eclipse for Headless Build==
 
  
To install Eclipse for headless build, you first need to download two bundles from the Eclipse download site:
+
and go to this directory :
* <tt>eclipse-SDK-${VERSION}-${PLATFORM}.tar.gz</tt>
+
cd Rodin3.0BuildDirectory
* <tt>eclipse-${VERSION}-delta-pack.zip</tt>
 
where <tt>VERSION</tt> is the version of Eclipse (e.g., <tt>3.4.2</tt>) and <tt>PLATFORM</tt> specifies the host platform for the build (e.g., <tt>linux-gtk</tt>).
 
  
Once downloaded, you need to extract the first archive, and then the second archive on top of the first. You now have an Eclipse installation able to build binary distribution for all platforms supported by Eclipse.
+
Fetch sources from Git in the current directory :
 +
git clone git://git.code.sf.net/p/rodin-b-sharp/rodincore .
  
 
==Building the Platform==
 
==Building the Platform==
  
To build the platform, you just need to run the script below after possibly modifying some of the variables at the beginning of it.  The meaning of the variables is
+
To build the platform, you just need to run the script below (available from org.rodinp.releng/scripts/run-maven.sh) :
{| border="1" cellspacing="0" cellpadding="5"
 
| <tt>BUILD_ID</tt>
 
| Simple platform version (first parameter above)
 
|-
 
| <tt>SVNREV</tt>
 
| Subversion revision number with an <tt>r</tt> prepended
 
|-
 
| <tt>VERSION</tt>
 
| Full platform version used for provisioning (must contain <tt>$SVNREV</tt> as qualifier)
 
|-
 
| <tt>JAVA_HOME</tt>
 
| Absolute path to a Java Runtime Environment
 
|-
 
| <tt>BUILD_BASE</tt>
 
| Absolute path to the directory used for building. As a result of a previous step, this directory must contain a <tt>sources</tt> folder where the Rodin sources have been downloaded.
 
|-
 
| <tt>ECLIPSE_HOME</tt>
 
| Absolute path to the Eclipse installation (including the delta pack) to use for building
 
|-
 
| <tt>PDE_BUILD</tt>
 
| Absolute path to the PDE plug-in in your Eclipse installation.
 
|-
 
| <tt>BASE_OS</tt>
 
| Operating system of the host platform
 
|-
 
| <tt>BASE_WS</tt>
 
| Windowing system of the host platform
 
|-
 
| <tt>BASE_ARCH</tt>
 
| Architecture of the host platform
 
|}
 
  
The build script is
+
<nowiki>
<nowiki>#!/bin/sh
+
#!/bin/sh
 
+
###############################################################################
BUILD_ID=2.8
+
# Copyright (c) 2013 Systerel and others.
GIT_COMMIT=05788b6
+
# All rights reserved. This program and the accompanying materials
GIT_BRANCH=2.8-master
+
# are made available under the terms of the Eclipse Public License v1.0
VERSION=$BUILD_ID.r$GIT_COMMIT
+
# which accompanies this distribution, and is available at
 
+
# http://www.eclipse.org/legal/epl-v10.html
JAVA_HOME=/usr/lib/jvm/java-6-sun/jre
+
#
 +
# Contributors:
 +
#    Systerel - initial API and implementation
 +
###############################################################################
 +
SCRIPT=`readlink -m -n $0`
 +
SCRIPTS_DIR=`dirname $SCRIPT`
 +
MAIN_DIR=`readlink -m -n $SCRIPTS_DIR/../..`
  
BUILD_BASE=$HOME/Rodin/$BUILD_ID
+
cd $MAIN_DIR
BUILD_DIR=$BUILD_BASE/work
 
RELENG=$BUILD_BASE/sources/org.rodinp.releng
 
  
ECLIPSE_HOME=$HOME/eclipse-3.7.2
+
GIT_COMMIT=`git log -1 --format='%h'`
PDE_BUILD=$ECLIPSE_HOME/plugins/org.eclipse.pde.build_3.7.0.v20111116-2009
+
echo "Building Rodin with Maven for git commit: $GIT_COMMIT"
ANT_SCRIPT=$PDE_BUILD/scripts/productBuild/productBuild.xml
 
REPO=$BUILD_BASE/REPO
 
  
BASE_OS=linux
+
mvn clean install -Dgit-commit=$GIT_COMMIT $@ # -DskipTests -fae
BASE_WS=gtk
+
</nowiki>
BASE_ARCH=x86
 
 
 
$JAVA_HOME/bin/java \
 
    -jar $ECLIPSE_HOME/plugins/org.eclipse.equinox.launcher_*.jar \
 
    -application org.eclipse.ant.core.antRunner \
 
    -buildfile $ANT_SCRIPT \
 
    -Dbuilder=$RELENG \
 
    -DbuildDirectory=$BUILD_DIR \
 
    -DpluginPath=$BUILD_DIR/plugins/org.rodinp.platform \
 
    -Dbase=$ECLIPSE_HOME \
 
    -DbaseLocation=$ECLIPSE_HOME \
 
    -Dbaseos=$BASE_OS \
 
    -Dbasews=$BASE_WS \
 
    -Dbasearch=$BASE_ARCH \
 
    -DbuildId="$BUILD_ID" \
 
    -DbuildVersion="$VERSION" \
 
    -DforceContextQualifier="r$GIT_COMMIT" \
 
    -Dconfigs="linux,gtk,x86 & linux,gtk,x86_64 & win32,win32,x86 & win32,win32,x86_64 & macosx,cocoa,x86_64" \
 
    -Dp2.gathering=true \
 
    -Dp2.metadata.repo=$REPO \
 
    -Dp2.artifact.repo=$REPO \
 
    -Dp2.compress=true</nowiki>
 
  
 
==Post Build Verifications==
 
==Post Build Verifications==
  
When the build worked, the "work/result" directory contains zipped archives for all platforms.
+
When the build worked, the destination directory (defined by variable <tt>${www-basedir}<tt>) contains zipped archives for all platforms, the update site, and the target platform for plug-in development.
 
For each of them, check that:
 
For each of them, check that:
 
* "rodin" binary is an executable file (for Linux and Mac)
 
* "rodin" binary is an executable file (for Linux and Mac)
 +
* The version appearing in ''About Rodin platform'' is correctly defined
 
* a directory "dropins" exists at the root (under "rodin", among "features", plugins", ...)
 
* a directory "dropins" exists at the root (under "rodin", among "features", plugins", ...)
 
* in "configuration/org.eclipse.equinox.simpleconfigurator/bundles.info", plug-in "org.eclipse.equinox.p2.reconciler.dropins" is configured with auto start mode ("true" at the end of the line)
 
* in "configuration/org.eclipse.equinox.simpleconfigurator/bundles.info", plug-in "org.eclipse.equinox.p2.reconciler.dropins" is configured with auto start mode ("true" at the end of the line)
 
Failures must be manually corrected. Final archives shall match the above requirements.
 
 
==Providing Sources==
 
 
Sources must also be provided, in both these ways:
 
* compressed source archive, as fetched through [[#Fetching Sources]]
 
* archive suitable for inclusion in a target platform (see [[Generating source bundles for inclusion in a target platform configuration]])
 
* SVN tag under ''/svnroot/rodin-b-sharp/tags/RodinCore/x.y''
 
  
 
==Last operations to perform==
 
==Last operations to perform==

Revision as of 10:25, 3 January 2014

This page documents the procedure followed for building the binary packages of the Rodin platform that are distributed on SourceForge. The build is done in two steps

  1. Fetch the sources from the repository and make a source archive with them.
  2. Build the platform headless from this set of sources using Apache Ant.

Requirements

  • Apache Maven 3 should be installed on the platform that will run the build.

Pre Build Verifications

Before building, several checks have to be made in the sources:

  • clean build all RodinCore plug-ins, so that generated files are regenerated using repository sources
  • JUnit tests are OK
  • versions of plug-ins, features and product obey Eclipse versioning policy
  • API Tooling build against previous Rodin release produces no errors on any plug-in
  • Rodin build process is managed using Apache maven and Tycho. One should verify that maven artifact versions match the plug-in versions (defined in plug-in MANIFEST.MF files)
  • the correct Eclipse version is referenced in the p2 configuration (org.rodinp.platform/p2.inf) and matches the one defined whithin the parent pom file (org.eventb.parent/pom.xml) :
	<repository>
		<id>indigo</id>
		<layout>p2</layout>
		<url>http://download.eclipse.org/releases/indigo</url>
	</repository>
	
  • the correct link for the Rodin Handbook is provided in the parent pom file (org.eventb.parent/pom.xml) :
<repository>
	<id>handbook</id>
	<layout>p2</layout>
	<url>http://handbook.event-b.org/updatesite</url>
</repository>
  • branding plug-ins display the correct Eclipse version (text information found in several about.properties/plugin.properties files)
  • documentation is up to date for /org.rodinp.platform/html/root.html
  • generated documentation matches latest wiki sources for org.eventb.keyboard/doc
  • make sure a valid destination folder is specified in org.eventb.parent/pom.xml. This destination folder will host the built platforms, the update-site and the development target platform.

Example :

<www-basedir>/tmp/rodin-build/rodin-3.0</www-basedir>

The variable used in Maven scripts is then ${www-basedir}

When everything works, any changes to the sources made during this verification process are pushed to the Source Forge repository.

N.B. Several information are defined and manipulated for each build. Here below is a memo to help understand them :

  1. the platform version which defines a milestone identifier for the Rodin platform. Example of platform versions are 1.0 and 2.3RC1.
  2. the Git commit number which permits to know very precisely which source versions are used for the build.
  3. the Git branch from which the commit can be checked out
  4. the full platform version used for provisioning, and which is the user-visible version which is displayed in About Rodin Platform. This version is made of the platform version and the commit number, separated by a dot. Example of full versions are 2.8RC1.bh1420 and 2.8.1.hgf52f65.

Fetching Sources

Create a directory that will contain the sources and be used to build the platform.
Example :

mkdir Rodin3.0BuildDirectory

and go to this directory :

cd Rodin3.0BuildDirectory

Fetch sources from Git in the current directory :

git clone git://git.code.sf.net/p/rodin-b-sharp/rodincore .

Building the Platform

To build the platform, you just need to run the script below (available from org.rodinp.releng/scripts/run-maven.sh) :

#!/bin/sh ############################################################################### # Copyright (c) 2013 Systerel and others. # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html # # Contributors: # Systerel - initial API and implementation ############################################################################### SCRIPT=`readlink -m -n $0` SCRIPTS_DIR=`dirname $SCRIPT` MAIN_DIR=`readlink -m -n $SCRIPTS_DIR/../..` cd $MAIN_DIR GIT_COMMIT=`git log -1 --format='%h'` echo "Building Rodin with Maven for git commit: $GIT_COMMIT" mvn clean install -Dgit-commit=$GIT_COMMIT $@ # -DskipTests -fae

Post Build Verifications

When the build worked, the destination directory (defined by variable ${www-basedir}) contains zipped archives for all platforms, the update site, and the target platform for plug-in development. For each of them, check that:

  • "rodin" binary is an executable file (for Linux and Mac)
  • The version appearing in About Rodin platform is correctly defined
  • a directory "dropins" exists at the root (under "rodin", among "features", plugins", ...)
  • in "configuration/org.eclipse.equinox.simpleconfigurator/bundles.info", plug-in "org.eclipse.equinox.p2.reconciler.dropins" is configured with auto start mode ("true" at the end of the line)

Last operations to perform