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

Add a 'wires' command to allow easy investigation of bundle wires #466

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

laeubi
Copy link
Member

@laeubi laeubi commented Jan 4, 2024

Currently it is quite hard to find out if/why a certain bundle is using some other bundles or are used by others.

This adds a new 'wires' command that when executed against a given bundle prints all wires that are used by the bundle and any wires it provides to other bundles. This results in a very powerful tool to analyze dependency problems and find out why a bundle is actually used.

An example output looks like this:

Bundle org.eclipse.ui.workbench 3.131.100.qualifier:
is wired to:
	 - com.ibm.icu 74.1.0
	   - because of Import-Package: com.ibm.icu.util
	 - jakarta.annotation-api 2.1.1
	   - because of Import-Package: jakarta.annotation; version="[2.1.0,3.0.0)"
	 - jakarta.inject.jakarta.inject-api 2.0.1
	   - because of Import-Package: jakarta.inject; version="[2.0.0,3.0.0)"
	 - org.apache.felix.scr 2.2.6
	   - because of Require-Capability: osgi.extender; filter:="(&(osgi.extender=osgi.component)(version>=1.2)(!(version>=2.0)))"
	 - org.eclipse.core.databinding.observable 1.13.200.qualifier
	   - because of Require-Bundle: org.eclipse.core.databinding.observable; bundle-version="[1.2.0,2.0.0)"
	 - org.eclipse.core.databinding.property 1.10.200.qualifier
	   - because of Require-Bundle: org.eclipse.core.databinding.property; bundle-version="[1.2.0,2.0.0)"
	 - org.eclipse.core.runtime 3.31.0.qualifier
	   - because of Require-Bundle: org.eclipse.core.runtime; bundle-version="[3.29.0,4.0.0)"
	 - org.eclipse.e4.core.commands 1.1.300.qualifier
	   - because of Import-Package: org.eclipse.e4.core.commands
	   - because of Import-Package: org.eclipse.e4.core.commands.internal
	 - org.eclipse.e4.core.contexts 1.12.500.qualifier
	   - because of Require-Bundle: org.eclipse.e4.core.contexts; bundle-version="1.0.0"
	 - org.eclipse.e4.core.di 1.9.300.qualifier
	   - because of Require-Bundle: org.eclipse.e4.core.di; bundle-version="1.1.0"
	 - org.eclipse.e4.core.di.extensions 0.18.200.qualifier
	   - because of Require-Bundle: org.eclipse.e4.core.di.extensions; bundle-version="0.13.0"
	 - org.eclipse.e4.core.services 2.4.300.qualifier
	   - because of Require-Bundle: org.eclipse.e4.core.services; bundle-version="2.2.0"
	 - org.eclipse.e4.ui.bindings 0.14.300.qualifier
	   - because of Require-Bundle: org.eclipse.e4.ui.bindings; bundle-version="0.9.0"
	 - org.eclipse.e4.ui.css.swt 0.15.300.qualifier
	   - because of Require-Bundle: org.eclipse.e4.ui.css.swt; bundle-version="0.9.1"
	 - org.eclipse.e4.ui.css.swt.theme 0.14.300.qualifier
	   - because of Require-Bundle: org.eclipse.e4.ui.css.swt.theme; bundle-version="0.9.0"
	 - org.eclipse.e4.ui.di 1.5.300.qualifier
	   - because of Require-Bundle: org.eclipse.e4.ui.di; bundle-version="0.9.0"
	 - org.eclipse.e4.ui.model.workbench 2.4.200.qualifier
	   - because of Require-Bundle: org.eclipse.e4.ui.model.workbench; bundle-version="0.9.1"
	 - org.eclipse.e4.ui.services 1.6.300.qualifier
	   - because of Import-Package: org.eclipse.e4.ui.services
	   - because of Require-Bundle: org.eclipse.e4.ui.services; bundle-version="1.3.0"
	 - org.eclipse.e4.ui.workbench 1.15.300.qualifier
	   - because of Import-Package: org.eclipse.e4.ui.internal.workbench
	   - because of Import-Package: org.eclipse.e4.ui.internal.workbench.addons
	   - because of Import-Package: org.eclipse.e4.ui.workbench
	   - because of Import-Package: org.eclipse.e4.ui.workbench.modeling
	 - org.eclipse.e4.ui.workbench.addons.swt 1.5.300.qualifier
	   - because of Require-Bundle: org.eclipse.e4.ui.workbench.addons.swt; bundle-version="0.10.0"
	 - org.eclipse.e4.ui.workbench.renderers.swt 0.16.300.qualifier
	   - because of Import-Package: org.eclipse.e4.ui.internal.workbench.renderers.swt
	   - because of Import-Package: org.eclipse.e4.ui.workbench.renderers.swt
	 - org.eclipse.e4.ui.workbench.swt 0.17.300.qualifier
	   - because of Import-Package: org.eclipse.e4.ui.internal.workbench.swt
	   - because of Require-Bundle: org.eclipse.e4.ui.workbench.swt; bundle-version="0.9.1"
	 - org.eclipse.e4.ui.workbench3 0.17.300.qualifier
	   - because of Require-Bundle: org.eclipse.e4.ui.workbench3; bundle-version="0.15.0"; visibility:="reexport"
	 - org.eclipse.emf.ecore.xmi 2.37.0.qualifier
	   - because of Require-Bundle: org.eclipse.emf.ecore.xmi; bundle-version="2.11.0"
	 - org.eclipse.help 3.10.300.qualifier
	   - because of Require-Bundle: org.eclipse.help; bundle-version="[3.2.0,4.0.0)"
	 - org.eclipse.jface 3.33.0.qualifier
	   - because of Require-Bundle: org.eclipse.jface; bundle-version="[3.31.0,4.0.0)"
	 - org.eclipse.jface.databinding 1.15.200.qualifier
	   - because of Require-Bundle: org.eclipse.jface.databinding; bundle-version="[1.3.0,2.0.0)"
	 - org.eclipse.osgi 3.19.0.qualifier
	   - because of Import-Package: javax.xml.parsers
	   - because of Import-Package: org.w3c.dom
	   - because of Import-Package: org.xml.sax
	   - because of Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=17))"
	 - org.osgi.service.event 1.4.1.202109301733
	   - because of Import-Package: org.osgi.service.event; version="[1.2.0,2.0.0)"
