Difference between revisions of "Building Rodin Headless"

From Event-B
Jump to navigationJump to search
imported>Laurent
imported>Nicolas
m (Updated build script)
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
# Fetch the sources from Subversion and make a source archive with them.
 
# Fetch the sources from Subversion 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.
 +
 +
==Pre Build Verifications==
 +
 +
Before building, several checks have to be made in the sources:
 +
* branding plug-ins display the correct Eclipse version (text information found in several about.properties/plugin.properties files)
 +
* SVN project org.rodinp.releng is up to date, i.e. all required plug-ins are listed/processed in
 +
** rodin-core.psf
 +
** rodin-tests.psf
 +
** customTargets.xml (copySources)
 +
** export-RodinCore-src-jars.xml
 +
* make a local test within Eclipse:
 +
** import (binary with linked content) org.eclipse.pde.build into the Eclipse workspace containing Rodin sources
 +
** run "Build Rodin Product.launch": if everything went well, a directory "${workspace_loc}/../work/result" contains zipped archives for every platform, else errors are reported in the console.
 +
 +
When everything works, any changes to the sources made during this verification process are committed to the Source Forge repository (the below-mentioned Subversion revision is that of this commit).
  
 
==Build Parameters==
 
==Build Parameters==
Line 113: Line 128:
 
  <nowiki>#!/bin/sh
 
  <nowiki>#!/bin/sh
  
BUILD_ID=1.1
+
BUILD_ID=2.0
SVNREV=r7661
+
SVNREV=9964
VERSION=1.1.0.$SVNREV
+
VERSION=$BUILD_ID.r$SVNREV
  
JAVA_HOME=/usr/lib/jvm/java-1.5.0/jre
+
JAVA_HOME=/usr/lib/jvm/java-6-sun/jre
  
 
BUILD_BASE=$HOME/Rodin/$BUILD_ID
 
BUILD_BASE=$HOME/Rodin/$BUILD_ID
Line 123: Line 138:
 
RELENG=$BUILD_BASE/sources/org.rodinp.releng
 
RELENG=$BUILD_BASE/sources/org.rodinp.releng
  
ECLIPSE_HOME=$HOME/eclipse-SDK-3.4.2
+
ECLIPSE_HOME=$HOME/eclipse-SDK-3.6.1
PDE_BUILD=$ECLIPSE_HOME/plugins/org.eclipse.pde.build_3.4.1.R34x_v20081217
+
PDE_BUILD=$ECLIPSE_HOME/plugins/org.eclipse.pde.build_3.6.1.R36x_v20100823
 
ANT_SCRIPT=$PDE_BUILD/scripts/productBuild/productBuild.xml
 
ANT_SCRIPT=$PDE_BUILD/scripts/productBuild/productBuild.xml
  
Line 132: Line 147:
  
 
$JAVA_HOME/bin/java \
 
$JAVA_HOME/bin/java \
-jar $ECLIPSE_HOME/plugins/org.eclipse.equinox.launcher_*.jar \
+
    -jar $ECLIPSE_HOME/plugins/org.eclipse.equinox.launcher_*.jar \
-application org.eclipse.ant.core.antRunner \
+
    -application org.eclipse.ant.core.antRunner \
-buildfile $ANT_SCRIPT \
+
    -buildfile $ANT_SCRIPT \
-Dbuilder=$RELENG \
+
    -Dbuilder=$RELENG \
-DbuildDirectory=$BUILD_DIR \
+
    -DbuildDirectory=$BUILD_DIR \
-DpluginPath=$BUILD_DIR/plugins/org.rodinp.platform \
+
    -DpluginPath=$BUILD_DIR/plugins/org.rodinp.platform \
-Dbase=$ECLIPSE_HOME \
+
    -Dbase=$ECLIPSE_HOME \
-DbaseLocation=$ECLIPSE_HOME \
+
    -DbaseLocation=$ECLIPSE_HOME \
-Dbaseos=$BASE_OS \
+
    -Dbaseos=$BASE_OS \
-Dbasews=$BASE_WS \
+
    -Dbasews=$BASE_WS \
-Dbasearch=$BASE_ARCH \
+
    -Dbasearch=$BASE_ARCH \
-DbuildId="$BUILD_ID" \
+
    -DbuildId="$BUILD_ID" \
-DbuildVersion="$VERSION" \
+
    -DbuildVersion="$VERSION" \
-DforceContextQualifier="$SVNREV"</nowiki>
+
    -DforceContextQualifier="r$SVNREV" \
 +
    -Dconfigs="linux,gtk,x86 & win32,win32,x86 & macosx,cocoa,x86_64"</nowiki>
  
 
[[Category:Developer documentation]]
 
[[Category:Developer documentation]]
 
[[Category:Rodin Platform]]
 
[[Category:Rodin Platform]]

