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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 addAssets(options.currentPackage, 'web'); | 167 addAssets(options.currentPackage, 'web'); |
168 if (options.transformTests) addAssets(options.currentPackage, 'test'); | 168 if (options.transformTests) addAssets(options.currentPackage, 'test'); |
169 | 169 |
170 barback.updateSources(assets); | 170 barback.updateSources(assets); |
171 } | 171 } |
172 | 172 |
173 /** Attach error listeners on [barback] so we can report errors. */ | 173 /** Attach error listeners on [barback] so we can report errors. */ |
174 void _attachListeners(Barback barback) { | 174 void _attachListeners(Barback barback) { |
175 // Listen for errors and results | 175 // Listen for errors and results |
176 barback.errors.listen((e) { | 176 barback.errors.listen((e) { |
177 var trace = getAttachedStackTrace(e); | 177 var trace = null; |
| 178 if (e is Error) trace = e.stackTrace; |
178 if (trace != null) { | 179 if (trace != null) { |
179 print(Trace.format(trace)); | 180 print(Trace.format(trace)); |
180 } | 181 } |
181 print('error running barback: $e'); | 182 print('error running barback: $e'); |
182 exit(1); | 183 exit(1); |
183 }); | 184 }); |
184 | 185 |
185 barback.results.listen((result) { | 186 barback.results.listen((result) { |
186 if (!result.succeeded) { | 187 if (!result.succeeded) { |
187 print("build failed with errors: ${result.errors}"); | 188 print("build failed with errors: ${result.errors}"); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 Future _copyFile(String inpath, String outpath) { | 304 Future _copyFile(String inpath, String outpath) { |
304 _ensureDir(path.dirname(outpath)); | 305 _ensureDir(path.dirname(outpath)); |
305 return new File(inpath).openRead().pipe(new File(outpath).openWrite()); | 306 return new File(inpath).openRead().pipe(new File(outpath).openWrite()); |
306 } | 307 } |
307 | 308 |
308 /** Write contents of an [asset] into a file at [filepath]. */ | 309 /** Write contents of an [asset] into a file at [filepath]. */ |
309 Future _writeAsset(String filepath, Asset asset) { | 310 Future _writeAsset(String filepath, Asset asset) { |
310 _ensureDir(path.dirname(filepath)); | 311 _ensureDir(path.dirname(filepath)); |
311 return asset.read().pipe(new File(filepath).openWrite()); | 312 return asset.read().pipe(new File(filepath).openWrite()); |
312 } | 313 } |
OLD | NEW |