How to migrate RCP-project to bnd-project?

I have currently no idea where to start. :slightly_frowning_face:

What I’ve done:
create c:\temp
download to this folder and extract the archive
modify eclipse.ini (just to ensure no side effects with existing installations)
add this to the beginning


and this to the end of the eclipse.ini


now start eclipse and open File → New → Plug-In Project
enter project name and click next
select generate an activator and set create rich client application to yes
client next and select RCP 3.x Mail Template and click finish.

This opens the manifest where I can start the example-application.

Now installer bndtools from marketplace and restart eclipse.

Now select File → New → Other and create a new Bnd OSGî Workspace from bndtools/bndtools.workspace.min

After that edit cnf/build.bnd and add

# Eclipse Release repositories 
eclipse.version          = 4.28             = 2023-06
eclipse.platform.version = R-4.28-202306050440

eclipse.platform.baseurl =
#eclipse.platform.baseurl = "${fileuri;${user.home}}www/"    = Platform_${eclipse.platform.version}
eclipse.platform.url     = "${eclipse.platform.baseurl}/${eclipse.version}/${eclipse.platform.version}"

# Remote Eclipse repositories

# 1. creation of the indices via this configurations and store inside cnf/fixedIndices
-plugin.1.eclipse.platform: \
    aQute.bnd.repository.p2.provider.P2Repository; \
       name  = ${}; \
        url   = ${eclipse.platform.url}

After saving the file click on reload workspace in Bndtools explorer to download the “target-platform”.

And now I’m stuck :slightly_smiling_face:
I have a working rcp app and installed bndtools but what are the next steps?
Can I somehow create the bnd- and bndrun-files from my existing project?
And if not what do I have to add to the files?

thanks in advance :slightly_smiling_face:

any help is appreciated

You might want to take a look at the bndtools project at Bndtools · GitHub

It also has has bundles, gradle, and maven parts, the bndtools.core project is an Eclipse plugin and is like an RCP project. It has bndruns that can generate an executable jar.

The thing is that to do this right will take some effort. There is no magic tool that converts everything to a github project with Actions and all.

I’ve ported a similar project for Qivicon from PDE to bndtools and they are very happy. Data in Motion has several customers in this area.

Looking at where you are and where you want to be I’d ask Data in Motion or me to spend a few days to a week to just organize your workspace optimally. Will save you a lot of work.

Thanks vor your answer - currently I try to understand what I have to configure to use bndtools instead of pde.

Therefore I’ve created the example-project in eclipse and now want to migrate this project to bndtools.

If you can share it on Github then I, or Data In Motion, can have a look and provide some pointers.

I can share the project if you want but it’s really only

  • start eclipse
  • open File → New → Plug-In Project
  • enter project name and click next
  • select generate an activator ans set create rich client application to yes
  • client next and select RCP 3.x Mail Template and click finish

A lot of the RCP development is bound to the mechanisms of PDE. bnd uses different concepts and when you create a demo Application like you describe, bndtools does not know about the created project.

The PDE provides additionally some specific tooling for developing RCP Applications. The main one being the Product export. An RCP is an OSGi Application build and assembled in a specific way and launched via the well known native exectuable.

I have build an exporter and a Template for a demo Application, that will do something similar based on bnd and its functionalities: GitHub - geckoprojects-org/org.gecko.bnd.eclipse at snapshot

When I find the Time, I will do a full release. Right now I’d suggest you use the SNAPSHOT Version.

I did an Talk about it some time ago:

I’ve already seens some talks (including yours) and found some pages where people switched to bndtools.
They all had different reasons like updating their build system or their development process and so on.

Most of them saying that the switch was hard but now the whole world is better since they’re using bndtools. :smiley:
Unfortunately no one describes how they did the migration. :frowning_face:

e.g. Migrating from Eclipse Tycho to bnd / bndtools (OSGi)

I’ve also searched for small rcp projects to compare their pde-files with their bnd-files to figure out what to put inside cnf, into bnd.bnd or into bndrun-files.

