Don't look for .packages while creating Workspace.

Change-Id: I8903f21caad6d0920dc2dca8f2a20137540198b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237722
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2022-03-17 17:57:13 +00:00 committed by Commit Bot
parent 8f563a4f35
commit f1a753a338

View file

@ -380,17 +380,6 @@ class ContextLocatorImpl implements ContextLocator {
var rootPath = folder.path;
// TODO(scheglov) Do we need this?
if (_hasPackageFileInPath(rootPath)) {
// A Bazel or Gn workspace that includes a '.packages' file is treated
// like a normal (non-Bazel/Gn) directory. But may still use
// package:build or Pub.
return PackageBuildWorkspace.find(
resourceProvider, packageMap, rootPath) ??
PubWorkspace.find(resourceProvider, packageMap, rootPath) ??
BasicWorkspace.find(resourceProvider, packageMap, rootPath);
}
Workspace? workspace;
workspace = BazelWorkspace.find(resourceProvider, rootPath,
lookForBuildFileSubstitutes: false);
@ -522,15 +511,6 @@ class ContextLocatorImpl implements ContextLocator {
return null;
}
/// Return `true` if either the directory at [rootPath] or a parent of that
/// directory contains a `.packages` file.
bool _hasPackageFileInPath(String rootPath) {
var folder = resourceProvider.getFolder(rootPath);
return folder.withAncestors.any((current) {
return current.getChildAssumingFile('.packages').exists;
});
}
/// Add to the given lists of [folders] and [files] all of the resources in
/// the given list of [paths] that exist and are not contained within one of
/// the folders.