-
Notifications
You must be signed in to change notification settings - Fork 214
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
Handle absolute paths on Windows #1923
Conversation
There are some bot failures because we now print paths using backslashes on Windows:
I can change this, although I'm not certain that it isn't a good change. I suspect it was using forward slashes before because on Windows the file path was being read from @jakemac53 I might not be around too much after this evening before Monday so feel free to make changes to this PR (or fix in another) if that's preferable (there are some bot failures in the SDK because of this but I don't think what they're doing is unreasonable so think we should leave them as-is). |
As a part of my recent change I updated these tests to always expect forward slashes, so we could just change the tests back again, but I don't think that is the ideal fix? It looks to me like the specific issue here is that URIs are being passed with a drive letter but no file: scheme. In that case, we end up with a scheme of I will look at trying some other fixes here. |
I updated this to check if it looks like we are getting a path that starts with drive letter, and in that case prepend it with |
cc @devoncarew I can't figure out from the logs why the publish bot is failing, is it because of the warnings about the tight constraints? |
// into a file scheme URI. We can't parse using `Uri.file` because we do | ||
// support query parameters which aren't valid file uris. | ||
if (option.indexOf(':') == 1) { | ||
option = 'file:///$option'; |
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.
Should the slashes be swapped too? This could result in file:///D:\foo\bar.dart
which seems a little odd (even if it works).
(Edit: That might also remove the need for decodeComponent
?)
Probably should only do this on Windows too, since I think colons may be valid on other platforms in filenames? (I can touch a:b.dart
on mac Mac and it creates that file fine 😄)
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.
Should the slashes be swapped too? This could result in file:///D:\foo\bar.dart which seems a little odd (even if it works).
It works just fine (it is a bit weird, but it works, I am trying to avoid as much manual munging of things as possible here, and just leave it up to the core libs).
Probably should only do this on Windows too, since I think colons may be valid on other platforms in filenames? (I can touch a:b.dart on mac Mac and it creates that file fine 😄)
Wow, lol. I guess so.
It looks like it's failing while doing a I imagine these warnings are known to you (intentional for this package) and wouldn't block a publish. I'm not sure if we should make a publish dry-run not fail a build? Have it so that you can configure to allow failures per-package? Or if |
Right, this is intentional (although a bit weird, for sure).
These are just warnings - not errors. I don't know how easily you can distinguish from the tool. I do think some packages would want to fail on warnings, so I suppose it would need to be configurable? Or we could over engineer the issue a bit and add support for some sort of ignore syntax to pub so that the warnings didn't show up at all. |
FWIW we should be getting rid of that dependency whenever we can find the time to work out the breaking change in |
@jakemac53 is it reasonable for me to roll the latest revision into the SDK to fix dart-lang/sdk#51348 or do you want it aligned with a release of the package or to include any other changes? |
This should be published, feel free to roll it into the SDK |
FWIW we don't generally have any restriction that SDK rolls for this package are aligned with a published version. We often (and prefer to) roll into the SDK before publish. For the most part you should fee free to roll (or ask us to roll) the test repo in to the SDK any time. |
Cool, thanks for the info! I've opened https://dart-review.googlesource.com/c/sdk/+/282840 - although I don't have permission to run bots or land, so if it's good someone will need to do that for me. Thanks! |
Since the latest
package:test
rolled into the SDK, some DAP tests started failing to run tests withdart test
. They use absolute paths on Windows: dart-lang/sdk#51348This seems to fix the issue for me - it avoids using the URI to compute the file path if it's not a
file://
URI and instead uses the raw input (but chops it at the?
to handle query params on non-URI paths).@jakemac53