-
-
Notifications
You must be signed in to change notification settings - Fork 228
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 #2974
base: stable
Are you sure you want to change the base?
[stable] Fix #2973 #2974
Changes from 3 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.
This fixes the testcase in #2973. Not sure if this is the right fix though;
PackageManager.getPackage()
returning the parent package when given a subpackage name doesn't make a lot of sense IMO.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.
Yeah it doesn't make a lot of sense but it's always been this way. It was one of the things I wanted to fix when I introduced
PackageName
but never got around to it.For dependency resolution we always store references to parent package, not subpackage, because all subpackages should resolve to the same parent. I would need to inspect the code to see if that is really the right fix.
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.
Okay fine if it's always been like that.