[analyzer] don't traverse into dot folders when analyzing android manifest files
Change-Id: Ic0797064bc4209c597afb080adc050bf4a4c1f2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100569
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index c4dc5b8..5066368 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -1141,6 +1141,11 @@
}
void checkManifestFilesIn(Folder folder) {
+ // Don't traverse into dot directories.
+ if (folder.shortName.startsWith('.')) {
+ return;
+ }
+
for (var child in folder.getChildren()) {
if (child is File) {
if (child.shortName == MANIFEST_NAME &&
diff --git a/pkg/analysis_server/test/analysis/notification_errors_test.dart b/pkg/analysis_server/test/analysis/notification_errors_test.dart
index 29da5e8..ffec72b 100644
--- a/pkg/analysis_server/test/analysis/notification_errors_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_errors_test.dart
@@ -97,6 +97,34 @@
expect(error.type, AnalysisErrorType.STATIC_WARNING);
}
+ test_androidManifestFile_dotDirectoryIgnored() async {
+ String filePath =
+ join(projectPath, 'ios', '.symlinks', 'AndroidManifest.xml');
+ String manifestFile = newFile(filePath, content: '''
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android">
+ <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
+ <uses-feature android:name="android.software.home_screen" />
+</manifest>
+''').path;
+ newFile(join(projectPath, 'analysis_options.yaml'), content: '''
+analyzer:
+ optional-checks:
+ chrome-os-manifest-checks: true
+''');
+
+ Request request =
+ new AnalysisSetAnalysisRootsParams([projectPath], []).toRequest('0');
+ handleSuccessfulRequest(request);
+ await waitForTasksFinished();
+ await pumpEventQueue();
+ //
+ // Verify that the file wasn't analyzed.
+ //
+ List<AnalysisError> errors = filesErrors[manifestFile];
+ expect(errors, isNull);
+ }
+
test_importError() async {
createProject();