Revision as of 09:33, 12 October 2010

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 Subversion and make a source archive with them.
  2. Build the platform headless from this set of sources using Apache Ant.

Pre Build Verifications

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

  • branding plug-ins display the correct Eclipse version (text information found in several about.properties/plugin.properties files)
  • SVN project org.rodinp.releng is up to date, i.e. all required plug-ins are listed/processed in
    • rodin-core.psf
    • rodin-tests.psf
    • customTargets.xml (copySources)
    • export-RodinCore-src-jars.xml
  • make a local test within Eclipse:
    • import (binary with linked content) org.eclipse.pde.build into the Eclipse workspace containing Rodin sources
    • run "Build Rodin Product.launch": if everything went well, a directory "${workspace_loc}/../work/result" contains zipped archives for every platform, else errors are reported in the console.

When everything works, any changes to the sources made during this verification process are committed to the Source Forge repository (the below-mentioned Subversion revision is that of this commit).

Build Parameters

Three parameters need to be defined for each build:

  1. the platform version, that is the user-visible version which is displayed in About Rodin Platform. Example of versions are 1.0 and 1.0RC1.
  2. the Subversion revision number, which permits to know very precisely which source versions are used for the build.
  3. the full platform version used for provisioning. This version is made of three digits separated by dots. Example of full versions are 1.0.0 and 1.1.0.

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

fetchSources 1.1 7661

The script itself is

#!/bin/sh
#
#  Fetch sources of the Rodin Platform from the Subversion repository on
#  SourceForge.
#

SVNROOT=http://rodin-b-sharp.svn.sourceforge.net/svnroot/rodin-b-sharp
SVNURL=$SVNROOT/trunk/RodinCore
export SVNROOT SVNURL

fatal() {
    echo "$@" >&2
    exit 1
}

checkRevision() {
    if expr "$SVNREV" : '^[0-9][0-9]*$' >/dev/null; then
	: OK
    else
	fatal "Invalid SVN revision number: $SVNREV"
    fi
}

fetchSources() {
    mkdir sources || fatal "Some sources have already been checked out."
    cd sources
    fetchProject org.rodinp.releng
    cat org.rodinp.releng/rodin-core.psf |
	sed -e '\,trunk/RodinCore/,!d' \
	    -e 's,.*RodinCore/,,'  \
	    -e 's/,.*//' |
	while read m; do
	    fetchProject "$m"
	done
}

fetchProject() {
    m="$1"
    echo "Fetching $m"
    svn -q export -r "$SVNREV" "$SVNURL/$m" "$m"
}


[ $# -eq 2 ] || fatal "Usage: $0 <Rodin_version> <SVN_revision>"
VERSION="$1"
SVNREV="$2"
checkRevision
fetchSources
zip -q -r "../rodin-${VERSION}-sources.zip" *

Installing Eclipse for Headless Build

To install Eclipse for headless build, you first need to download two bundles from the Eclipse download site:

  • eclipse-SDK-${VERSION}-${PLATFORM}.tar.gz
  • eclipse-${VERSION}-delta-pack.zip

where VERSION is the version of Eclipse (e.g., 3.4.2) and PLATFORM specifies the host platform for the build (e.g., linux-gtk).

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.

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

BUILD_ID Simple platform version (first parameter above)
SVNREV Subversion revision number with an r prepended
VERSION Full platform version used for provisioning (must contain $SVNREV as qualifier)
JAVA_HOME Absolute path to a Java Runtime Environment
BUILD_BASE Absolute path to the directory used for building. As a result of a previous step, this directory must contain a sources folder where the Rodin sources have been downloaded.
ECLIPSE_HOME Absolute path to the Eclipse installation (including the delta pack) to use for building
PDE_BUILD Absolute path to the PDE plug-in in your Eclipse installation.
BASE_OS Operating system of the host platform
BASE_WS Windowing system of the host platform
BASE_ARCH Architecture of the host platform

The build script is

#!/bin/sh

BUILD_ID=2.0
SVNREV=9964
VERSION=$BUILD_ID.r$SVNREV

JAVA_HOME=/usr/lib/jvm/java-6-sun/jre

BUILD_BASE=$HOME/Rodin/$BUILD_ID
BUILD_DIR=$BUILD_BASE/work
RELENG=$BUILD_BASE/sources/org.rodinp.releng

ECLIPSE_HOME=$HOME/eclipse-SDK-3.6.1
PDE_BUILD=$ECLIPSE_HOME/plugins/org.eclipse.pde.build_3.6.1.R36x_v20100823
ANT_SCRIPT=$PDE_BUILD/scripts/productBuild/productBuild.xml

BASE_OS=linux
BASE_WS=gtk
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$SVNREV" \
    -Dconfigs="linux,gtk,x86 & win32,win32,x86 & macosx,cocoa,x86_64"