Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit dfe46b9

Browse files
author
Dart CI
committed
Version 2.18.0-118.0.dev
Merge commit 'aa616d6ad84b4fc4bfe0cef7c24aadba64fcd50b' into 'dev'
2 parents dfef9e3 + aa616d6 commit dfe46b9

File tree

5 files changed

+25
-10
lines changed

5 files changed

+25
-10
lines changed

pkg/analyzer/lib/src/lint/analysis.dart

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,8 @@ class LintDriver {
134134
}
135135

136136
if (projectAnalysisSession != null) {
137-
var project = await DartProject.create(
138-
projectAnalysisSession,
139-
_filesAnalyzed.toList(),
140-
);
141-
for (var lint in Registry.ruleRegistry) {
142-
if (lint is ProjectVisitor) {
143-
(lint as ProjectVisitor).visit(project);
144-
}
145-
}
137+
// ignore: deprecated_member_use_from_same_package
138+
await _visitProject(projectAnalysisSession);
146139
}
147140

148141
var result = <AnalysisErrorInfo>[];
@@ -168,6 +161,24 @@ class LintDriver {
168161
path = pathContext.normalize(path);
169162
return path;
170163
}
164+
165+
@Deprecated('DartProject is deprecated. This is slated for removal')
166+
Future<void> _visitProject(AnalysisSession projectAnalysisSession) async {
167+
Future<DartProject> createProject() async {
168+
return await DartProject.create(
169+
projectAnalysisSession,
170+
_filesAnalyzed.toList(),
171+
);
172+
}
173+
174+
DartProject? project;
175+
for (var lint in Registry.ruleRegistry) {
176+
if (lint is ProjectVisitor) {
177+
project ??= await createProject();
178+
(lint as ProjectVisitor).visit(project);
179+
}
180+
}
181+
}
171182
}
172183

173184
/// Prints logging information comments to the [outSink] and error messages to

pkg/analyzer/lib/src/lint/linter.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ abstract class LintRule extends Linter implements Comparable<LintRule> {
629629

630630
/// Return a visitor to be passed to provide access to Dart project context
631631
/// and to perform project-level analyses.
632+
@Deprecated('Use LinterContext instead')
632633
ProjectVisitor? getProjectVisitor() => null;
633634

634635
/// Return a visitor to be passed to pubspecs to perform lint

pkg/analyzer/lib/src/lint/project.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Pubspec? _findAndParsePubspec(Directory root) {
3535
/// standardized way, access global information (such as whether elements are
3636
/// in the "public API") and resources that have special meanings in the
3737
/// context of pub package layout conventions.
38+
@Deprecated('Use LinterContext instead')
3839
class DartProject {
3940
late final _ApiModel _apiModel;
4041
String? _name;
@@ -98,6 +99,7 @@ class DartProject {
9899
}
99100

100101
/// An object that can be used to visit Dart project structure.
102+
@Deprecated('Use LinterContext instead')
101103
abstract class ProjectVisitor<T> {
102104
T? visit(DartProject project) => null;
103105
}

pkg/analyzer/test/src/lint/project_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ defineTests() {
1818
// TODO(brianwilkerson) These tests fail on the bots because the cwd is
1919
// not the same there as when we run tests locally.
2020
group('cwd', () async {
21+
// ignore: deprecated_member_use_from_same_package
2122
var project = await DartProject.create(_AnalysisSessionMock(), []);
2223
test('name', () {
2324
expect(project.name, 'analyzer');

tools/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ CHANNEL dev
2727
MAJOR 2
2828
MINOR 18
2929
PATCH 0
30-
PRERELEASE 117
30+
PRERELEASE 118
3131
PRERELEASE_PATCH 0

0 commit comments

Comments
 (0)