Closed rotty3000 closed 8 years ago
Simo Tripodi has done some work to use bnd baselining from the maven-bundle-plugin. This is available in the latest release AFAIK: see here: https://issues.apache.org/jira/browse/FELIX-4512
Some more detail here would be useful. For example, sketch out a suggested workflow and tasks. I am not well versed in the baselining support, so need some help in figuring out what is needed in the gradle plugin for bnd.
Alright, tools which invoke bnd outside of bnttools, or bnd projects use aQute.bnd.osgi.Builder
. This builder is for jars only, not projects.
However, baselineing is never invoked from this builder, it's only invoked from aQute.bnd.build.ProjectBuilder
. But this builder requires a fully initialized cnf (or bnd) directory from which to obtain it's configuration and without it, blows up (with cannot find workspace errors, can't find plugins and what not).
If it were possible to invoke the baseline operation from a normal builder call, then the only missing part would be configuring a baseline repository. But this repo dependency is quite trivial as the only repo capability required is artifact retrieval (against which the baseline should happen), it does not need to resolve capabilities.
An example of how this might works in maven is:
I think the only difference to what we have now (calling bnd from maven, gradle, ant) is the ability to specify a simple baseline repo (mvn type is by far the most common even for gradle and ant, via ivy).
The trick is having bnd execute the baseline, and setting up the repo as the baseline repo (needs repo plugins).
The gradle build has full access to the full bnd state of the workspace and the project. And all configuration for baselining should be in there (cnf/build.bnd and project/bnd.bnd). So assuming that the necessary configuration is present, what steps are needed for a possible baseline
task?
The bnd command line already has a baseline operation:
$ java -jar biz.aQute.bnd.jar help baseline
NAME
baseline - Compare a newer bundle to a baselined bundle and
provide versioning advice
SYNOPSIS
baseline [options] <[newer jar]> <[older jar]>
OPTIONS
[ -a, --all ] - Show all, also unchanged
[ -d, --diff ] - Show any differences
[ -f, --fixup <string> ] - Output file with fixup info
[ -q, --quiet ] - Be quiet, only report errors
We may need to move the baseline logic into bndlib.
yes so the issue is that the baseline operation in bnd is either explicit as you've shown, otherwise only accessible from a full workspace.
Also, when I talk about gradle, I'm not referring to bndtools gradle, but to gradle plugins which just use bnd as ant might.
Even the bnd baseline command requires it to be run in situ. That is, is the context of a project in a workspace. (Although the 2 arg version of the command may be able to run outside the context of a workspace.)
I am not sure what you mean by "bndtools gradle". There is a gradle plugin for bnd which is part of the bnd jar. A gradle script can apply this to a gradle project and it will configure the tasks for bnd building. This is how we build bnd and bndtools in the CI system.
could you point to docs? also, is this in the current release or in "master".
Docs for the gradle plugin? It extends the standard gradle java plugin so those tasks are all present. You can run gradle tasks --all to see the addtional ones and their descriptions. You can also see the source. Yes, this is what we use to build master.
You can also use my bndtools Gradle plugin That one (also) uses the official bnd (2.4+) plugin while keeping what bndtools 2.3 delivered (findbugs) and adding code coverage reporting for tests (jacoco) while being much more flexible.... (and it's actually documented too, see the cnf/gradle/doc directory)
Install in Eclipse from here: http://bndtools-plugins.pelagic.nl/master/
PS. There is some kind of p2 bug that makes installing/updating the plugin together with bndtools fail. Just separate installing/updating these and it'll work.
I'm not sure the point is being made clearly. The goal here is for everything unrelated to bndtools.
Ray, Not clear what you want ... The bnd command can baseline 2 jars, why this is not sufficient?
If you want this to be in maven, I move this to abeyance since I can't work on this. Or do you volunteer?
See https://github.com/bndtools/bnd/wiki/Baselining-Light-%5Bbeta%5D
No comment here until we figure out the non-workspace gradle plugin details.
I went ahead and made a couple small changes which I believe enable a very simple usage of baseline and a companion simple deployer to go with it.
With these two changes no workspace is required and it becomes very simple to implement baseline and release to repo in any build tool without a workspace setup.
An example usage is:
BaselineProcessor baselineProcessor = new BaselineProcessor();
// set your properties
Properties properties = baselineProcessor.getProperties();
properties.putAll(...);
// the jar file you want to baseline
File newerJarFile = ...
Jar newerJar = new Jar(newerJarFile);
// find the older version in configured repos
Jar olderJar = baselineProcessor.getBaselineJar();
// do baseline
Baseline baseline = new Baseline(baselineProcessor, new DiffPluginImpl());
Set<Info> infos = baseline.baseline(newerJar, olderJar, null);
Lastly, you probably want to put released artifacts into the repo in order to do future baselines:
BaselineProcessor baselineProcessor = new BaselineProcessor();
// set your properties
Properties properties = baselineProcessor.getProperties();
properties.putAll(...);
// deploy to configured releaserepo
Deployer deployer = new Deployer(baselineProcessor);
deployer.deploy(newerJarFile);
We now have baseline support for maven and non-workspace gradle.
the goal is to make it possible to baseline from non-workspace builds (i.e. maven-bundle-plugin, gradle plugins, etc. any builder which uses bnd under the hood).