Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix analyzer deprecations #3376

Merged
merged 3 commits into from Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
766 changes: 539 additions & 227 deletions .github/workflows/dart.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/pubspec.yaml
Expand Up @@ -4,7 +4,7 @@ description: A package for authoring build_runner compatible code generators.
repository: https://github.com/dart-lang/build/tree/master/build

environment:
sdk: ">=2.17.0 <3.0.0"
sdk: ">=2.18.0 <3.0.0"

dependencies:
analyzer: ">=1.5.0 <6.0.0"
Expand Down
5 changes: 5 additions & 0 deletions build_modules/CHANGELOG.md
@@ -1,3 +1,8 @@
## 4.0.7-dev

- Migrate off deprecated analyzer apis.
- Update min sdk constraint to 2.18.0.

## 4.0.6

- Allow the latest `package:analyzer`.
Expand Down
2 changes: 1 addition & 1 deletion build_modules/lib/src/module_library.dart
Expand Up @@ -238,6 +238,6 @@ bool _isPart(CompilationUnit dart) =>
// but has a part that does, or it exports a `main` from another library.
bool _hasMainMethod(CompilationUnit dart) => dart.declarations.any((node) =>
node is FunctionDeclaration &&
node.name2.lexeme == 'main' &&
node.name.lexeme == 'main' &&
node.functionExpression.parameters != null &&
node.functionExpression.parameters!.parameters.length <= 2);
23 changes: 12 additions & 11 deletions build_modules/mono_pkg.yaml
@@ -1,17 +1,18 @@
sdk:
- dev
- dev
- pubspec

stages:
- analyze_and_format:
- group:
- format
- analyze: --fatal-infos .
- unit_test:
- test: -P presubmit --test-randomize-ordering-seed=random
os:
- linux
- windows
- analyze_and_format:
jakemac53 marked this conversation as resolved.
Show resolved Hide resolved
- group:
- format
- analyze: --fatal-infos .
- unit_test:
- test: -P presubmit --test-randomize-ordering-seed=random
os:
- linux
- windows

cache:
directories:
- .dart_tool/build
- .dart_tool/build
6 changes: 3 additions & 3 deletions build_modules/pubspec.yaml
@@ -1,13 +1,13 @@
name: build_modules
version: 4.0.6
version: 4.0.7-dev
description: Builders for Dart modules
repository: https://github.com/dart-lang/build/tree/master/build_modules

environment:
sdk: ">=2.14.0 <3.0.0"
sdk: '>=2.18.0 <3.0.0'

dependencies:
analyzer: '>=4.4.0 <6.0.0'
analyzer: '>=5.1.0 <6.0.0'
async: ^2.5.0
bazel_worker: ^1.0.0
build: ^2.0.0
Expand Down
5 changes: 5 additions & 0 deletions build_resolvers/CHANGELOG.md
@@ -1,3 +1,8 @@
## 2.0.11-dev

- Migrate off deprecated analyzer apis.
- Update min sdk constraint to 2.18.0.

## 2.0.10

- Migrate from `LibraryElement#parts` to `LibraryElement#parts2`.
Expand Down
8 changes: 4 additions & 4 deletions build_resolvers/pubspec.yaml
@@ -1,17 +1,17 @@
name: build_resolvers
version: 2.0.10
version: 2.0.11-dev
description: Resolve Dart code in a Builder
repository: https://github.com/dart-lang/build/tree/master/build_resolvers

environment:
sdk: ">=2.17.0 <3.0.0"
sdk: '>=2.18.0 <3.0.0'

dependencies:
analyzer: '>=4.6.0 <6.0.0'
analyzer: '>=5.1.0 <6.0.0'
async: ^2.5.0
build: ^2.0.0
crypto: ^3.0.0
graphs: ">=1.0.0 <3.0.0"
graphs: '>=1.0.0 <3.0.0'
logging: ^1.0.0
path: ^1.8.0
package_config: ^2.0.0
Expand Down
7 changes: 3 additions & 4 deletions build_resolvers/test/resolver_test.dart
Expand Up @@ -733,7 +733,7 @@ int? get x => 1;
expect(
unit.declarations.first,
isA<FunctionDeclaration>()
.having((d) => d.name2.lexeme, 'main', 'main'));
.having((d) => d.name.lexeme, 'main', 'main'));
}, resolvers: AnalyzerResolvers());
});
});
Expand All @@ -747,7 +747,7 @@ int? get x => 1;
var unit = await resolver.astNodeFor(lib.topLevelElements.first);
expect(unit, isA<FunctionDeclaration>());
expect(unit!.toSource(), 'main() {}');
expect((unit as FunctionDeclaration).declaredElement2, isNull);
expect((unit as FunctionDeclaration).declaredElement, isNull);
}, resolvers: AnalyzerResolvers());
});

