Remove newDotPackagesFile(), related from file_paths, context location / manager.

Change-Id: I0f3c067b47e4d0f6171b8a26d34fc173df983c29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237637
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:40:16 +00:00
committed by Commit Bot
parent 073db61a4e
commit 592bfc0174
5 changed files with 9 additions and 21 deletions
@@ -513,7 +513,6 @@ class ContextManagerImpl implements ContextManager {
return file_paths.isDart(pathContext, path) ||
file_paths.isAnalysisOptionsYaml(pathContext, path) ||
file_paths.isPubspecYaml(pathContext, path) ||
file_paths.isDotPackages(pathContext, path) ||
file_paths.isPackageConfigJson(pathContext, path);
}
@@ -675,7 +674,6 @@ class ContextManagerImpl implements ContextManager {
final isPubspec = file_paths.isPubspecYaml(pathContext, path);
if (file_paths.isAnalysisOptionsYaml(pathContext, path) ||
file_paths.isBazelBuild(pathContext, path) ||
file_paths.isDotPackages(pathContext, path) ||
file_paths.isPackageConfigJson(pathContext, path) ||
isPubspec ||
false) {
@@ -6,6 +6,7 @@ import 'package:analysis_server/protocol/protocol.dart';
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analysis_server/src/domain_server.dart';
import 'package:analysis_server/src/edit/edit_domain.dart';
import 'package:analyzer/src/test_utilities/package_config_file_builder.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -841,11 +842,13 @@ class GetAvailableRefactoringsTest extends AbstractAnalysisTest {
late List<RefactoringKind> kinds;
void addFlutterPackage() {
var libFolder = MockPackages.instance.addFlutter(resourceProvider);
// Create .packages in the project.
newFile2(join(projectPath, '.packages'), '''
flutter:${libFolder.toUri()}
''');
var flutterLib = MockPackages.instance.addFlutter(resourceProvider);
newPackageConfigJsonFile(
projectPath,
(PackageConfigFileBuilder()
..add(name: 'flutter', rootPath: flutterLib.parent.path))
.toContent(toUriStr: toUriStr),
);
}
/// Tests that there is refactoring of the given [kind] is available at the
@@ -519,7 +519,7 @@ class ContextLocatorImpl implements ContextLocator {
return file;
}
return _getFile(folder, file_paths.dotPackages);
return null;
}
/// Return `true` if either the directory at [rootPath] or a parent of that
@@ -79,11 +79,6 @@ mixin ResourceProviderMixin {
return newFile2(path, content);
}
File newDotPackagesFile(String directoryPath, String content) {
String path = join(directoryPath, file_paths.dotPackages);
return newFile2(path, content);
}
@Deprecated('Use newFile2() instead')
File newFile(String path, {String content = ''}) {
return newFile2(path, content);
@@ -19,9 +19,6 @@ const String bazelBuild = 'BUILD';
/// The name of the `.dart_tool` directory.
const String dotDartTool = '.dart_tool';
/// File name of package spec files.
const String dotPackages = '.packages';
/// The name of the data file used to specify data-driven fixes.
const String fixDataYaml = 'fix_data.yaml';
@@ -59,11 +56,6 @@ bool isDart(p.Context pathContext, String path) {
return pathContext.extension(path) == '.dart';
}
/// Return `true` if [path] is a `.packages` file.
bool isDotPackages(p.Context pathContext, String path) {
return pathContext.basename(path) == dotPackages;
}
/// Return `true` if the [path] is a `fix_data.yaml` file.
/// Such files specify data-driven fixes.
bool isFixDataYaml(p.Context pathContext, String path) {