-
Notifications
You must be signed in to change notification settings - Fork 54
correctly parse package_config files on windows with relative root URI #371
correctly parse package_config files on windows with relative root URI #371
Conversation
@@ -23,7 +30,12 @@ foo:file:///${d.sandbox}/foo/lib | |||
"packages": [ | |||
{ | |||
"name": "foo", | |||
"rootUri": "file:///${d.sandbox}/foo", | |||
"rootUri": "../", |
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 style of URI is used for the package itself and is what coverage was having problems resolving. Since the packagesPath would resolve to an incorrect directory, this would resolve to something like C:/lib
which doesn't exist or isn't valid
cc @liamappelbe - based on this it looks like we already support I suppose we could consider updating the option description from "package spec" to "package config"... |
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 LGTM but it would be good for @liamappelbe to double check
LGTM
It's true that no major changes are needed for the .packages breaking change. We're already migrated in fact. I really just wanted to add a --package flag so the users can omit the |
When running
flutter test --coverage
on windows, we noticed that forcing package:coverage to use the package_config.json file would lead to errors like:It turns out that if the root URI in a package config file was relative, it was not parsed correctly since resolving the provided packagesPath was not working correctly on windows (resolving to wrong dir).
To fix this, we first convert the provided packages path to a URI and then resolve that. Tests are updated to all pass on windows as well.
Unblocks flutter/flutter#99677 / https://dart-review.googlesource.com/c/sdk/+/231101