Skip to content

Exclude Eclipse features from P2 Repo .versions()#7296

Merged
chrisrueger merged 1 commit into
bndtools:masterfrom
chrisrueger:7279-fix-attempt2
Jun 29, 2026
Merged

Exclude Eclipse features from P2 Repo .versions()#7296
chrisrueger merged 1 commit into
bndtools:masterfrom
chrisrueger:7279-fix-attempt2

Conversation

@chrisrueger

@chrisrueger chrisrueger commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Closes #7279
This part 2 of #7292

With this PR the compilation error is gone, because only one version of the real bundle remains (the feature does not appear as a bundle version)

image

@peterkir I am not sure if there are side-effects I have not thought of if we filter out Eclipse Features resources like this. But at least it fixes the compilation probem stated in #7279 (comment) because -buildpath picks the feature bundle (which should not be available at all because it contains no classes)

Summary

This pull request improves how Eclipse features are handled in the P2 repository implementation. The main focus is to ensure that Eclipse features are not returned as bundle versions, preventing them from being incorrectly included in build paths, while still allowing them to be accessed via dedicated feature APIs. It also introduces a new method to retrieve detailed version information and updates tests to verify the correct filtering of features.

Feature filtering and handling:

  • The versions(String bsn) method in P2Indexer now filters out versions corresponding to Eclipse features (org.eclipse.update.feature), so only actual bundle versions are returned. This prevents features from being added to the build path accidentally.
  • A static constant ECLIPSE_FEATURE_CAPABILITY is introduced to avoid hardcoding the feature type string in multiple places, improving maintainability and reducing errors. [1] [2] [3] [4] [5]

API enhancements:

  • The BridgeRepository class adds a new versionInfos(String bsn) method, which returns a map of versions to their associated ResourceInfo, allowing more granular inspection and filtering of resources.

Testing improvements:

  • The P2RepositoryTest is updated with new assertions to verify that feature versions are properly filtered out from the main repository, but remain accessible via the getFeatures() API. This ensures the intended behavior is enforced and tested.

Versioning:

  • The package version for aQute.bnd.osgi.repository is incremented from 3.3.0 to 3.4.0 to reflect the new API addition.

@chrisrueger chrisrueger marked this pull request as ready for review June 26, 2026 19:05
@chrisrueger chrisrueger marked this pull request as draft June 26, 2026 19:32
@chrisrueger

Copy link
Copy Markdown
Contributor Author

Found a problem...

@chrisrueger

Copy link
Copy Markdown
Contributor Author

New approach. Now I filter only in P2Repo.versions(bsn)

@chrisrueger chrisrueger marked this pull request as ready for review June 26, 2026 20:47
@chrisrueger chrisrueger requested a review from peterkir June 26, 2026 20:47
@chrisrueger chrisrueger changed the title Exclude Eclipse features from P2Index Bridge Repo Exclude Eclipse features from P2 Repo .versions() Jun 27, 2026
@chrisrueger chrisrueger force-pushed the 7279-fix-attempt2 branch 2 times, most recently from e1820e1 to 8ca8872 Compare June 29, 2026 12:59
Ensure that p2repo.versions(bsn) does not return versions for features (prevents them from being picked up by -buildpath), and apply this filter when loading resources from an index.

Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>

@peterkir peterkir 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.

Works like a charm

@chrisrueger chrisrueger merged commit 26b401b into bndtools:master Jun 29, 2026
11 checks passed
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.

[bndtools 7.3.0] mix up features and bundles in p2 repository

2 participants