Skip to content

Commit

Permalink
Merge pull request #5419 from bjhargrave/baseline-missing-warning
Browse files Browse the repository at this point in the history
baseline: Avoid warning at major version boundaries
  • Loading branch information
bjhargrave authored Nov 9, 2022
2 parents aab80cb + 38b3552 commit 161b9cf
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 161b9cf

Please sign in to comment.