Skip to content

Add Bundle Graph visualization view to bndtools#7106

Merged
chrisrueger merged 1 commit intomasterfrom
copilot/add-bundle-graph-visualization
Feb 25, 2026
Merged

Add Bundle Graph visualization view to bndtools#7106
chrisrueger merged 1 commit intomasterfrom
copilot/add-bundle-graph-visualization

Conversation

Copy link
Contributor

Copilot AI commented Feb 20, 2026

Adds a new Bundle Graph Eclipse ViewPart that renders a MermaidJS dependency graph of OSGi bundles in a bndtools workspace, with an interactive dual-list selection builder.

Model layer (bndtools.views.bundlegraph.model)

  • BundleNode — record keyed on bsn + version (identity excludes projectName metadata so cross-provider nodes compare equal)
  • BundleEdge(from, to, boolean optional) — edge is optional iff all contributing Import-Package entries carry resolution:=optional
  • BundleGraphModel interface — nodes(), edges(), nodeToJar(); SimpleBundleGraphModel is the single concrete implementation
  • GraphClosures — BFS transitive closure for dependencies / dependants

Dependency calculation (ManifestDependencyCalculator)

Reads MANIFEST.MF from each bundle's generated JAR via aQute.bnd.osgi.Jar.getManifest() + Domain.domain():

  • Builds package → Set<BundleNode> exporter map (supports split packages / fragments — all co-exporters receive edges)
  • Emits BundleEdge per (importer, exporter) pair, tracking optionality per contributing import
  • Stored as nodeToJar: Map<BundleNode, File> in the model; mergeIntoUniverse() always recomputes edges over the full merged jar map so cross-provider edges (e.g. project node added to a repo universe) are never missed

Universe providers

Provider Input Notes
ProjectUniverseProvider List<IProject> Resolves JAR via Project.getOutputFile()
BndrunUniverseProvider IFile (.bndrun) Parses -runbundles via existing bnd APIs
RepositoryUniverseProvider List<RepositoryPlugin> Downloads JARs via repo.get() for all BSN/version pairs

View (BundleGraphView)

  • Vertical SashForm: top = selection builder, bottom = embedded SWT Browser (MermaidJS bundled locally at resources/unprocessed/mermaid/mermaid.min.js — no CDN required)
  • Available bundles list with Delete/Remove button; Selected bundles list with double-click-to-remove and Ctrl+C copy
  • Toolbar: Refresh Universe, Add from Repositories (additive merge), Copy Mermaid to Clipboard, Toggle Graph Maximized
  • Edge filter combo: All / Only mandatory / Only optional — when not ALL, nodes with no visible edges are hidden, and secondary↔secondary edges are suppressed (only edges touching a primary/seed node are shown)
  • Primary (seed) nodes styled differently from secondary (dependency/dependant) nodes via MermaidJS classDef; optional edges rendered as dotted arrows (-.->)
  • Zoom controls: / combo (25 %–200 %) / +, implemented via window.setZoom(scale) scaling a #scaler div inside a scrollable #viewport

Drag-and-drop

Both lists accept drops from:

  • Package Explorer / Navigator: .bndrun files → BndrunUniverseProvider; IProject resources → ProjectUniverseProvider
  • Repositories view: RepositoryBundleVersion, RepositoryBundle (latest version), RepositoryPlugin (whole repo)

Drop on Available → merges into universe; drop on Selected → merges into universe and adds to selected set. After any merge the full edge set is recomputed over the combined jar map.

Context-menu integration (ShowBundleGraphHandler)

  • Right-click .bndrunShow Bundle Graph (seeds universe + selection from -runbundles)
  • Right-click project(s) → Show Bundle Graph (seeds universe from project JARs)
  • View supports allowMultiple="true" — each invocation opens a new instance with a unique secondary ID

Rendering (MermaidRenderer)

