OLD | NEW |
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 /** | 5 /** |
6 * Definitions used to run the polymer linter and deploy tools without using | 6 * Definitions used to run the polymer linter and deploy tools without using |
7 * pub serve or pub deploy. | 7 * pub serve or pub deploy. |
8 */ | 8 */ |
9 library polymer.src.build.runner; | 9 library polymer.src.build.runner; |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 'your package root directory.'); | 79 'your package root directory.'); |
80 return null; | 80 return null; |
81 } | 81 } |
82 return loadYaml(pubspec.readAsStringSync())['name']; | 82 return loadYaml(pubspec.readAsStringSync())['name']; |
83 } | 83 } |
84 | 84 |
85 /** | 85 /** |
86 * Extract a mapping between package names and the path in the file system where | 86 * Extract a mapping between package names and the path in the file system where |
87 * to find the sources of such package. This map will contain an entry for the | 87 * to find the sources of such package. This map will contain an entry for the |
88 * current package and everything it depends on (extracted via `pub | 88 * current package and everything it depends on (extracted via `pub |
89 * list-pacakge-dirs`). | 89 * list-package-dirs`). |
90 */ | 90 */ |
91 Map<String, String> _readPackageDirsFromPub(String currentPackage) { | 91 Map<String, String> _readPackageDirsFromPub(String currentPackage) { |
92 var dartExec = Platform.executable; | 92 var dartExec = Platform.executable; |
93 // If dartExec == dart, then dart and pub are in standard PATH. | 93 // If dartExec == dart, then dart and pub are in standard PATH. |
94 var sdkDir = dartExec == 'dart' ? '' : path.dirname(dartExec); | 94 var sdkDir = dartExec == 'dart' ? '' : path.dirname(dartExec); |
95 var pub = path.join(sdkDir, Platform.isWindows ? 'pub.bat' : 'pub'); | 95 var pub = path.join(sdkDir, Platform.isWindows ? 'pub.bat' : 'pub'); |
96 var result = Process.runSync(pub, ['list-package-dirs']); | 96 var result = Process.runSync(pub, ['list-package-dirs']); |
97 if (result.exitCode != 0) { | 97 if (result.exitCode != 0) { |
98 print("unexpected error invoking 'pub':"); | 98 print("unexpected error invoking 'pub':"); |
99 print(result.stdout); | 99 print(result.stdout); |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 output.write(entry.span.getLocationMessage(entry.message, | 369 output.write(entry.span.getLocationMessage(entry.message, |
370 useColors: useColors, | 370 useColors: useColors, |
371 color: levelColor)); | 371 color: levelColor)); |
372 } | 372 } |
373 return output.toString(); | 373 return output.toString(); |
374 } | 374 } |
375 | 375 |
376 const String _RED_COLOR = '\u001b[31m'; | 376 const String _RED_COLOR = '\u001b[31m'; |
377 const String _MAGENTA_COLOR = '\u001b[35m'; | 377 const String _MAGENTA_COLOR = '\u001b[35m'; |
378 const String _NO_COLOR = '\u001b[0m'; | 378 const String _NO_COLOR = '\u001b[0m'; |
OLD | NEW |