Interest/Advice solicitation: Bnd and Bazel integration(s)

I’ve been working on a set of tools for using bnd in bazel and I am posting to solicit any advice, interest, or existing work that the bnd community sees as fitting the bnd workflow. Searching the discourse shows no results for the name bazel.

What works in my own setup?

  • You can “OSGI-ify” your java_library targets via a bnd rule. This bnd rule is open-ended but forgoes the property file, for now.
  • You can group your bundles into bundle groups via the bundle target.
  • You can create a launcher with a list of bundle groups but there is no useful rule for that (yet).

What doesn’t work?

Everything else. No real bnd workspace usage or integration, no biz.aQute.bnd.Launcher usage, baselining, etc.

Additional thoughts:

I see two separate use cases here:

  1. Projects who want to add OSGI metadata to their existing libraries being built via Bazel (Guice, Protobuf)
  2. People who want to use OSGI as a major layer of their project but with bazel as the build tool (Me!).

Existing work

I’ve removed the links due to limits of my new account but they are all on github.

  • google/guice has an osgi_jar rule that is not touched.
  • hsyed/osgi_rules on github is a POC that has not been touched in 8 years.
  • protocolbuffers/protobuf has one under java/osgi/osgi.bzl but it is unclear to me if it is being used.
  • b0inbot/atosgi is what I have been working on.

Welcome @boinsoft, and thanks for your first post :slight_smile:

I cannot add much regarding bazel.

The only thing which comes to mind is that Eclipse Tycho - also an external build tool (based on Maven) - has added support for building bnd workspaces recently.

see

Tycho uses bndlib under the hood which is called by maven classes.

Maybe it can serve partly as a blue-print how another build tool does it, to adapt it to bazel.

And of course there are the existing maven plugins and gradle plugins from bnd itself.

1 Like