Skip to content

Comments

Add -baselineincludezeromajor global instruction to enable baselining for 0.x versions#7076

Open
Copilot wants to merge 6 commits intomasterfrom
copilot/allow-baselining-for-0x-versions
Open

Add -baselineincludezeromajor global instruction to enable baselining for 0.x versions#7076
Copilot wants to merge 6 commits intomasterfrom
copilot/allow-baselining-for-0x-versions

Conversation

Copy link
Contributor

Copilot AI commented Feb 2, 2026

Baselining currently skips all packages with major version 0, per semver spec stating "0.y.z is for initial development." Users need baselining for versions [0.1.0, 1.0.0) while still excluding 0.0.x.

Changes

Configuration

  • Added INCLUDEZEROMAJOR constant for new -baselineincludezeromajor global instruction
  • Added to options set in Constants.java

Baseline logic

  • Baseline.mismatch() now checks only newer version when -baselineincludezeromajor=true, excluding 0.0.x
  • Reads configuration from global property (cast Reporter to Processor)
  • ProjectBuilder.getBaselineJar() warns about missing baselines for 0.x when enabled

Tests

  • testMismatchForZeroMajorWhenIncludeZeroMajorEnabled - validates 0.1+ baselining
  • testNoMismatchForZeroZeroVersionsEvenWithIncludeZeroMajor - validates 0.0.x exclusion
  • testNoMismatchForZeroMajor - validates default behavior unchanged

Documentation

  • Updated baselining chapter to reference -baselineincludezeromajor instruction
  • Created new /docs/_instructions/_ext/baselineincludezeromajor.md documentation file
  • Updated diffpackages instruction reference

Usage

-baseline: *
-baselineincludezeromajor: true

Default value is false for backward compatibility.

Original prompt

This section details on the original issue you should resolve

<issue_title>Allow Baselining for 0.x versions</issue_title>
<issue_description>... baselining to also work on 0.x packages.

Originally posted by @peterkir in #6702 (comment)

Currently in the baseline feature there is a special handling for versions < 1.0
From: https://bnd.bndtools.org/chapters/180-baselining.html#setting-up-a-project-for-baselining

the bundle/package version must be 1.0.0 or above. If the version is less (i.e. major version being 0) no baselining is possible, the purpose is to allow the primordial baseline to be established without errors.

In the discussions in #6702 it was suggested that this special handling should be removed and baselining should work for all versions including 0.x

History

The following issue and commit seem to be how this feature was created.

/**
* "Major version zero (0.y.z) is for initial development. Anything may
* change at any time. The public API should not be considered stable."
*
* @see <a href="https://semver.org/#spec-item-4">SemVer</a>
*/
private boolean mismatch(Version older, Version newer) {
return older.getMajor() > 0 && newer.getMajor() > 0;
}

Configurability

TODO this needs to be discussed. Probably this new behavior should be opt in, to be backwards compatible</issue_description>

<agent_instructions>Analyse the changes required to also allow baselining support for bundles and package version for the version range between [0.1,1)</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits February 2, 2026 09:59
Co-authored-by: peterkir <250545+peterkir@users.noreply.github.com>
Co-authored-by: peterkir <250545+peterkir@users.noreply.github.com>
Co-authored-by: peterkir <250545+peterkir@users.noreply.github.com>
Copilot AI changed the title [WIP] Allow baselining for 0.x versions Add includezeromajor attribute to enable baselining for 0.x versions Feb 2, 2026
Copilot AI requested a review from peterkir February 2, 2026 10:08
@chrisrueger
Copy link
Contributor

chrisrueger commented Feb 4, 2026

Question came up during discussion:

  1. Should setting be a global switch (e.g. -inludezeromajor=true/false)?

Example:

-inludezeromajor=true
-baseline *
-diffpackages: com.foo,\
               !com.bar
-inludezeromajor=true
-baseline com.example.foo;version=1.2, \
          com.example.bar;file=foo-1.2.3.jar
-diffpackages: com.foo,\
               !com.bar

  1. or should it be configurable per bundle / package level? (what are are realistic use cases?)

Example:

-baseline *;inludezeromajor=true
-diffpackages: com.foo,\
               !com.bar

-baseline com.example.foo;version=1.2, \
          com.example.bar;file=foo-1.2.3.jar
-diffpackages: com.foo;-inludezeromajor=true,\
              com.foo2,\
               !com.bar;

For the record: At the moment I favor 1. global switch -inludezeromajor=true

@chrisrueger
Copy link
Contributor

@copilot This PR introduces a includezeromajor directive at the package level of the -diffpackages instruction. Please change this to a simple global -includezeromajor: true/false instruction to enable this behavior. Default should be false.

Co-authored-by: chrisrueger <188422+chrisrueger@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 11, 2026

@copilot This PR introduces a includezeromajor directive at the package level of the -diffpackages instruction. Please change this to a simple global -includezeromajor: true/false instruction to...

Done! Changed to a global -includezeromajor: true/false instruction with default false.

The implementation now:

  • Reads from global property instead of diffpackages attribute
  • Updated all tests to use the global instruction
  • Created new documentation file for the instruction
  • Removed includezeromajor from diffpackages docs

Commit: 4f6796f

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • bndtools.jfrog.io
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -Xms1024m -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en (dns block)
  • scans-in.gradle.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -Xms1024m -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Add includezeromajor attribute to enable baselining for 0.x versions Add -includezeromajor global instruction to enable baselining for 0.x versions Feb 11, 2026
Copilot AI requested a review from chrisrueger February 11, 2026 19:54
Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
@chrisrueger chrisrueger changed the title Add -includezeromajor global instruction to enable baselining for 0.x versions Add -baselineincludezeromajor global instruction to enable baselining for 0.x versions Feb 11, 2026
@chrisrueger
Copy link
Contributor

FYI @peterkir
In the last two commits I changed it to the a global switch approach:

-baselineinludezeromajor=true

If you want to try the other "per package" route, we could just revert the last two commits or derive a new PR. Let's see what the build is saying.

Copy link
Contributor

@kwin kwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but haven't tried it out.

@chrisrueger
Copy link
Contributor

LGTM, but haven't tried it out.

Thanks. That's ok. We still have the SNAPSHOT and potential RC1 to try it out. Just some first feedback if docs and general feature description is matches the expectation.

@chrisrueger chrisrueger marked this pull request as ready for review February 14, 2026 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow Baselining for 0.x versions

4 participants