-
-
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
[stable] Fix #2973: [Reg] error when depending on a subpackages that is already resolved #2974
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,7 +98,7 @@ version "1.0.0"`, PackageFormat.sdl); | |
assert(dub.project.hasAllDependencies(), "project has missing dependencies"); | ||
assert(dub.project.getDependency("b", true), "Missing 'b' dependency"); | ||
assert(dub.project.getDependency("c", true), "Missing 'c' dependency"); | ||
assert(dub.project.getDependency("c", true), "Missing 'd' dependency"); | ||
assert(dub.project.getDependency("d", true), "Missing 'd' dependency"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just happened to notice this while browsing the tests. |
||
assert(dub.project.getDependency("no", true) is null, "Returned unexpected dependency"); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,20 @@ unittest | |
|
||
assert(!dub.packageManager().getPackage(PackageName("b:b"), Version("1.1.0"))); | ||
} | ||
|
||
// https://github.com/dlang/dub/issues/2973 | ||
unittest | ||
{ | ||
scope dub = new TestDub((scope Filesystem root) { | ||
root.writeFile(TestDub.ProjectPath ~ "dub.json", | ||
`{ "name": "a", "dependencies": { "b:a": "~>1.0" } }`); | ||
root.writeFile(TestDub.ProjectPath ~ "dub.selections.json", | ||
`{ "fileVersion": 1, "versions": { "b": "1.0.0" } }`); | ||
root.writePackageFile("b", "1.0.0", | ||
`{ "name": "b", "version": "1.0.0", "subPackages": [ { "name": "a" } ] }`); | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Btw thx again for the test framework, sooo much better than the old tests... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wish we had a similar filesystem abstract in Phobos to make this kind of unittests the norm. It is so much more expressive. |
||
dub.loadPackage(); | ||
|
||
assert(dub.project.hasAllDependencies(), "project has missing dependencies"); | ||
assert(dub.project.getDependency("b:a", true), "Missing 'b:a' dependency"); | ||
} |
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.
I've totally reworked the fix, tackling the
PackageManager
API instead and resolving the subpackage in the lazy-loadinggetPackage()
case (that was the regression AFAICT), as well as newly inloadSCMPackage()
.With more context now, I see that
resolveSubPackage()
is actually to be avoided, as it results in a full packages scan, killing the lazy-loading advantages. It's still used if thedub.selections.json
contains a path-based selection, so with these current changes, we still get a full scan whenever depending on a subpackage of a path-selected parent package.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.
Right, anything that calls
getPackageIterator
needs to go / be reworked.