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

Unified Diff: sdk/lib/_internal/dartdoc/bin/dartdoc.dart

Issue 12448006: Lots of little changes for dartdoc/apidoc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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
« no previous file with comments | « pkg/webdriver/lib/webdriver.dart ('k') | sdk/lib/_internal/dartdoc/lib/dartdoc.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/dartdoc/bin/dartdoc.dart
diff --git a/sdk/lib/_internal/dartdoc/bin/dartdoc.dart b/sdk/lib/_internal/dartdoc/bin/dartdoc.dart
index e55424d831888042d258cda58854464834536682..3c906bfc98d840a58eb3ba701faa1111fb566122 100644
--- a/sdk/lib/_internal/dartdoc/bin/dartdoc.dart
+++ b/sdk/lib/_internal/dartdoc/bin/dartdoc.dart
@@ -16,13 +16,14 @@
*/
library dartdoc;
-import 'dart:io';
import 'dart:async';
+import 'dart:io';
-// TODO(rnystrom): Use "package:" URL (#4968).
import '../lib/dartdoc.dart';
-import '../../../../../pkg/pathos/lib/path.dart' as path;
+
+// TODO(rnystrom): Use "package:" URL (#4968).
import '../../../../../pkg/args/lib/args.dart';
+import '../../../../../pkg/pathos/lib/path.dart' as path;
/**
* Run this from the `lib/_internal/dartdoc` directory.
@@ -224,7 +225,7 @@ main() {
var parts = path.split(dir);
var libDir = parts.lastIndexOf('lib');
if (libDir > 0) {
- pkgPath = new Path(path.join(path.joinAll(parts.take(libDir - 1)),
+ pkgPath = new Path(path.join(path.joinAll(parts.take(libDir)),
'packages'));
}
}
@@ -232,29 +233,27 @@ main() {
cleanOutputDirectory(dartdoc.outputDir);
- print('Analyzing sources');
- Future documented = dartdoc.documentLibraries(entrypoints, libPath, pkgPath);
-
- documented.then((_) {
- Future compiled = compileScript(dartdoc.mode, dartdoc.outputDir, libPath);
- Future filesCopied = copyDirectory(scriptDir.append('../static'),
- dartdoc.outputDir);
-
- Future.wait([compiled, filesCopied]).then((_) {
- dartdoc.cleanup();
- if (dartdoc.totalLibraries + dartdoc.totalTypes +
- dartdoc.totalMembers == 0) {
- print('Nothing was documented!');
+ // Start the analysis and documentation.
+ dartdoc.documentLibraries(entrypoints, libPath, pkgPath)
+ .then((_) {
+ print('Copying static files...');
+ Future.wait([
+ // Prepare the dart2js script code and copy static resources.
+ // TODO(amouravski): move compileScript out and pre-generate the client
+ // scripts. This takes a long time and the js hardly ever changes.
+ compileScript(dartdoc.mode, dartdoc.outputDir, libPath),
+ copyDirectory(scriptDir.append('../static'), dartdoc.outputDir)
+ ]);
+ })
+ .then((_) {
+ print(dartdoc.status);
+ if (dartdoc.totals == 0) {
exit(1);
- } else {
- print('Documented ${dartdoc.totalLibraries} libraries, '
- '${dartdoc.totalTypes} types, and ${dartdoc.totalMembers} '
- 'members.');
}
- });
- }, onError: (AsyncError asyncError) {
- print('Generation failed: ${asyncError.error}');
- dartdoc.cleanup();
- exit(1);
- });
+ })
+ .catchError((e) {
+ print('Error: generation failed: ${e.error}');
+ exit(1);
+ })
+ .whenComplete(() => dartdoc.cleanup());
}
« no previous file with comments | « pkg/webdriver/lib/webdriver.dart ('k') | sdk/lib/_internal/dartdoc/lib/dartdoc.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698