Expand All @@ -762,8 +762,7 @@ int? get x => 1;
unit,
isA<FunctionDeclaration>()
.having((fd) => fd.toSource(), 'toSource()', 'main() {}')
.having(
(fd) => fd.declaredElement2, 'declaredElement', isNotNull),
.having((fd) => fd.declaredElement, 'declaredElement', isNotNull),
);
}, resolvers: AnalyzerResolvers());
});
Expand Down
4 changes: 2 additions & 2 deletions build_test/pubspec.yaml
Expand Up @@ -4,7 +4,7 @@ version: 2.1.6-dev
repository: https://github.com/dart-lang/build/tree/master/build_test

environment:
sdk: ">=2.17.0 <3.0.0"
sdk: '>=2.17.0 <3.0.0'

dependencies:
async: ^2.5.0
Expand All @@ -20,7 +20,7 @@ dependencies:
path: ^1.8.0
stream_transform: ^2.0.0
test: ^1.16.0
test_core: ">=0.3.19 <0.5.0"
test_core: '>=0.3.19 <0.5.0'
watcher: ^1.0.0

dev_dependencies:
Expand Down
5 changes: 5 additions & 0 deletions build_vm_compilers/CHANGELOG.md
@@ -1,3 +1,8 @@
## 1.0.13-dev

- Migrate off deprecated analyzer apis.
- Update min sdk constraint to 2.18.0.

## 1.0.12

- Allow the latest `package:analyzer`.
Expand Down
2 changes: 1 addition & 1 deletion build_vm_compilers/lib/src/vm_entrypoint_builder.dart
Expand Up @@ -94,7 +94,7 @@ Future<bool> _isAppEntryPoint(AssetId dartId, AssetReader reader) async {
// but has a part that does, or it exports a `main` from another library.
return parsed.declarations.any((node) {
return node is FunctionDeclaration &&
node.name2.lexeme == 'main' &&
node.name.lexeme == 'main' &&
node.functionExpression.parameters != null &&
node.functionExpression.parameters!.parameters.length <= 2;
});
Expand Down
6 changes: 3 additions & 3 deletions build_vm_compilers/pubspec.yaml
@@ -1,13 +1,13 @@
name: build_vm_compilers
version: 1.0.12
version: 1.0.13-dev
description: Builder implementations wrapping Dart VM compilers.
repository: https://github.com/dart-lang/build/tree/master/build_vm_compilers

environment:
sdk: ">=2.17.0 <3.0.0"
sdk: '>=2.18.0 <3.0.0'

dependencies:
analyzer: '>=4.4.0 <6.0.0'
analyzer: '>=5.1.0 <6.0.0'
build: ^2.0.0
build_config: ^1.0.0
build_modules: ^4.0.0
Expand Down
5 changes: 5 additions & 0 deletions build_web_compilers/CHANGELOG.md
@@ -1,3 +1,8 @@
## 3.2.7-dev

- Migrate off deprecated analyzer apis.
- Update min sdk constraint to 2.18.0.

## 3.2.6

- Allow the latest `package:analyzer`.
Expand Down
2 changes: 1 addition & 1 deletion build_web_compilers/lib/src/web_entrypoint_builder.dart
Expand Up @@ -181,7 +181,7 @@ Future<bool> _isAppEntryPoint(AssetId dartId, AssetReader reader) async {
// but has a part that does, or it exports a `main` from another library.
return parsed.declarations.any((node) {
return node is FunctionDeclaration &&
node.name2.lexeme == 'main' &&
node.name.lexeme == 'main' &&
node.functionExpression.parameters != null &&
node.functionExpression.parameters!.parameters.length <= 2;
});
Expand Down
21 changes: 11 additions & 10 deletions build_web_compilers/mono_pkg.yaml
@@ -1,13 +1,14 @@
sdk:
- dev
- dev
- pubspec

stages:
- analyze_and_format:
- group:
- format
- analyze: --fatal-infos .
- unit_test:
- test: --test-randomize-ordering-seed=random
os:
- linux
- windows
- analyze_and_format:
- group:
- format
- analyze: --fatal-infos .
- unit_test:
- test: --test-randomize-ordering-seed=random
os:
- linux
- windows
6 changes: 3 additions & 3 deletions build_web_compilers/pubspec.yaml
@@ -1,13 +1,13 @@
name: build_web_compilers
version: 3.2.6
version: 3.2.7-dev
description: Builder implementations wrapping Dart compilers.
repository: https://github.com/dart-lang/build/tree/master/build_web_compilers

environment:
sdk: ">=2.17.0 <3.0.0"
sdk: '>=2.18.0 <3.0.0'

dependencies:
analyzer: '>=4.4.0 <6.0.0'
analyzer: '>=5.1.0 <6.0.0'
archive: ^3.0.0
bazel_worker: ^1.0.0
build: ^2.0.0
Expand Down