Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: pkg/dev_compiler/lib/src/compiler/compiler.dart

Issue 2836483002: Snapshot DDC trained on itself (Closed)
Patch Set: Test/fix for windows Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:collection' show HashSet, Queue; 5 import 'dart:collection' show HashSet, Queue;
6 import 'dart:convert' show JSON; 6 import 'dart:convert' show JSON;
7 import 'dart:io' show File; 7 import 'dart:io' show File;
8 8
9 import 'package:analyzer/analyzer.dart' 9 import 'package:analyzer/analyzer.dart'
10 show AnalysisError, CompilationUnit, ErrorSeverity; 10 show AnalysisError, CompilationUnit, ErrorSeverity;
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 hide: hide) 390 hide: hide)
391 ..addOption('summary-out', 391 ..addOption('summary-out',
392 help: 'location to write the summary file', hide: hide); 392 help: 'location to write the summary file', hide: hide);
393 } 393 }
394 394
395 static Map<String, String> _parseBazelMappings(Iterable argument) { 395 static Map<String, String> _parseBazelMappings(Iterable argument) {
396 var mappings = <String, String>{}; 396 var mappings = <String, String>{};
397 for (var mapping in argument) { 397 for (var mapping in argument) {
398 var splitMapping = mapping.split(','); 398 var splitMapping = mapping.split(',');
399 if (splitMapping.length >= 2) { 399 if (splitMapping.length >= 2) {
400 mappings[path.absolute(splitMapping[0])] = splitMapping[1]; 400 mappings[path.canonicalize(splitMapping[0])] = splitMapping[1];
401 } 401 }
402 } 402 }
403 return mappings; 403 return mappings;
404 } 404 }
405 } 405 }
406 406
407 /// A unit of Dart code that can be built into a single JavaScript module. 407 /// A unit of Dart code that can be built into a single JavaScript module.
408 class BuildUnit { 408 class BuildUnit {
409 /// The name of this module. 409 /// The name of this module.
410 final String name; 410 final String name;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 579
580 /// Adjusts the source paths in [sourceMap] to be relative to [sourceMapPath], 580 /// Adjusts the source paths in [sourceMap] to be relative to [sourceMapPath],
581 /// and returns the new map. Relative paths are in terms of URIs ('/'), not 581 /// and returns the new map. Relative paths are in terms of URIs ('/'), not
582 /// local OS paths (e.g., windows '\'). 582 /// local OS paths (e.g., windows '\').
583 // TODO(jmesserly): find a new home for this. 583 // TODO(jmesserly): find a new home for this.
584 Map placeSourceMap( 584 Map placeSourceMap(
585 Map sourceMap, String sourceMapPath, Map<String, String> bazelMappings) { 585 Map sourceMap, String sourceMapPath, Map<String, String> bazelMappings) {
586 var map = new Map.from(sourceMap); 586 var map = new Map.from(sourceMap);
587 // Convert to a local file path if it's not. 587 // Convert to a local file path if it's not.
588 sourceMapPath = path.fromUri(_sourceToUri(sourceMapPath)); 588 sourceMapPath = path.fromUri(_sourceToUri(sourceMapPath));
589 var sourceMapDir = path.dirname(path.absolute(sourceMapPath)); 589 var sourceMapDir = path.dirname(path.canonicalize(sourceMapPath));
590 var list = new List.from(map['sources']); 590 var list = new List.from(map['sources']);
591 map['sources'] = list; 591 map['sources'] = list;
592 592
593 String makeRelative(String sourcePath) { 593 String makeRelative(String sourcePath) {
594 var uri = _sourceToUri(sourcePath); 594 var uri = _sourceToUri(sourcePath);
595 if (uri.scheme == 'dart' || uri.scheme == 'package') return sourcePath; 595 if (uri.scheme == 'dart' || uri.scheme == 'package') return sourcePath;
596 596
597 // Convert to a local file path if it's not. 597 // Convert to a local file path if it's not.
598 sourcePath = path.absolute(path.fromUri(uri)); 598 sourcePath = path.canonicalize(path.fromUri(uri));
599 599
600 // Allow bazel mappings to override. 600 // Allow bazel mappings to override.
601 var match = bazelMappings[sourcePath]; 601 var match = bazelMappings[sourcePath];
602 if (match != null) return match; 602 if (match != null) return match;
603 603
604 // Fall back to a relative path against the source map itself. 604 // Fall back to a relative path against the source map itself.
605 sourcePath = path.relative(sourcePath, from: sourceMapDir); 605 sourcePath = path.relative(sourcePath, from: sourceMapDir);
606 606
607 // Convert from relative local path to relative URI. 607 // Convert from relative local path to relative URI.
608 return path.toUri(sourcePath).path; 608 return path.toUri(sourcePath).path;
(...skipping 12 matching lines...) Expand all
621 var uri = Uri.parse(source); 621 var uri = Uri.parse(source);
622 var scheme = uri.scheme; 622 var scheme = uri.scheme;
623 switch (scheme) { 623 switch (scheme) {
624 case "dart": 624 case "dart":
625 case "package": 625 case "package":
626 case "file": 626 case "file":
627 // A valid URI. 627 // A valid URI.
628 return uri; 628 return uri;
629 default: 629 default:
630 // Assume a file path. 630 // Assume a file path.
631 return new Uri.file(path.absolute(source)); 631 return new Uri.file(path.canonicalize(source));
632 } 632 }
633 } 633 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698