From a1812e2d76289ad52d64d69984b4cac77a97df75 Mon Sep 17 00:00:00 2001 From: keertip Date: Wed, 14 Dec 2016 08:44:17 -0800 Subject: [PATCH] Change the --include-external flag to be more selective --- CHANGELOG.md | 4 ++++ bin/dartdoc.dart | 4 +++- lib/dartdoc.dart | 5 +++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25f2e1c090..ee7fdadb5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## unreleased +* change the `--include-external` flag to help disambiguate files to + include (#1236) + ## 0.9.8 * support for generic methods. * remove deps on cli_utils and which. diff --git a/bin/dartdoc.dart b/bin/dartdoc.dart index df2dedd5a4..65529e33ba 100644 --- a/bin/dartdoc.dart +++ b/bin/dartdoc.dart @@ -193,7 +193,9 @@ ArgParser _createArgsParser() { parser.addOption('include', allowMultiple: true, help: 'library names to generate docs for'); parser.addOption('include-external', - allowMultiple: true, help: 'additional (external) libraries to include'); + allowMultiple: true, + help: 'additional (external) dart files to include, use "dir/fileName", ' + 'as in lib/material.dart'); parser.addOption('hosted-url', help: 'URL where the docs will be hosted (used to generate the sitemap).'); diff --git a/lib/dartdoc.dart b/lib/dartdoc.dart index 605d255d94..fcda6640d3 100644 --- a/lib/dartdoc.dart +++ b/lib/dartdoc.dart @@ -252,12 +252,13 @@ class DartDoc { while (result.hasMoreWork) { result = context.performAnalysisTask(); } - + // Use the includeExternals. for (Source source in context.librarySources) { LibraryElement library = context.computeLibraryElement(source); String libraryName = Library.getLibraryName(library); - if (includeExternals.contains(libraryName)) { + var fullPath = source.fullName; + if (includeExternals.any((string) => fullPath.endsWith(string))) { if (libraries.map(Library.getLibraryName).contains(libraryName)) { continue; }