Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Unified Diff: pkg/docgen/lib/src/generator.dart

Issue 1334353002: - Add getters for the current packageRoot or packageMap. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update tests and move to ToT. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {
Lasse Reichstein Nielsen 2015/09/22 09:48:25 I'm not sure what the ".." does here. It's ... sus
- 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);
+ }
Lasse Reichstein Nielsen 2015/09/22 09:48:25 This is slightly different from the original becau
}
/// For this run of docgen, determine the packageRoot value.

Powered by Google App Engine
This is Rietveld 408576698