Skip to content

Commit d6bc0f0

Browse files
[pigeon] Update analyzer and formatter (#8456)
Adds compatibility with the latest major version of `analyzer` and `dart_style` (the latter being required to actually allow `analyzer` 7). The breaking change of `dart_style` does affect our usage, so this updates rather than expands the allowed version. The range for `analyzer` is updated to drop versions older thas 6 since `dart_style` doesn't allow versions older than 6 anyway. We have to pick a language version to use for formatting; this (somewhat arbitrarily) uses 3.6, to opt in to the new formatter. Fixes flutter/flutter#161820 Fixes flutter/flutter#161583
1 parent 205960d commit d6bc0f0

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

packages/pigeon/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 22.7.3
2+
3+
* Adds compatibility with `analyzer` 7.x.*.
4+
15
## 22.7.2
26

37
* Updates README to discuss best practices for using Pigeon-generated code.

packages/pigeon/lib/dart_generator.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import 'package:code_builder/code_builder.dart' as cb;
66
import 'package:dart_style/dart_style.dart';
77
import 'package:path/path.dart' as path;
8+
import 'package:pub_semver/pub_semver.dart';
89

910
import 'ast.dart';
1011
import 'dart/templates.dart';
@@ -779,7 +780,8 @@ final BinaryMessenger? ${varNamePrefix}binaryMessenger;
779780

780781
final cb.DartEmitter emitter = cb.DartEmitter(useNullSafetySyntax: true);
781782
indent.format(
782-
DartFormatter().format('${instanceManagerApi.accept(emitter)}'),
783+
DartFormatter(languageVersion: Version(3, 6, 0))
784+
.format('${instanceManagerApi.accept(emitter)}'),
783785
);
784786
}
785787

@@ -899,7 +901,8 @@ final BinaryMessenger? ${varNamePrefix}binaryMessenger;
899901
);
900902

901903
final cb.DartEmitter emitter = cb.DartEmitter(useNullSafetySyntax: true);
902-
indent.format(DartFormatter().format('${proxyApi.accept(emitter)}'));
904+
indent.format(DartFormatter(languageVersion: Version(3, 6, 0))
905+
.format('${proxyApi.accept(emitter)}'));
903906
}
904907

905908
/// Generates Dart source code for test support libraries based on the given AST

packages/pigeon/lib/generator_tools.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import 'ast.dart';
1414
/// The current version of pigeon.
1515
///
1616
/// This must match the version in pubspec.yaml.
17-
const String pigeonVersion = '22.7.2';
17+
const String pigeonVersion = '22.7.3';
1818

1919
/// Read all the content from [stdin] to a String.
2020
String readStdin() {

packages/pigeon/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ name: pigeon
22
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
33
repository: https://github.com/flutter/packages/tree/main/packages/pigeon
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+pigeon%22
5-
version: 22.7.2 # This must match the version in lib/generator_tools.dart
5+
version: 22.7.3 # This must match the version in lib/generator_tools.dart
66

77
environment:
88
sdk: ^3.4.0
99

1010
dependencies:
11-
analyzer: ">=5.13.0 <7.0.0"
11+
analyzer: ">=6.0.0 <8.0.0"
1212
args: ^2.1.0
1313
code_builder: ^4.10.0
1414
collection: ^1.15.0
15-
dart_style: ^2.3.4
15+
dart_style: ^3.0.0
1616
graphs: ^2.3.1
1717
meta: ^1.9.0
1818
path: ^1.8.0

0 commit comments

Comments
 (0)