Unfortunately most projects are “only” osgi-examples with api and implementation projects.
or examples with (maybe) more entries than necessary.
e.g. GitHub - klibio/example.bnd.rcp: Eclipse RCP application examples with bndtools

I hoped to find a guide like:

  • create your bnd-workspace from template xy
  • add or change this files in cnf (e.g. to define the “target platform”)
  • import your existing project
  • create bnd.bnd and/or bndrun-files with this entries from your current manifest

But now I get the feeling that this was a little bit to optimistic :smiley:

Yeah I wrote that :slight_smile: But I admit, it does not tell many details you are interested in. But I do not know how to explain a multi-month project. I also cannot remember the beginning of this process anymore.
We also brought in professional external help and were doing it together.

I guess you know this and this already.

Unfortunately I have no experience with RCP stuff.
But maybe it is a good chance for someone to put together such a tutorial based on your assumptions. Something like this (Slides of this talk), but more minimalistic.

@chrisrueger I’m not blaming you or the others :slightly_smiling_face:
I’m just trying to collect new informations and examples. :wink:

btw. thanks for all your input so far :+1:

Ok, I’ve checked GitHub - klibio/example.bnd.rcp: Eclipse RCP application examples with bndtools (cnf and again.
And try to understand the files step by step. :slight_smile:
Maybe @peterkir can also give some tips/hints/explanations? :slight_smile:

There is a folder /cnf/fixedIndices that includes

Is there a reason why I need the index-files?

Has this maybe something to do with Eclipse-*Bundleshape* : *dir* or are the needed for another reason?
How can I create them?

seems that I can create the index-files with: bnd repo index -f Platform_R-4.28-202306050440 -o Platform_R-4.28-202306050440.xml.gz

Why do I need bnd_buildpath_Eclipse_Platform.bndrun and bnd_runrequires_Eclipse_Platform.bndrun?

There contents seems to be the same(?) but the declarations seems to differ.

# bnd_buildpath_Eclipse_Platform.bndrun
fea_org.eclipse.core.runtime.feature_1.2.1100.v20201107-1818: \
# bnd_runrequires_Eclipse_Platform.bndrun
fea_org.eclipse.core.runtime.feature_1.2.1100.v20201107-1818: \

And the more important question: how are the files created? I hope this was not done manually. :smiley:

So it seem that peter build something to generate the files
Difference between build- and run-file seems to be that build-file contains the api and run the platform-specific implementations.

Could this parsing achieved by bndtools without relying on external tools? :thinking:

Is Eclipse-Bundleshape: dir still an issue?

Preparing a detailed explanation for the implementation inside the repo - but wait, there is more :slight_smile:

1 Like

@peterkir Sounds good - thank you, I’ll wait for it.

but wait, there is more

I’m not sure if I should be scared or excited. :smiley:

@juergen-albert In your talk you’ve said that you’re hoping that your changes will become part of bndtools. Was this done?
Is your splashscreen-support “only” displaying of an image or can we use org.eclipse.ui.splash.AbstractSplashHandler?

Why are the indexes…
The repos was started when there was no bnd tools p2 repository provider. So downloading and indexing the p2 repos was required.
So I used p2 mirror capabilities to mirror everything into local machine. Created index files, which could also be used for remote locations with slight modifications.

Purpose of cnf/fixedIndices
I wanted to use the eclipse features as references inside bnd.
So I created this hack of creating macros from parsing the eclipse features. Those macros are a crutch, but they allow the usage of eclipse features as bundle build dependencies or run requires.

We talked with @juergen-albert about creating Java annotations instead of these macros a while ago. Sadly I didn’t found time to implement it.

So I’m still stuck with the macros.
But I have updated the things to be working with Java 17 now and my plan is to continue now with the implementation of the annotations.

Migrating to bndtools is some effort. BUT it is worth the effort.

Regarding the repo I’m currently creating a consistent set of

  • p2 mirroring of platform and simulation release
  • indexing of repos (gives better performance)
  • updating to Tycho product build instead of PDE
  • and creating a bndtools workspace for that

on Java 17 and Eclipse 2023-06

Hope this helps somehow. For detailed questions on the repo or usage feel also free to ask here in GitHub discussions

1 Like