Updating parts of Eclipse RCP framework / patching RCP

last modified on Apr 07, 2022

This document descibes how to patch Eclipse RCP itself, e.g. if a default plugin causes a problem. It can hapen that a fix is already present in the GIT repository of Eclipse, but there is no binary release of the RCP framework yet. In this case you have to compile RCP by yourself and this document tells how to do it.

Inspect the GIT repository

Have a look at https://git.eclipse.org/c/ to find the repository for the plugin you need an update. Hava a look for the branches and compare them (some times a fix is already in a later version, but not in the older version). Then checkout the correct branch. After the release of an Eclipse version there are several maintainance releases which can be found in the maintainenance branch. For TextGrid 3.2 and 3.3 this is R4_4_maintenance, for an Eclipse Photon based build it is R4_8_maintenance.

Prerequisites

It is assumed that you have the Java compiler, Maven (3) and GIT installed and in your path.

Clone the repository

Eclipse is build with tycho, which makes the compilation of the modules easy. Start to checkout the releng project:

git clone -b R4_8_maintenance --recurse-submodules https://git.eclipse.org/r/platform/eclipse.platform.releng.aggregator.git

replace -b with the correct branch.

Now go into the eclipse.platform.releng.aggregator:

cd eclipse.platform.releng.aggregator

I had the problem that some submodules where not up to date, so they missed the fixes. To fix this I went manually into the directories of the plugins I need a fix and issued a git pull, e.g.

cd eclipse.platform.swt

git pull

git log

and verify the commit log with the web based git.

You can also try to issue

git pull --recurse-submodules

(Optional) apply the patch to the desired module

Now patch the corresponding module.

Important: The updated plugin is only included if the change has been committed to a repository. In this case it is the best if you create a new GIT repository for the module and push the changes. Only commited versions get a new qualifier!.

Update the build versions of the plugins

mvn -Dtycho.mode=maven -Dmaven.repo.local=${WORKSPACE}/.repository  org.eclipse.tycho:tycho-versions-plugin:update-pom

Build Eclipse

Increase the memory limit

export MAVEN_OPTS="-Xmx2048m -Declipse.p2.mirrors=false"

Compile it

mvn clean verify -DskipTests=true

You could also try a parallel build, which is faster (here 4 threads)

mvn -T 4 clean verify -DskipTests=true

This will take a couple of hours.

You will find the repository in the directory: eclipse.platform.releng.tychoeclipsebuilder/platform/target/repository

Now you can include this repository in the Eclipse RCP build, for testing as local directory or for the buiild server deploy it to the textgridlab website.

Carefully inspect if the desired plugin has the right qualifier (date/time string of the commit).

In Case of error with jetty dependency

If you get in trouble with jetty dependency, like

[ERROR] Failed to resolve target definition ~/.m2/repository/org/eclipse/eclipse-sdk-prereqs/4.8.0-SNAPSHOT/eclipse-sdk-prereqs-4.8.0-SNAPSHOT.target: Failed to load p2 metadata repository from location https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.43.v20210629/: No repository found at https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.43.v20210629.

you may also need to modify the fileeclipse.platform.releng.prereqs.sdk/eclipse-sdk-prereqs.targetand change the URL to something like https://archive.eclipse.org/jetty/updates/jetty-bundles-9.x/jetty-bundles-9.x/9.4.43.v20210629/ .

Redo build

The build leaves a lot of files in the directory, before redoing the build, issue

git submodule foreach git clean -f -d
git submodule foreach git reset --hard HEAD
git clean -f -d
git reset --hard HEAD

Include the new repository in the TextGridLab Build

Assumed that you have checkout TextGridLab open the file textgrid-laboratory/parent/pom.xml in a text editor and find the \<repositories> sections and add the new p2 repository. Local build from file system:

          <repository>
              <id>eclipse4maintainence</id>
              <layout>p2</layout>
              <url>file:///Volumes/Disk/eclipse.platform.releng.aggregator/eclipse.platform.releng.tychoeclipsebuilder/platform/target/repository</url>
        </repository>

Replace the URL with the correct path. For a public accessible repository, just replace the URL with a valid HTTP address.

Now Tycho will search both repositories (the official eclipse one and this one) and will use the latest version of the plugins (but only if the plugin has a new qualifier!).

References

1. https://wiki.eclipse.org/Platform-releng/Platform_Build#Building_natives

2. https://www.slideshare.net/LarsVogel/eclipse-committerin20minutes