| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 return loadYaml(pubspec.readAsStringSync())['name']; | 76 return loadYaml(pubspec.readAsStringSync())['name']; |
| 77 } | 77 } |
| 78 | 78 |
| 79 /** | 79 /** |
| 80 * Extract a mapping between package names and the path in the file system where | 80 * Extract a mapping between package names and the path in the file system where |
| 81 * to find the sources of such package. This map will contain an entry for the | 81 * to find the sources of such package. This map will contain an entry for the |
| 82 * current package and everything it depends on (extracted via `pub | 82 * current package and everything it depends on (extracted via `pub |
| 83 * list-pacakge-dirs`). | 83 * list-pacakge-dirs`). |
| 84 */ | 84 */ |
| 85 Map<String, String> _readPackageDirsFromPub(String currentPackage) { | 85 Map<String, String> _readPackageDirsFromPub(String currentPackage) { |
| 86 var dartExec = new Options().executable; | 86 var dartExec = Platform.executable; |
| 87 // If dartExec == dart, then dart and pub are in standard PATH. | 87 // If dartExec == dart, then dart and pub are in standard PATH. |
| 88 var sdkDir = dartExec == 'dart' ? '' : path.dirname(dartExec); | 88 var sdkDir = dartExec == 'dart' ? '' : path.dirname(dartExec); |
| 89 var pub = path.join(sdkDir, Platform.isWindows ? 'pub.bat' : 'pub'); | 89 var pub = path.join(sdkDir, Platform.isWindows ? 'pub.bat' : 'pub'); |
| 90 var result = Process.runSync(pub, ['list-package-dirs']); | 90 var result = Process.runSync(pub, ['list-package-dirs']); |
| 91 if (result.exitCode != 0) { | 91 if (result.exitCode != 0) { |
| 92 print("unexpected error invoking 'pub':"); | 92 print("unexpected error invoking 'pub':"); |
| 93 print(result.stdout); | 93 print(result.stdout); |
| 94 print(result.stderr); | 94 print(result.stderr); |
| 95 exit(result.exitCode); | 95 exit(result.exitCode); |
| 96 } | 96 } |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 Future _copyFile(String inpath, String outpath) { | 303 Future _copyFile(String inpath, String outpath) { |
| 304 _ensureDir(path.dirname(outpath)); | 304 _ensureDir(path.dirname(outpath)); |
| 305 return new File(inpath).openRead().pipe(new File(outpath).openWrite()); | 305 return new File(inpath).openRead().pipe(new File(outpath).openWrite()); |
| 306 } | 306 } |
| 307 | 307 |
| 308 /** Write contents of an [asset] into a file at [filepath]. */ | 308 /** Write contents of an [asset] into a file at [filepath]. */ |
| 309 Future _writeAsset(String filepath, Asset asset) { | 309 Future _writeAsset(String filepath, Asset asset) { |
| 310 _ensureDir(path.dirname(filepath)); | 310 _ensureDir(path.dirname(filepath)); |
| 311 return asset.read().pipe(new File(filepath).openWrite()); | 311 return asset.read().pipe(new File(filepath).openWrite()); |
| 312 } | 312 } |
| OLD | NEW |