Skip to content

new -nosubstitution instruction to disable package substitution globally (comparable to -noimport:=true) - #6847

Merged
chrisrueger merged 1 commit into
bndtools:masterfrom
chrisrueger:6844-add-instruction-to-disable-substitution
Oct 19, 2025
Merged

chrisrueger merged 1 commit into
bndtools:masterfrom
chrisrueger:6844-add-instruction-to-disable-substitution

Conversation

@chrisrueger

@chrisrueger chrisrueger commented Oct 1, 2025 •

Copy link
Copy Markdown
Contributor

Closes #6844

This is about https://bnd.bndtools.org/chapters/170-versioning.html#substitution

Setting this new instruction to -nosubstitution:true disables package substitution globally (default is false). That means, that bnd does not calculate Import-Package references for any package in exports.

This is equivalent to Export-Package: *;-noimport:=true or -exportcontents: *;-noimport:=true

Note: This is an optional / opt-in feature. Nothing changes if you do not use it.

Why is it useful?

This new instruction is useful for library authors who never want to have any exported packages in Import-Package (example)

Example

-nosubstitution:true
Export-Package: *
Import-Package: *

or

-nosubstitution:true
-exportcontents: *
Import-Package: *

This ensures that no Import-Package is calculated for any package in Export-Package

The advantage is that -nosubstitution:true is a global switch, thus a developer cannot forget to add -noimport:=true in case of a more fine-grained Export-Package declaration with multiple packages.

-nosubstitution:true
Export-Package: a;-noimport:=true,\
                              b,\ # here -noimport:=true,\ was forgotten
                              c # here -noimport:=true,\ was forgotten
Import-Package: *

In the latter example even though -noimport:=true directive was forgotten, the -nosubstitution:true takes care of it.

@laeubi could give additional examples on use cases

@chrisrueger
chrisrueger force-pushed the 6844-add-instruction-to-disable-substitution branch from f15c8ee to da6cad3 Compare October 1, 2025 08:48
@chrisrueger chrisrueger self-assigned this Oct 1, 2025
@chrisrueger
chrisrueger marked this pull request as ready for review October 1, 2025 08:49
@chrisrueger
chrisrueger force-pushed the 6844-add-instruction-to-disable-substitution branch 2 times, most recently from 89f83ff to 0559e5f Compare October 1, 2025 09:04
@chrisrueger chrisrueger changed the title new -substitution instruction new -substitution instruction to disable package substitution globally (comparable to -noimport:=true) Oct 1, 2025
@chrisrueger
chrisrueger force-pushed the 6844-add-instruction-to-disable-substitution branch 2 times, most recently from 6c9c0b6 to 8705b69 Compare October 4, 2025 06:52

@laeubi laeubi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me!

@chrisrueger
chrisrueger force-pushed the 6844-add-instruction-to-disable-substitution branch from 8705b69 to 63adc5f Compare October 6, 2025 04:39
@chrisrueger

Copy link
Copy Markdown
Contributor Author

Renamed it to -nosubstitution: true after feedback.

@chrisrueger chrisrueger changed the title new -substitution instruction to disable package substitution globally (comparable to -noimport:=true) new -nosubstitution instruction to disable package substitution globally (comparable to -noimport:=true) Oct 6, 2025
@chrisrueger
chrisrueger force-pushed the 6844-add-instruction-to-disable-substitution branch from 63adc5f to ad21dee Compare October 6, 2025 10:52
- allows to globally disable package substitution
- generated docs for -nosubstitution instruction

Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
@chrisrueger
chrisrueger force-pushed the 6844-add-instruction-to-disable-substitution branch from ad21dee to 6174b24 Compare October 6, 2025 11:22
@chrisrueger

Copy link
Copy Markdown
Contributor Author

Going to merge since no objections in the recent weeks.

@chrisrueger
chrisrueger merged commit 8620eab into bndtools:master Oct 19, 2025
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.

Add support to disable substitution packages

2 participants