#2296: Refactor ToolCommandlet to determine InstalledEdition and Version in a Single Cached Lookup - #2306
Conversation
Coverage Report for CI Build 32020213701Warning No base build found for commit Coverage: 73.056%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats💛 - Coveralls |
laert-ll
left a comment
There was a problem hiding this comment.
Thanks for your work! The overall direction is nice, and the EditionAndVersion with a single cached lookup is exactly what the issue was after. I've left a few inline comments on some details that need some improvement.
The main thing I noticed is that the branch seems to accidentally include some unrelated work (the GUI changes from #2278 and some changelog changes as well). Make sure to rebase to main to clean this up and fix the merge conflicts. Apart from that I would also suggest adding some tests for this.
Other than that, thanks for your contribution again!
) Introduce EditionAndVersion to resolve a tool's installed edition and version in a single cached lookup, with a protected computeInstalledEditionAndVersion() hook. - KubeCtl: read version from 'kubectl version --client' and route through the public getInstalledEditionAndVersion() override so it is actually used; add KubeCtlTest. - LocalToolCommandlet: resolve edition and version in one tool-path lookup. - Docker: keep the resolved edition consistent ('docker'/'rancher') across all OSes instead of the bogus 'desktop'; detect the Docker Desktop version on macOS from the Docker.app bundle; add DockerTest. - CHANGELOG: add devonfw#2296 line under 2026.08.002. Rebased onto upstream/main (drops unrelated devonfw#2278 work).
a9c8cee to
160440a
Compare
Implemented changes:
This PR refactors the way IDEasy determines the installed edition and version of tools. Previously,
getInstalledEdition()andgetInstalledVersion()were separate methodsthat often performed redundant expensive lookups (registry queries, process execution, etc.). The new combined approach computes both values in a single call.
EditionAndVersion(String edition, VersionIdentifier version)to hold both values togethergetInstalledEditionAndVersion()withCachedValuetoToolCommandlet— delegates tocomputeInstalledEditionAndVersion()getInstalledVersion()andgetInstalledEdition()final— they now delegate to the combined methodcomputeInstalledEditionAndVersion()inLocalToolCommandlet(resolves edition + version via software link target)GlobalToolCommandlet:getWindowsRegistryAppNames()returnsMap<String, String>mapping edition → registry app nameDocker: returnsMap.of(\"docker\", \"Docker Desktop\", \"rancher\", \"Rancher Desktop\")— enabling correct detection of Rancher Desktop editioncomputeInstalledEditionAndVersion()inLocalToolCommandlet(resolves edition + version via software link target)GlobalToolCommandlet:getWindowsRegistryAppNames()returnsMap<String, String>mapping edition → registry app nameDocker: returnsMap.of(\"docker\", \"Docker Desktop\", \"rancher\", \"Rancher Desktop\")— enabling correct detection of Rancher Desktop editioninvalidateInstalledEditionAndVersion()IdeContext.findProjectswas package-private instead of public)Backward compatibility is maintained via deprecated hooks (
computeInstalledEdition(),computeInstalledVersion(),getInstalledVersionDeprecated(),getInstalledEditionDeprecated()).Testing instructions
Checklist for this PR