Open Mai-Lapyst opened 1 year ago
Okay taking a look at how this logic work:
getSubPackage is the one erroring: https://github.com/dlang/dub/blob/6080cc5497de5871c6081ab45e66f578e8e3fc74/source/dub/packagemanager.d#L485
It ends up calling: https://github.com/dlang/dub/blob/6080cc5497de5871c6081ab45e66f578e8e3fc74/source/dub/packagemanager.d#L524
What I think is happening is it's trying to do a complete lookup without fully initiating the appropriate package state. Hence this ticket.
The AA behavior is a scapegoat that makes this work accidentally and can be ignored as an unrelated detail to the underlying problem.
System information
Bug Description
Dub relies internaly onto associative arrays to save dependencies; when now you use some special dependencies, the order in which they are declared in the
dub.json
file will change in the internal representation, which can lead to errors of subpackages not being resolved correctly:Example:
Assoc-arrays test-code
```d void main() { int[string] data_1; data_1["minorm"] = 42; data_1["minorm:backend_libmariadb"] = 12; foreach (k,v; data_1) { writeln(k, "=>", v); } writeln("-----------------------"); int[string] data_2; data_2["micro_orm"] = 42; data_2["micro_orm:backend_libmariadb"] = 12; foreach (k,v; data_2) { writeln(k, "=>", v); } } ``` Will print: ``` minorm=>42 minorm:backend_libmariadb=>12 ----------------------- micro_orm:backend_libmariadb=>12 micro_orm=>42 ```This in turn can lead to VERY misleading errors down the line such as this:
How to reproduce?
dub build -f
inside thetest
subfolderdub.json
files from containingmicro_orm
tominorm
dub build -f
inside thetest
subfolder againExpected Behavior
That either dependency order dosnt change or isn't relevant to correctly getting sub-packages.
Logs