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

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

Issue 1290903002: dart2js: don't add a trailing slash when reading --packages (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library dart2js.cmdline; 5 library dart2js.cmdline;
6 6
7 import 'dart:async' 7 import 'dart:async'
8 show Future, EventSink; 8 show Future, EventSink;
9 import 'dart:convert' show UTF8, LineSplitter; 9 import 'dart:convert' show UTF8, LineSplitter;
10 import 'dart:io' 10 import 'dart:io'
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // m[0] is the entire match (which will be equal to argument). m[1] 59 // m[0] is the entire match (which will be equal to argument). m[1]
60 // is something like "-o" or "--out=", and m[2] is the parameter. 60 // is something like "-o" or "--out=", and m[2] is the parameter.
61 Match m = new RegExp('^(-[a-z]|--.+=)(.*)').firstMatch(argument); 61 Match m = new RegExp('^(-[a-z]|--.+=)(.*)').firstMatch(argument);
62 if (m == null) { 62 if (m == null) {
63 if (isOptionalArgument) return null; 63 if (isOptionalArgument) return null;
64 helpAndFail('Unknown option "$argument".'); 64 helpAndFail('Unknown option "$argument".');
65 } 65 }
66 return m[2]; 66 return m[2];
67 } 67 }
68 68
69 String extractPath(String argument) { 69 String extractPath(String argument, {bool isDirectory: true}) {
70 String path = nativeToUriPath(extractParameter(argument)); 70 String path = nativeToUriPath(extractParameter(argument));
71 return path.endsWith("/") ? path : "$path/"; 71 return !path.endsWith("/") && isDirectory ? "$path/" : path;
72 } 72 }
73 73
74 void parseCommandLine(List<OptionHandler> handlers, List<String> argv) { 74 void parseCommandLine(List<OptionHandler> handlers, List<String> argv) {
75 // TODO(ahe): Use ../../args/args.dart for parsing options instead. 75 // TODO(ahe): Use ../../args/args.dart for parsing options instead.
76 var patterns = <String>[]; 76 var patterns = <String>[];
77 for (OptionHandler handler in handlers) { 77 for (OptionHandler handler in handlers) {
78 patterns.add(handler.pattern); 78 patterns.add(handler.pattern);
79 } 79 }
80 var pattern = new RegExp('^(${patterns.join(")\$|^(")})\$'); 80 var pattern = new RegExp('^(${patterns.join(")\$|^(")})\$');
81 81
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 setLibraryRoot(String argument) { 137 setLibraryRoot(String argument) {
138 libraryRoot = currentDirectory.resolve(extractPath(argument)); 138 libraryRoot = currentDirectory.resolve(extractPath(argument));
139 } 139 }
140 140
141 setPackageRoot(String argument) { 141 setPackageRoot(String argument) {
142 packageRoot = currentDirectory.resolve(extractPath(argument)); 142 packageRoot = currentDirectory.resolve(extractPath(argument));
143 } 143 }
144 144
145 setPackageConfig(String argument) { 145 setPackageConfig(String argument) {
146 packageConfig = currentDirectory.resolve(extractPath(argument)); 146 packageConfig =
147 currentDirectory.resolve(extractPath(argument, isDirectory: false));
147 } 148 }
148 149
149 setOutput(Iterator<String> arguments) { 150 setOutput(Iterator<String> arguments) {
150 optionsImplyCompilation.add(arguments.current); 151 optionsImplyCompilation.add(arguments.current);
151 String path; 152 String path;
152 if (arguments.current == '-o') { 153 if (arguments.current == '-o') {
153 if (!arguments.moveNext()) { 154 if (!arguments.moveNext()) {
154 helpAndFail('Error: Missing file after -o option.'); 155 helpAndFail('Error: Missing file after -o option.');
155 } 156 }
156 path = arguments.current; 157 path = arguments.current;
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 } else if (exitCode == 253) { 767 } else if (exitCode == 253) {
767 print(">>> TEST CRASH"); 768 print(">>> TEST CRASH");
768 } else { 769 } else {
769 print(">>> TEST FAIL"); 770 print(">>> TEST FAIL");
770 } 771 }
771 stderr.writeln(">>> EOF STDERR"); 772 stderr.writeln(">>> EOF STDERR");
772 subscription.resume(); 773 subscription.resume();
773 }); 774 });
774 }); 775 });
775 } 776 }
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