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

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

Issue 2413823002: Fix file name handling on windows (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 BASE64, JSON, UTF8; 6 import 'dart:convert' show BASE64, JSON, UTF8;
7 import 'dart:io' show File; 7 import 'dart:io' show File;
8 import 'package:analyzer/dart/element/element.dart' show LibraryElement; 8 import 'package:analyzer/dart/element/element.dart' show LibraryElement;
9 import 'package:analyzer/analyzer.dart' 9 import 'package:analyzer/analyzer.dart'
10 show AnalysisError, CompilationUnit, ErrorSeverity; 10 show AnalysisError, CompilationUnit, ErrorSeverity;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 /// summaries before calling this method. 104 /// summaries before calling this method.
105 JSModuleFile compile(BuildUnit unit, CompilerOptions options) { 105 JSModuleFile compile(BuildUnit unit, CompilerOptions options) {
106 var trees = <CompilationUnit>[]; 106 var trees = <CompilationUnit>[];
107 var errors = <AnalysisError>[]; 107 var errors = <AnalysisError>[];
108 108
109 var librariesToCompile = new Queue<LibraryElement>(); 109 var librariesToCompile = new Queue<LibraryElement>();
110 110
111 var compilingSdk = false; 111 var compilingSdk = false;
112 for (var sourcePath in unit.sources) { 112 for (var sourcePath in unit.sources) {
113 var sourceUri = Uri.parse(sourcePath); 113 var sourceUri = Uri.parse(sourcePath);
114 if (sourceUri.scheme == '') { 114 if (sourceUri.scheme == 'dart') {
115 compilingSdk = true;
116 } else if (sourceUri.scheme != 'package') {
115 sourceUri = path.toUri(path.absolute(sourcePath)); 117 sourceUri = path.toUri(path.absolute(sourcePath));
116 } else if (sourceUri.scheme == 'dart') {
117 compilingSdk = true;
118 } 118 }
119 Source source = context.sourceFactory.forUri2(sourceUri); 119 Source source = context.sourceFactory.forUri2(sourceUri);
120 120
121 var fileUsage = 'You need to pass at least one existing .dart file as an' 121 var fileUsage = 'You need to pass at least one existing .dart file as an'
122 ' argument.'; 122 ' argument.';
123 if (source == null) { 123 if (source == null) {
124 throw new UsageException( 124 throw new UsageException(
125 'Could not create a source for "$sourcePath". The file name is in' 125 'Could not create a source for "$sourcePath". The file name is in'
126 ' the wrong format or was not found.', 126 ' the wrong format or was not found.',
127 fileUsage); 127 fileUsage);
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 Map sourceMap, String sourceMapPath, Map<String, String> bazelMappings) { 496 Map sourceMap, String sourceMapPath, Map<String, String> bazelMappings) {
497 var dir = path.dirname(sourceMapPath); 497 var dir = path.dirname(sourceMapPath);
498 var map = new Map.from(sourceMap); 498 var map = new Map.from(sourceMap);
499 var list = new List.from(map['sources']); 499 var list = new List.from(map['sources']);
500 map['sources'] = list; 500 map['sources'] = list;
501 String transformUri(String uri) { 501 String transformUri(String uri) {
502 var match = bazelMappings[path.absolute(uri)]; 502 var match = bazelMappings[path.absolute(uri)];
503 if (match != null) return match; 503 if (match != null) return match;
504 504
505 // Fall back to a relative path. 505 // Fall back to a relative path.
506 return path.toUri(path.relative(path.fromUri(uri), from: dir)).toString(); 506 return path.toUri(path.relative(uri, from: dir)).toString();
507 } 507 }
508 508
509 for (int i = 0; i < list.length; i++) { 509 for (int i = 0; i < list.length; i++) {
510 list[i] = transformUri(list[i]); 510 list[i] = transformUri(list[i]);
511 } 511 }
512 map['file'] = transformUri(map['file']); 512 map['file'] = transformUri(map['file']);
513 return map; 513 return map;
514 } 514 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698