[dartdevc] Properly encode Windows-style paths and paths with spaces for source maps

Change-Id: I32a28d7327a35c245a67343c91fdc74d6026d810
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108503
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
This commit is contained in:
Mark Zhou 2019-07-10 16:49:22 +00:00 committed by commit-bot@chromium.org
parent 7820e807a6
commit 9a07c4a817
4 changed files with 6 additions and 4 deletions

View file

@ -56,7 +56,7 @@ class _CompilerWorker extends AsyncWorkerLoop {
/// Build a map of uris to digests.
final inputDigests = <Uri, List<int>>{};
for (var input in request.inputs) {
inputDigests[Uri.base.resolve(input.path)] = input.digest;
inputDigests[sourcePathToUri(input.path)] = input.digest;
}
lastResult = await runZoned(

View file

@ -369,7 +369,7 @@ Map placeSourceMap(Map sourceMap, String sourceMapPath,
}
// Convert to a local file path if it's not.
sourcePath = path.absolute(path.fromUri(uri));
sourcePath = sourcePathToUri(path.absolute(path.fromUri(uri))).path;
// Allow bazel mappings to override.
var match = bazelMappings[sourcePath];

View file

@ -150,7 +150,7 @@ Future<InitializedCompilerState> initializeIncrementalCompiler(
oldState?.workerInputCache ?? new Map<Uri, WorkerInputComponent>();
var sdkDigest = workerInputDigests[sdkSummary];
if (sdkDigest == null) {
throw new StateError("Expected to get sdk digest at $cachedSdkInput");
throw new StateError("Expected to get sdk digest at $sdkSummary");
}
cachedSdkInput = workerInputCache[sdkSummary];

View file

@ -372,5 +372,7 @@ class DevCompilerSummaryTarget extends DevCompilerTarget {
Uri _toUri(String uriString) {
if (uriString == null) return null;
return Uri.base.resolve(uriString);
// Windows-style paths use '\', so convert them to '/' in case they've been
// concatenated with Unix-style paths.
return Uri.base.resolve(uriString.replaceAll("\\", "/"));
}