// EdgeFilter controls what edges (and their nodes) appear:
MermaidRenderer.toMermaid(model, subset, primaryNodes, EdgeFilter.ONLY_MANDATORY);
// → mandatory solid arrows -->, optional dotted arrows -.->
// → secondary↔secondary edges suppressed when primaryNodes non-empty
// → disconnected nodes hidden under ONLY_MANDATORY / ONLY_OPTIONAL

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:


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Add Bundle Graph visualization feature to bndtools Add Bundle Graph view for visualizing OSGi bundle dependencies in bndtools Feb 20, 2026
Copilot AI requested a review from chrisrueger February 20, 2026 09:02
Copilot AI changed the title Add Bundle Graph view for visualizing OSGi bundle dependencies in bndtools Bundle Graph: compute dependency edges from JAR manifest Import/Export-Package headers Feb 20, 2026
Copilot AI changed the title Bundle Graph: compute dependency edges from JAR manifest Import/Export-Package headers Add Bundle Graph view for visualizing OSGi bundle dependencies in bndtools Feb 21, 2026
Copilot AI changed the title Add Bundle Graph view for visualizing OSGi bundle dependencies in bndtools Add Bundle Graph visualization for OSGi bundle dependencies in bndtools Feb 21, 2026
Copilot AI changed the title Add Bundle Graph visualization for OSGi bundle dependencies in bndtools bndtools Bundle Graph view: new feature Feb 21, 2026
Copilot AI changed the title bndtools Bundle Graph view: new feature bndtools: Add Bundle Graph view for visualizing OSGi bundle dependencies Feb 22, 2026
@chrisrueger chrisrueger force-pushed the copilot/add-bundle-graph-visualization branch from b140277 to 2564eec Compare February 22, 2026 20:00
Copilot AI changed the title bndtools: Add Bundle Graph view for visualizing OSGi bundle dependencies bndtools: Add Bundle Graph view for OSGi bundle dependency visualization Feb 22, 2026
@chrisrueger chrisrueger force-pushed the copilot/add-bundle-graph-visualization branch from 6c2f2e6 to 99e27e2 Compare February 22, 2026 20:49
@chrisrueger chrisrueger marked this pull request as ready for review February 22, 2026 20:49
Copilot AI changed the title bndtools: Add Bundle Graph view for OSGi bundle dependency visualization Bundle Graph: add "Include optional imports" filter checkbox Feb 22, 2026
Copilot AI changed the title Bundle Graph: EdgeFilter combo, optional edge styling, and disconnected-node hiding Add Bundle Graph visualization to bndtools (Eclipse view for OSGi bundle dependencies) Feb 23, 2026
Copilot AI changed the title Add Bundle Graph visualization to bndtools (Eclipse view for OSGi bundle dependencies) Add Bundle Graph visualization view to bndtools Eclipse plugin Feb 23, 2026
Copilot AI changed the title Add Bundle Graph visualization view to bndtools Eclipse plugin Add Bundle Graph visualization to bndtools Eclipse plugin Feb 23, 2026
Copilot AI changed the title Add Bundle Graph visualization to bndtools Eclipse plugin Add Bundle Graph view to bndtools: visualize workspace/repository bundle dependencies Feb 23, 2026
Copilot AI changed the title Add Bundle Graph view to bndtools: visualize workspace/repository bundle dependencies Add Bundle Graph visualization view to bndtools Eclipse plugin Feb 23, 2026
@chrisrueger chrisrueger force-pushed the copilot/add-bundle-graph-visualization branch 2 times, most recently from 0346581 to 3f257dd Compare February 24, 2026 20:26
@chrisrueger chrisrueger requested a review from Copilot February 24, 2026 20:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Bundle Graph visualization feature to the bndtools.core Eclipse plugin, including a model layer, universe providers (workspace projects, .bndrun, repositories), manifest-based dependency calculation, and MermaidJS-based rendering inside an SWT Browser.

Changes:

  • Introduces bundle graph model types (BundleNode, BundleEdge, BundleGraphModel) plus closure utilities for dependencies/dependants.
  • Implements universe providers and a view (BundleGraphView) with drag-and-drop, repository loading, edge filtering, and zoom.
  • Adds Mermaid rendering + unit tests for closures, rendering modes, and manifest dependency optionality.

Reviewed changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
bndtools.core/test/bndtools/views/bundlegraph/MermaidRendererTest.java Unit tests for Mermaid rendering modes, styling, and edge filtering
bndtools.core/test/bndtools/views/bundlegraph/ManifestDependencyCalculatorTest.java Unit tests for dependency calculation and optional-edge behavior
bndtools.core/test/bndtools/views/bundlegraph/GraphClosuresTest.java Unit tests for dependency/dependant closure logic and node identity semantics
bndtools.core/src/bndtools/views/bundlegraph/render/MermaidRenderer.java Converts graph subsets into Mermaid definitions (styling + filters)
bndtools.core/src/bndtools/views/bundlegraph/render/EdgeFilter.java Defines edge filtering options (all/mandatory/optional)
bndtools.core/src/bndtools/views/bundlegraph/model/SimpleBundleGraphModel.java Concrete model implementation storing nodes/edges/jar map
bndtools.core/src/bndtools/views/bundlegraph/model/GraphClosures.java BFS closure helper over dependencies/dependants
bndtools.core/src/bndtools/views/bundlegraph/model/BundleNode.java Node identity semantics (bsn+version) with projectName metadata
bndtools.core/src/bndtools/views/bundlegraph/model/BundleGraphModel.java Model interface, with default edges() and nodeToJar()
bndtools.core/src/bndtools/views/bundlegraph/model/BundleEdge.java Edge type including optionality flag
bndtools.core/src/bndtools/views/bundlegraph/RepositoryUniverseProvider.java Builds a model from selected bnd repositories
bndtools.core/src/bndtools/views/bundlegraph/RepositorySelectionDialog.java UI dialog to select repositories to import into the universe
bndtools.core/src/bndtools/views/bundlegraph/ProjectUniverseProvider.java Builds a model from selected Eclipse projects
bndtools.core/src/bndtools/views/bundlegraph/ManifestDependencyCalculator.java Manifest-driven Import/Export-Package dependency + optionality computation
bndtools.core/src/bndtools/views/bundlegraph/BundleGraphView.java Eclipse view: selection builder + embedded Mermaid browser renderer
bndtools.core/src/bndtools/views/bundlegraph/BundleGraphDropAdapter.java Drag-and-drop support for .bndrun, projects, and repository items
bndtools.core/src/bndtools/views/bundlegraph/BndrunUniverseProvider.java Builds a model from -runbundles in a .bndrun
bndtools.core/src/bndtools/command/ShowBundleGraphHandler.java Command handler to open/populate the Bundle Graph view
bndtools.core/resources/unprocessed/mermaid/LICENSE-mermaid.txt Adds Mermaid MIT license text for bundled MermaidJS
bndtools.core/_plugin.xml Registers the view, command, handler, and context-menu contributions

Add manifest-based dependency calculation to Bundle Graph view. Graph entities can be populated by DragnDrop from Repos, Projects or .bndrun files

fixing code review points:
- use bndrun resolved bundle version instead of range
- repo: use all bundle versions
- Support multiple exporters per package (split packages) in ManifestDependencyCalculator

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

only DragnDrop

Co-Authored-By: chrisrueger <188422+chrisrueger@users.noreply.github.com>
@chrisrueger
Copy link
Contributor

Current state which is ready for master.

image

Last thing I added support for drag&drop from Repositories, Projects or .bndrun files into the Graph lists.

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.

4 participants