| Index: pkg/docgen/lib/src/generator.dart
|
| diff --git a/pkg/docgen/lib/src/generator.dart b/pkg/docgen/lib/src/generator.dart
|
| index 18ed895ec673f1276e862ca580e03f3dffb59538..2d5c6e1529c3fd025db49a929f9b5419d54f9faf 100644
|
| --- a/pkg/docgen/lib/src/generator.dart
|
| +++ b/pkg/docgen/lib/src/generator.dart
|
| @@ -266,7 +266,7 @@ void _ensureOutputDirectory(String outputDirectory) {
|
| /// Analyzes set of libraries and provides a mirror system which can be used
|
| /// for static inspection of the source code.
|
| Future<MirrorSystem> analyzeLibraries(List<Uri> libraries, String
|
| - libraryRoot, {String packageRoot}) {
|
| + libraryRoot, {String packageRoot}) async {
|
| SourceFileProvider provider = new CompilerSourceFileProvider();
|
| api.DiagnosticHandler diagnosticHandler = new FormattingDiagnosticHandler(
|
| provider)
|
| @@ -274,20 +274,23 @@ Future<MirrorSystem> analyzeLibraries(List<Uri> libraries, String
|
| ..showWarnings = false;
|
| Uri libraryUri = new Uri.file(appendSlash(libraryRoot));
|
| Uri packageUri = null;
|
| - if (packageRoot == null) {
|
| - packageRoot = Platform.packageRoot;
|
| + if (packageRoot != null) {
|
| + packageUri = new Uri.file(appendSlash(packageRoot));
|
| + } else {
|
| + packageUri = await Platform.packageRoot;
|
| }
|
| - packageUri = new Uri.file(appendSlash(packageRoot));
|
| - return dart2js.analyze(libraries, libraryUri, packageUri,
|
| + try {
|
| + return await dart2js.analyze(libraries, libraryUri, packageUri,
|
| provider.readStringFromUri, diagnosticHandler, ['--preserve-comments',
|
| - '--categories=Client,Server'])..catchError((error) {
|
| - logger.severe('Error: Failed to create mirror system. ');
|
| - // TODO(janicejl): Use the stack trace package when bug is resolved.
|
| - // Currently, a string is thrown when it fails to create a mirror
|
| - // system, and it is not possible to use the stack trace. BUG(#11622)
|
| - // To avoid printing the stack trace.
|
| - exit(1);
|
| - });
|
| + '--categories=Client,Server']);
|
| + } catch (error) {
|
| + logger.severe('Error: Failed to create mirror system. ');
|
| + // TODO(janicejl): Use the stack trace package when bug is resolved.
|
| + // Currently, a string is thrown when it fails to create a mirror
|
| + // system, and it is not possible to use the stack trace. BUG(#11622)
|
| + // To avoid printing the stack trace.
|
| + exit(1);
|
| + }
|
| }
|
|
|
| /// For this run of docgen, determine the packageRoot value.
|
|
|