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

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

Issue 108473004: Adds a --include-dependent-packages option to docgen (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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/docgen/bin/docgen.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/docgen/lib/docgen.dart
diff --git a/pkg/docgen/lib/docgen.dart b/pkg/docgen/lib/docgen.dart
index fb0094f23db6e06fc2749700f04990040070301d..9bc6e1002fd417b1abbe81b47d847636db351148 100644
--- a/pkg/docgen/lib/docgen.dart
+++ b/pkg/docgen/lib/docgen.dart
@@ -66,6 +66,9 @@ Map<String, Indexable> entityMap = new Map<String, Indexable>();
/// This is set from the command line arguments flag --include-private
bool _includePrivate = false;
+/// This is set from the command line flag --include-dependent-packages
+bool _includeDependentPackages = false;
+
/// Library names to explicitly exclude.
///
/// Set from the command line option
@@ -90,10 +93,12 @@ Map _mdn;
Future<bool> docgen(List<String> files, {String packageRoot,
bool outputToYaml: true, bool includePrivate: false, bool includeSdk: false,
bool parseSdk: false, bool append: false, String introduction: '',
- out: DEFAULT_OUTPUT_DIRECTORY, List<String> excludeLibraries}) {
+ out: DEFAULT_OUTPUT_DIRECTORY, List<String> excludeLibraries,
+ bool includeDependentPackages}) {
_excluded = excludeLibraries;
_includePrivate = includePrivate;
_outputDirectory = out;
+ _includeDependentPackages = includeDependentPackages;
if (!append) {
var dir = new Directory(_outputDirectory);
if (dir.existsSync()) dir.deleteSync(recursive: true);
@@ -109,6 +114,9 @@ Future<bool> docgen(List<String> files, {String packageRoot,
}
}
logger.info('Package Root: ${packageRoot}');
+ if (_includeDependentPackages) {
+ files.addAll(allDependentPackageDirs(files.first));
+ }
var requestedLibraries = _listLibraries(files);
var allLibraries = []..addAll(requestedLibraries);
if (includeSdk) {
@@ -142,6 +150,17 @@ Future<bool> docgen(List<String> files, {String packageRoot,
});
}
+/// All of the directories for our dependent packages
+List<String> allDependentPackageDirs(String packageDirectory) {
+ var dependentsJson = Process.runSync('pub', ['list-package-dirs'],
+ workingDirectory: packageDirectory, runInShell: true);
+ if (dependentsJson.exitCode != 0) {
+ print(dependentsJson.stderr);
+ }
+ var dependents = JSON.decode(dependentsJson.stdout)['packages'];
+ return dependents.values.toList();
+}
+
/// For a library's [mirror], determine the name of the package (if any) we
/// believe it came from (because of its file URI).
///
« no previous file with comments | « pkg/docgen/bin/docgen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698