Version 2.18.0-118.0.dev

Merge commit 'aa616d6ad84b4fc4bfe0cef7c24aadba64fcd50b' into 'dev'
diff --git a/pkg/analyzer/lib/src/lint/analysis.dart b/pkg/analyzer/lib/src/lint/analysis.dart
index 18d98ab..b51a93a 100644
--- a/pkg/analyzer/lib/src/lint/analysis.dart
+++ b/pkg/analyzer/lib/src/lint/analysis.dart
@@ -134,15 +134,8 @@
     }
 
     if (projectAnalysisSession != null) {
-      var project = await DartProject.create(
-        projectAnalysisSession,
-        _filesAnalyzed.toList(),
-      );
-      for (var lint in Registry.ruleRegistry) {
-        if (lint is ProjectVisitor) {
-          (lint as ProjectVisitor).visit(project);
-        }
-      }
+      // ignore: deprecated_member_use_from_same_package
+      await _visitProject(projectAnalysisSession);
     }
 
     var result = <AnalysisErrorInfo>[];
@@ -168,6 +161,24 @@
     path = pathContext.normalize(path);
     return path;
   }
+
+  @Deprecated('DartProject is deprecated. This is slated for removal')
+  Future<void> _visitProject(AnalysisSession projectAnalysisSession) async {
+    Future<DartProject> createProject() async {
+      return await DartProject.create(
+        projectAnalysisSession,
+        _filesAnalyzed.toList(),
+      );
+    }
+
+    DartProject? project;
+    for (var lint in Registry.ruleRegistry) {
+      if (lint is ProjectVisitor) {
+        project ??= await createProject();
+        (lint as ProjectVisitor).visit(project);
+      }
+    }
+  }
 }
 
 /// Prints logging information comments to the [outSink] and error messages to
diff --git a/pkg/analyzer/lib/src/lint/linter.dart b/pkg/analyzer/lib/src/lint/linter.dart
index 2e07c8a..bbbb005 100644
--- a/pkg/analyzer/lib/src/lint/linter.dart
+++ b/pkg/analyzer/lib/src/lint/linter.dart
@@ -629,6 +629,7 @@
 
   /// Return a visitor to be passed to provide access to Dart project context
   /// and to perform project-level analyses.
+  @Deprecated('Use LinterContext instead')
   ProjectVisitor? getProjectVisitor() => null;
 
   /// Return a visitor to be passed to pubspecs to perform lint
diff --git a/pkg/analyzer/lib/src/lint/project.dart b/pkg/analyzer/lib/src/lint/project.dart
index 6feb9f4..17f95be 100644
--- a/pkg/analyzer/lib/src/lint/project.dart
+++ b/pkg/analyzer/lib/src/lint/project.dart
@@ -35,6 +35,7 @@
 /// standardized way, access global information (such as whether elements are
 /// in the "public API") and resources that have special meanings in the
 /// context of pub package layout conventions.
+@Deprecated('Use LinterContext instead')
 class DartProject {
   late final _ApiModel _apiModel;
   String? _name;
@@ -98,6 +99,7 @@
 }
 
 /// An object that can be used to visit Dart project structure.
+@Deprecated('Use LinterContext instead')
 abstract class ProjectVisitor<T> {
   T? visit(DartProject project) => null;
 }
diff --git a/pkg/analyzer/test/src/lint/project_test.dart b/pkg/analyzer/test/src/lint/project_test.dart
index 0c0c8dc..8b6d01a 100644
--- a/pkg/analyzer/test/src/lint/project_test.dart
+++ b/pkg/analyzer/test/src/lint/project_test.dart
@@ -18,6 +18,7 @@
       // TODO(brianwilkerson) These tests fail on the bots because the cwd is
       // not the same there as when we run tests locally.
       group('cwd', () async {
+        // ignore: deprecated_member_use_from_same_package
         var project = await DartProject.create(_AnalysisSessionMock(), []);
         test('name', () {
           expect(project.name, 'analyzer');
diff --git a/tools/VERSION b/tools/VERSION
index 21165ce..8f6d0e7 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 18
 PATCH 0
-PRERELEASE 117
+PRERELEASE 118
 PRERELEASE_PATCH 0
\ No newline at end of file