and is consumed by:
	 - org.eclipse.jdt.ui 3.31.100.qualifier
	   - because it Require-Bundle: org.eclipse.ui.workbench; bundle-version="[3.131.0,4.0.0)"
	 - org.eclipse.ui 3.205.100.qualifier
	   - because it Require-Bundle: org.eclipse.ui.workbench; bundle-version="[3.130.0,4.0.0)"; visibility:="reexport"
	 - org.eclipse.ui.editors 3.17.200.qualifier
	   - because it Require-Bundle: org.eclipse.ui.workbench; bundle-version="[3.130.0,4.0.0)"
	 - org.eclipse.ui.genericeditor 1.3.300.qualifier
	   - because it Require-Bundle: org.eclipse.ui.workbench; bundle-version="3.109.0"
	 - org.eclipse.ui.intro.quicklinks 1.2.300.qualifier
	   - because it Require-Bundle: org.eclipse.ui.workbench; bundle-version="3.108.0"

Copy link

github-actions bot commented Jan 4, 2024

Test Results

   24 files  ±0     24 suites  ±0   11m 19s ⏱️ -4s
2 150 tests ±0  2 105 ✅ ±0  45 💤 ±0  0 ❌ ±0 
2 194 runs  ±0  2 149 ✅ ±0  45 💤 ±0  0 ❌ ±0 

Results for commit 232460e. ± Comparison against base commit de625e7.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@tjwatson tjwatson left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@tjwatson tjwatson left a comment

Choose a reason for hiding this comment

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

Sorry, one change request. Can you update the package version for org.eclipse.osgi.container?

@laeubi
Copy link
Member Author

laeubi commented Jan 5, 2024

Sorry, one change request. Can you update the package version for org.eclipse.osgi.container?

Done.

@laeubi laeubi requested a review from tjwatson January 5, 2024 06:35
Currently it is quite hard to find out if/why a certain bundle is using
some other bundles or are used by others.

This adds a new 'wires' command that when executed against a given
bundle prints all wires that are used by the bundle and any wires it
provides to other bundles. This results in a very powerful tool to
analyze dependency problems and find out why a bundle is actually used.

Co-authored-by: Titouan Vervack <tivervac@gmail.com>
Copy link
Contributor

@tjwatson tjwatson left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM

@laeubi laeubi merged commit 1d9eb47 into eclipse-equinox:master Jan 5, 2024
22 of 24 checks passed
@iloveeclipse
Copy link
Member

Question : is this available from osgi console? If yes, could you provide an example command? Ideally this would be also mentioned in N&N.

laeubi added a commit to laeubi/www.eclipse.org-eclipse that referenced this pull request Jan 5, 2024
@laeubi
Copy link
Member Author

laeubi commented Jan 5, 2024

is this available from osgi console

Yes it is a regular osgi console command

If yes, could you provide an example command

Given you know the id of the bundle simply type

wires <id>

and you get the output.

Ideally this would be also mentioned in N&N.

laeubi added a commit to eclipse-platform/www.eclipse.org-eclipse that referenced this pull request Jan 5, 2024
@mickaelistria
Copy link
Contributor

Thank you for this great and extremely useful addition!

@HannesWell
Copy link
Member

Thank you for this great and extremely useful addition!

I can only second that. I often needed that in the past and had to find other less convenient ways.

@laeubi
Copy link
Member Author

laeubi commented Jan 9, 2024

This improvement was gently sponsored by Sigasi.

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.

6 participants