Skip to content

Commit

Permalink
baseline: Avoid warning at major version boundaries
Browse files Browse the repository at this point in the history
There is nothing which requires the first release to use version 1.0.
Especially with the desire to rename things at major boundaries, it is
not unexpected that the first release of an artifact may be version 2.0
or 3.0. And in this case, a warning about missing baseline is noise.

Signed-off-by: BJ Hargrave <[email protected]>
  • Loading branch information
bjhargrave committed Nov 9, 2022
1 parent aab80cb commit 38b3552
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
18 changes: 17 additions & 1 deletion biz.aQute.bndlib.tests/test/test/baseline/BaselineTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,23 @@ public void testNothingInRepo(@InjectTemporaryDirectory
p3.build();
assertTrue(p3.check());

p3.setBundleVersion("5");
p3.setBundleVersion("1.0.1");
p3.build();
assertTrue(p3.check("There is no baseline for p3 in the baseline repo"));

p3.setBundleVersion("1.1");
p3.build();
assertTrue(p3.check("There is no baseline for p3 in the baseline repo"));

p3.setBundleVersion("2.0.0.XXXXXX");
p3.build();
assertTrue(p3.check());

p3.setBundleVersion("2.0.1");
p3.build();
assertTrue(p3.check("There is no baseline for p3 in the baseline repo"));

p3.setBundleVersion("2.1");
p3.build();
assertTrue(p3.check("There is no baseline for p3 in the baseline repo"));
} finally {
Expand Down
13 changes: 7 additions & 6 deletions biz.aQute.bndlib/src/aQute/bnd/build/ProjectBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -517,17 +517,18 @@ public Jar getBaselineJar() throws Exception {
return null; // errors reported already

String bsn = getBsn();
Version version = new Version(getVersion());
Version version = Version.parseVersion(getVersion());
SortedSet<Version> versions = removeStagedAndFilter(repo.versions(bsn), repo, bsn);

if (versions.isEmpty()) {
// We have a repo
Version v = Version.parseVersion(getVersion())
.getWithoutQualifier();
if (v.compareTo(Version.ONE) > 0) {
// Baselining 0.x is uninteresting
// x.0.0 is a new major version so maybe there is no baseline
if ((version.getMajor() > 0) &&
((version.getMinor() > 0) || (version.getMicro() > 0))) {
warning(
"There is no baseline for %s in the baseline repo %s. The build is for version %s, which is higher than 1.0.0 which suggests that there should be a prior version.",
getBsn(), repo, v);
"There is no baseline for %s in the baseline repo %s. The build is for version %s, which is higher than %s which suggests that there should be a prior version.",
getBsn(), repo, version.getWithoutQualifier(), new Version(version.getMajor()));
}
return null;
}
Expand Down

0 comments on commit 38b3552

Please sign in to comment.