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>
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index fae383f..326c869 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -513,7 +513,6 @@
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 @@
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) {
diff --git a/pkg/analysis_server/test/edit/refactoring_test.dart b/pkg/analysis_server/test/edit/refactoring_test.dart
index fe52d9d..e391b6c 100644
--- a/pkg/analysis_server/test/edit/refactoring_test.dart
+++ b/pkg/analysis_server/test/edit/refactoring_test.dart
@@ -6,6 +6,7 @@
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 @@
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
diff --git a/pkg/analyzer/lib/src/dart/analysis/context_locator.dart b/pkg/analyzer/lib/src/dart/analysis/context_locator.dart
index e16b138..f34cbf5 100644
--- a/pkg/analyzer/lib/src/dart/analysis/context_locator.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/context_locator.dart
@@ -519,7 +519,7 @@
return file;
}
- return _getFile(folder, file_paths.dotPackages);
+ return null;
}
/// Return `true` if either the directory at [rootPath] or a parent of that
diff --git a/pkg/analyzer/lib/src/test_utilities/resource_provider_mixin.dart b/pkg/analyzer/lib/src/test_utilities/resource_provider_mixin.dart
index d74721d..dadf358 100644
--- a/pkg/analyzer/lib/src/test_utilities/resource_provider_mixin.dart
+++ b/pkg/analyzer/lib/src/test_utilities/resource_provider_mixin.dart
@@ -79,11 +79,6 @@
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);
diff --git a/pkg/analyzer/lib/src/util/file_paths.dart b/pkg/analyzer/lib/src/util/file_paths.dart
index 08b1e22..85d865f 100644
--- a/pkg/analyzer/lib/src/util/file_paths.dart
+++ b/pkg/analyzer/lib/src/util/file_paths.dart
@@ -19,9 +19,6 @@
/// 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 @@
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) {