Skip to content

Fix for duplicate libraries in SDK docs #1218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions lib/dartdoc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,6 @@ const String version = '0.9.6+2';

final String defaultOutDir = p.join('doc', 'api');

/// Configure the dartdoc generation process
void initializeConfig(
{Directory inputDir,
String sdkVersion,
bool addCrossdart: false,
bool includeSource: true}) {
setConfig(
inputDir: inputDir,
sdkVersion: sdkVersion,
addCrossdart: addCrossdart,
includeSource: includeSource);
}

/// Initialize and setup the generators.
Future<List<Generator>> initGenerators(String url, List<String> headerFilePaths,
List<String> footerFilePaths, String relCanonicalPrefix,
Expand All @@ -73,6 +60,19 @@ Future<List<Generator>> initGenerators(String url, List<String> headerFilePaths,
];
}

/// Configure the dartdoc generation process
void initializeConfig(
{Directory inputDir,
String sdkVersion,
bool addCrossdart: false,
bool includeSource: true}) {
setConfig(
inputDir: inputDir,
sdkVersion: sdkVersion,
addCrossdart: addCrossdart,
includeSource: includeSource);
}

/// Generates Dart documentation for all public Dart libraries in the given
/// directory.
class DartDoc {
Expand Down Expand Up @@ -196,7 +196,8 @@ class DartDoc {
..sourceFactory = sourceFactory;

if (packageMeta.isSdk) {
libraries.addAll(getSdkLibrariesToDocument(sdk, context));
libraries
.addAll(new Set()..addAll(getSdkLibrariesToDocument(sdk, context)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be awesome if collections supported a distinct() method, so we could just say getSdkLibrariesToDocument(sdk, context).distinct(). That said, a set works in the meantime! 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, I guess getSdkLibrariesToDocument() might enforce uniqueness. Would there be any benefit to doing it there?

}

List<Source> sources = [];
Expand Down