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

Unified Diff: utils/apidoc/apidoc.dart

Issue 14736010: Add a new --extra-lib option to apidoc that allows us to specify an explicit .dart file that should… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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/unittest/lib/unittest.dart ('k') | utils/apidoc/apidoc.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/apidoc/apidoc.dart
===================================================================
--- utils/apidoc/apidoc.dart (revision 22522)
+++ utils/apidoc/apidoc.dart (working copy)
@@ -39,7 +39,21 @@
bool generateAppCache = false;
List<String> excludedLibraries = <String>[];
+
+ // For libraries that have names matching the package name,
+ // such as library unittest in package unittest, we just give
+ // the package name with a --include-lib argument, such as:
+ // --include-lib=unittest. These arguments are collected in
+ // includedLibraries.
List<String> includedLibraries = <String>[];
+
+ // For libraries that lie within packages but have a different name,
+ // such as the matcher library in package unittest, we can use
+ // --extra-lib with a full relative path under pkg, such as
+ // --extra-lib=unittest/lib/matcher.dart. These arguments are
+ // collected in extraLibraries.
+ List<String> extraLibraries = <String>[];
+
String packageRoot;
String version;
@@ -65,6 +79,8 @@
excludedLibraries.add(arg.substring('--exclude-lib='.length));
} else if (arg.startsWith('--include-lib=')) {
includedLibraries.add(arg.substring('--include-lib='.length));
+ } else if (arg.startsWith('--extra-lib=')) {
+ extraLibraries.add(arg.substring('--extra-lib='.length));
} else if (arg.startsWith('--out=')) {
outputDir = new Path(arg.substring('--out='.length));
} else if (arg.startsWith('--package-root=')) {
@@ -140,6 +156,19 @@
}
}
}, onDone: () {
+ // Add any --extra libraries that had full pkg paths.
+ // TODO(gram): if the handling of --include-lib libraries in the
+ // listen() block above is cleaned up, then this will need to be
+ // too, as it is a special case of the above.
+ for (var lib in extraLibraries) {
+ var libPath = new Path('../../$lib');
+ if (new File.fromPath(libPath).existsSync()) {
+ apidocLibraries.add(_pathToFileUri(libPath.toNativePath()));
+ var libName = libPath.filename.replaceAll('.dart', '');
+ includedLibraries.add(libName);
+ }
+ }
+
final apidoc = new Apidoc(mdn, outputDir, mode, generateAppCache,
excludedLibraries, version);
apidoc.dartdocPath =
« no previous file with comments | « pkg/unittest/lib/unittest.dart ('k') | utils/apidoc/apidoc.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698