Difference between revisions of "Building Rodin Headless"

From Event-B
Jump to navigationJump to search
imported>Laurent
 
(43 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
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
 
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
# Fetch the sources from Subversion 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.
  
==Build Parameters==
+
==Requirements==
 +
* [http://maven.apache.org/ Apache Maven 3] should be installed on the platform that will run the build.
  
Three parameters need to be defined for each build:
+
==Pre Build Verifications==
# 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>1.0RC1</tt>.
 
# the Subversion revision number, which permits to know very precisely which source versions are used for the build.
 
# the full platform version used for provisioning. This version is made of three digits separated by dots. Example of full versions are <tt>1.0.0</tt> and <tt>1.1.0</tt>.
 
  
==Fetching Sources==
+
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 [http://wiki.eclipse.org/Version_Numbering 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/Rodin.p2.inf)
  
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
+
      addRepository(type:0,location:http${#58}//download.eclipse.org/releases/neon,name:Neon Update Site);\
fetchSources 1.1 7661
+
      addRepository(type:1,location:http${#58}//download.eclipse.org/releases/neon,name:Neon Update Site);\
  
The script itself is
+
and matches the one defined whithin the parent pom file (<tt>org.eventb.parent/pom.xml</tt>) :
<nowiki>#!/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
+
<repository>
SVNURL=$SVNROOT/trunk/RodinCore
+
<id>oxygen-4.7</id>
export SVNROOT SVNURL
+
<layout>p2</layout>
 +
<url>http://download.eclipse.org/eclipse/updates/4.7/</url>
 +
</repository>
 +
 +
* the correct link for the Rodin Handbook is provided in the parent pom file (<tt>org.eventb.parent/pom.xml</tt>) :
 +
<repository>
 +
<id>handbook</id>
 +
<layout>p2</layout>
 +
<url>http://handbook.event-b.org/updatesite</url>
 +
</repository>
  
fatal() {
+
* branding plug-ins display the correct Eclipse version (text information found in several about.properties/plugin.properties files)
    echo "$@" >&2
+
* documentation is up to date for /org.rodinp.platform/html/root.html
    exit 1
+
* generated documentation matches latest wiki sources for <tt>org.eventb.keyboard/doc</tt>
}
+
* 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>
  
checkRevision() {
+
The variable used in Maven scripts is then <tt>${www-basedir}</tt>
    if expr "$SVNREV" : '^[0-9][0-9]*$' >/dev/null; then
 
: OK
 
    else
 
fatal "Invalid SVN revision number: $SVNREV"
 
    fi
 
}
 
  
fetchSources() {
+
When everything works, any changes to the sources made during this verification process are pushed to the Source Forge repository.
    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() {
+
'''N.B.''' Several information are defined and manipulated for each build. Here below is a memo to help understand them :
    m="$1"
+
# 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>.
    echo "Fetching $m"
+
# the Git commit number which permits to know very precisely which source versions are used for the build.
    svn -q export -r "$SVNREV" "$SVNURL/$m" "$m"
+
# the Git branch from which the commit can be checked out
}
+
# 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==
  
[ $# -eq 2 ] || fatal "Usage: $0 <Rodin_version> <SVN_revision>"
+
Create a directory that will contain the sources and be used to build the platform.<br />
VERSION="$1"
+
Example :
SVNREV="$2"
+
mkdir Rodin3.0BuildDirectory
checkRevision
 
fetchSources
 
zip -q -r "../rodin-${VERSION}-sources.zip" *</nowiki>
 
  
==Installing Eclipse for Headless Build==
+
and go to this directory :
 +
cd Rodin3.0BuildDirectory
  
To install Eclipse for headless build, you first need to download two bundles from the Eclipse download site:
+
Fetch sources from Git in the current directory :
* <tt>eclipse-SDK-${VERSION}-${PLATFORM}.tar.gz</tt>
+
<nowiki>git clone git://git.code.sf.net/p/rodin-b-sharp/rodincore .</nowiki>
* <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.
 
  
 
==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>#!/bin/sh
 
 
 
BUILD_ID=1.1
 
SVNREV=r7661
 
VERSION=1.1.0.$SVNREV
 
  
JAVA_HOME=/usr/lib/jvm/java-1.5.0/jre
+
<nowiki> #!/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
  
BUILD_BASE=$HOME/Rodin/$BUILD_ID
+
GIT_COMMIT=`git log -1 --format='%h'`
BUILD_DIR=$BUILD_BASE/work
+
echo "Building Rodin with Maven for git commit: $GIT_COMMIT"
RELENG=$BUILD_BASE/sources/org.rodinp.releng
+
mvn clean install -Dgit-commit=$GIT_COMMIT $@ # -DskipTests -fae </nowiki>
  
ECLIPSE_HOME=$HOME/eclipse-SDK-3.4.2
+
==Post Build Verifications==
PDE_BUILD=$ECLIPSE_HOME/plugins/org.eclipse.pde.build_3.4.1.R34x_v20081217
 
ANT_SCRIPT=$PDE_BUILD/scripts/productBuild/productBuild.xml
 
  
BASE_OS=linux
+
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.
BASE_WS=gtk
+
For each of them, check that:
BASE_ARCH=x86
+
* "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)
  
$JAVA_HOME/bin/java \
+
==Last operations to perform==
-jar $ECLIPSE_HOME/plugins/org.eclipse.equinox.launcher_*.jar \
+
*Copy the build update site into a dedicated folder onto SourceForge (e.g., <code>/home/pfs/project/rodin-b-sharp/Core_Update_Site/3.5/</code>)
-application org.eclipse.ant.core.antRunner \
+
*Ensure that the download of the uploaded version of Rodin is here by default
-buildfile $ANT_SCRIPT \
+
*Update the main wiki page:
-Dbuilder=$RELENG \
+
**http://wiki.event-b.org/index.php/Main_Page
-DbuildDirectory=$BUILD_DIR \
+
**The image "out now" is to be changed
-DpluginPath=$BUILD_DIR/plugins/org.rodinp.platform \
+
**The link "learn more" should point to the release notes
-Dbase=$ECLIPSE_HOME \
+
**The link "download now" should point to the SF repository
-DbaseLocation=$ECLIPSE_HOME \
+
*The Platform releases page should be updated:
-Dbaseos=$BASE_OS \
+
**http://wiki.event-b.org/index.php/Rodin_Platform_Releases
-Dbasews=$BASE_WS \
+
*The 64 bits page should be updated:
-Dbasearch=$BASE_ARCH \
+
**http://wiki.event-b.org/index.php/Rodin_64_bit
-DbuildId="$BUILD_ID" \
+
*In the Bug and Feature Request trackers, complete the milestone for the new release, create a new milestone for the following one, and move any remaining ticket between these two milestones.
-DbuildVersion="$VERSION" \
+
*A mail is sent on the user + announce rodin SF lists.
-DforceContextQualifier="$SVNREV"</nowiki>
 
  
 
[[Category:Developer documentation]]
 
[[Category:Developer documentation]]
 
[[Category:Rodin Platform]]
 
[[Category:Rodin Platform]]

Latest revision as of 15:50, 11 September 2020

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/Rodin.p2.inf)
      addRepository(type:0,location:http${#58}//download.eclipse.org/releases/neon,name:Neon Update Site);\
      addRepository(type:1,location:http${#58}//download.eclipse.org/releases/neon,name:Neon Update Site);\

and matches the one defined whithin the parent pom file (org.eventb.parent/pom.xml) :

	<repository>
		<id>oxygen-4.7</id>
		<layout>p2</layout>
		<url>http://download.eclipse.org/eclipse/updates/4.7/</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

  • Copy the build update site into a dedicated folder onto SourceForge (e.g., /home/pfs/project/rodin-b-sharp/Core_Update_Site/3.5/)
  • Ensure that the download of the uploaded version of Rodin is here by default
  • Update the main wiki page:
  • The Platform releases page should be updated:
  • The 64 bits page should be updated:
  • In the Bug and Feature Request trackers, complete the milestone for the new release, create a new milestone for the following one, and move any remaining ticket between these two milestones.
  • A mail is sent on the user + announce rodin SF lists.