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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 _outputDirectory = outputDirectory; | 261 _outputDirectory = outputDirectory; |
262 var dir = new Directory(_outputDirectory); | 262 var dir = new Directory(_outputDirectory); |
263 if (dir.existsSync()) dir.deleteSync(recursive: true); | 263 if (dir.existsSync()) dir.deleteSync(recursive: true); |
264 } | 264 } |
265 | 265 |
266 /// Analyzes set of libraries and provides a mirror system which can be used | 266 /// Analyzes set of libraries and provides a mirror system which can be used |
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; |
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 packageRoot = Platform.packageRoot; | 278 packageRoot = Platform.packageRoot; |
279 } | 279 } |
280 packageUri = new Uri.file(appendSlash(packageRoot)); | 280 packageUri = new Uri.file(appendSlash(packageRoot)); |
281 return dart2js.analyze(libraries, libraryUri, packageUri, | 281 return dart2js.analyze(libraries, libraryUri, packageUri, |
282 provider.readStringFromUri, diagnosticHandler, ['--preserve-comments', | 282 provider.readStringFromUri, diagnosticHandler, ['--preserve-comments', |
283 '--categories=Client,Server'])..catchError((error) { | 283 '--categories=Client,Server'])..catchError((error) { |
284 logger.severe('Error: Failed to create mirror system. '); | 284 logger.severe('Error: Failed to create mirror system. '); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 * [Samples](http://www.dartlang.org/samples/) | 478 * [Samples](http://www.dartlang.org/samples/) |
479 * [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) |
480 | 480 |
481 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 |
482 [Dart project](https://code.google.com/p/dart/). | 482 [Dart project](https://code.google.com/p/dart/). |
483 If you'd like to contribute to this documentation, see | 483 If you'd like to contribute to this documentation, see |
484 [Contributing](https://code.google.com/p/dart/wiki/Contributing) | 484 [Contributing](https://code.google.com/p/dart/wiki/Contributing) |
485 and | 485 and |
486 [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). |
487 """; | 487 """; |
OLD | NEW |