Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

baseline: Avoid warning at major version boundaries #5419

Merged
merged 1 commit into from Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 17 additions & 1 deletion biz.aQute.bndlib.tests/test/test/baseline/BaselineTest.java
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
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