OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 docgen.generator; | 5 library docgen.generator; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:convert'; | 9 import 'dart:convert'; |
10 import 'dart:io'; | 10 import 'dart:io'; |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 /// for static inspection of the source code. | 267 /// for static inspection of the source code. |
268 Future<MirrorSystem> analyzeLibraries(List<Uri> libraries, String | 268 Future<MirrorSystem> analyzeLibraries(List<Uri> libraries, String |
269 libraryRoot, {String packageRoot}) { | 269 libraryRoot, {String packageRoot}) { |
270 SourceFileProvider provider = new CompilerSourceFileProvider(); | 270 SourceFileProvider provider = new CompilerSourceFileProvider(); |
271 api.DiagnosticHandler diagnosticHandler = (new FormattingDiagnosticHandler( | 271 api.DiagnosticHandler diagnosticHandler = (new FormattingDiagnosticHandler( |
272 provider) | 272 provider) |
273 ..showHints = false | 273 ..showHints = false |
274 ..showWarnings = false).diagnosticHandler; | 274 ..showWarnings = false).diagnosticHandler; |
275 Uri libraryUri = new Uri.file(appendSlash(libraryRoot)); | 275 Uri libraryUri = new Uri.file(appendSlash(libraryRoot)); |
276 Uri packageUri = null; | 276 Uri packageUri = null; |
277 if (packageRoot != null) { | 277 if (packageRoot == null) { |
278 packageUri = new Uri.file(appendSlash(packageRoot)); | 278 packageRoot = Platform.packageRoot; |
279 } | 279 } |
| 280 packageUri = new Uri.file(appendSlash(packageRoot)); |
280 return dart2js.analyze(libraries, libraryUri, packageUri, | 281 return dart2js.analyze(libraries, libraryUri, packageUri, |
281 provider.readStringFromUri, diagnosticHandler, ['--preserve-comments', | 282 provider.readStringFromUri, diagnosticHandler, ['--preserve-comments', |
282 '--categories=Client,Server'])..catchError((error) { | 283 '--categories=Client,Server'])..catchError((error) { |
283 logger.severe('Error: Failed to create mirror system. '); | 284 logger.severe('Error: Failed to create mirror system. '); |
284 // TODO(janicejl): Use the stack trace package when bug is resolved. | 285 // TODO(janicejl): Use the stack trace package when bug is resolved. |
285 // Currently, a string is thrown when it fails to create a mirror | 286 // Currently, a string is thrown when it fails to create a mirror |
286 // system, and it is not possible to use the stack trace. BUG(#11622) | 287 // system, and it is not possible to use the stack trace. BUG(#11622) |
287 // To avoid printing the stack trace. | 288 // To avoid printing the stack trace. |
288 exit(1); | 289 exit(1); |
289 }); | 290 }); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 * [Samples](http://www.dartlang.org/samples/) | 478 * [Samples](http://www.dartlang.org/samples/) |
478 * [A Tour of the Dart Libraries](http://www.dartlang.org/docs/dart-up-and-runn
ing/contents/ch03.html) | 479 * [A Tour of the Dart Libraries](http://www.dartlang.org/docs/dart-up-and-runn
ing/contents/ch03.html) |
479 | 480 |
480 This API reference is automatically generated from the source code in the | 481 This API reference is automatically generated from the source code in the |
481 [Dart project](https://code.google.com/p/dart/). | 482 [Dart project](https://code.google.com/p/dart/). |
482 If you'd like to contribute to this documentation, see | 483 If you'd like to contribute to this documentation, see |
483 [Contributing](https://code.google.com/p/dart/wiki/Contributing) | 484 [Contributing](https://code.google.com/p/dart/wiki/Contributing) |
484 and | 485 and |
485 [Writing API Documentation](https://code.google.com/p/dart/wiki/WritingApiDocume
ntation). | 486 [Writing API Documentation](https://code.google.com/p/dart/wiki/WritingApiDocume
ntation). |
486 """; | 487 """; |
OLD | NEW |