-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
PackageManager.getBestPackage: Introduce Version[Range] overloads #2375
Conversation
source/dub/packagemanager.d
Outdated
@@ -224,6 +224,7 @@ class PackageManager { | |||
|
|||
/** Looks up the first package matching the given name. | |||
*/ | |||
deprecated("The semantic of this function are unhelpful, prefer `getBestPackage` with `name, Dependency.any` instead") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deprecated("The semantic of this function are unhelpful, prefer `getBestPackage` with `name, Dependency.any` instead") | |
deprecated("The semantic of this function are unhelpful, prefer `getBestPackage` with `name, VersionRange.any` instead") |
source/dub/dub.d
Outdated
logDiagnostic("External sub package %s %s not found.", name, dep.version_); | ||
auto ret = dep.visit!( | ||
(VersionRange rng) => m_dub.m_packageManager.getBestPackage(name, rng), | ||
(any) => assert(0, "Cannot call getPackageRaw with a non-version dependency on subpackages"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like it'd be possible that this assert(false)
branch is called from
getSpecificConfigs -> getPackage -> getPackageRaw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be, because otherwise the assert(0)
in Dependency.version_
would get triggered.
But I'll look at the CI failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the dependency resolution logic is tricky to understand, so I don't really know where to start searching for such a case, but in general these non-version cases are not that well tested, so an edge case is unlikely to trigger in CI here
d679b1e
to
4888a1e
Compare
76be451
to
2071c5b
Compare
2071c5b
to
346a2d3
Compare
getBestPackage
and deprecate getFirstPackage
@WebFreak001 : Removed deprecation, this should be a no-brainer now (and fix the "TODO"). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
want to deprecate the Dependency
overload or do you see any value in keeping it?
I plan to deprecate it, but the previous iteration didn't pass the CI for unknown reason, so I'll do the deprecation later (it was a side product, not the main target, of the refactoring). |
Continuing on my crusade to have correctly-typed interfaces when it comes to dependencies.