Skip to content

Hide non-local embedded SDKs #2175

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 2 commits into from
Apr 10, 2020
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
19 changes: 16 additions & 3 deletions lib/src/model/package.dart
Original file line number Diff line number Diff line change
@@ -152,9 +152,22 @@ class Package extends LibraryContainer
/// was not excluded on the command line.
bool get isLocal {
if (_isLocal == null) {
_isLocal = (packageMeta == packageGraph.packageMeta ||
packageGraph.hasEmbedderSdk && packageMeta.isSdk ||
packageGraph.config.autoIncludeDependencies) &&
_isLocal = (
// Document as local if this is the default package.
packageMeta == packageGraph.packageMeta ||
// Assume we want to document an embedded SDK as local if
// it has libraries defined in the default package.
// TODO(jcollins-g): Handle case where embedder SDKs can be
// assembled from multiple locations?
packageGraph.hasEmbedderSdk &&
packageMeta.isSdk &&
libraries.any((l) => path.isWithin(
packageGraph.packageMeta.dir.path,
(l.element.source.fullName))) ||
// autoIncludeDependencies means everything is local.
packageGraph.config.autoIncludeDependencies) &&
// Regardless of the above rules, do not document as local if
// we excluded this package by name.
!packageGraph.config.isPackageExcluded(name);
}
return _isLocal;
4 changes: 2 additions & 2 deletions lib/src/model/package_builder.dart
Original file line number Diff line number Diff line change
@@ -52,9 +52,9 @@ class PackageBuilder {
return newGraph;
}

DartSdk _sdk;
FolderBasedDartSdk _sdk;

DartSdk get sdk {
FolderBasedDartSdk get sdk {
if (_sdk == null) {
_sdk = FolderBasedDartSdk(PhysicalResourceProvider.INSTANCE,
PhysicalResourceProvider.INSTANCE.getFolder(config.sdkDir));