Skip to content
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

Deprecate the 'include-externals' option. #3694

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions lib/src/dartdoc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@ class Dartdoc {
runtimeStats.startPerfTask('buildPackageGraph');
var packageGraph = await packageBuilder.buildPackageGraph();
runtimeStats.endPerfTask();
if (packageBuilder.includeExternalsWasSpecified) {
packageGraph.defaultPackage.warn(
PackageWarning.deprecated,
message:
"The '--include-externals' option is deprecated, and will soon be "
'removed.',
);
}
var libs = packageGraph.libraryCount;
logInfo("Initialized dartdoc with $libs librar${libs == 1 ? 'y' : 'ies'}");

Expand Down
19 changes: 17 additions & 2 deletions lib/src/model/package_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ abstract class PackageBuilder {
Future<PackageGraph> buildPackageGraph();

Future<void> dispose();

/// The `include-external` option is deprecated, so we track whether it was
/// used, to report it.
bool get includeExternalsWasSpecified;
}

/// A package builder that understands pub package format.
Expand Down Expand Up @@ -283,7 +287,11 @@ class PubPackageBuilder implements PackageBuilder {
}
files.addAll(newFiles);
if (!addingSpecials) {
files.addAll(_includedExternalsFrom(newFiles));
var externals = _includedExternalsFrom(newFiles);
if (externals.isNotEmpty) {
includeExternalsWasSpecified = true;
}
files.addAll(externals);
}

var packages = _packageMetasForFiles(files.difference(_knownParts));
Expand Down Expand Up @@ -437,14 +445,21 @@ class PubPackageBuilder implements PackageBuilder {
includeDependencies: _config.autoIncludeDependencies,
filterExcludes: true,
).toList();
files = [...files, ..._includedExternalsFrom(files)];
var externals = _includedExternalsFrom(files);
if (externals.isNotEmpty) {
includeExternalsWasSpecified = true;
}
files = [...files, ...externals];
return {
...files
.map((s) => _pathContext.absolute(_resourceProvider.getFile(s).path)),
..._embedderSdkFiles,
};
}

@override
bool includeExternalsWasSpecified = false;

Iterable<String> get _embedderSdkFiles => [
for (var dartUri in _embedderSdkUris)
_pathContext.absolute(_resourceProvider
Expand Down