Skip to content

Commit 7568a46

Browse files
authored
Update SDK constraint and language version to 3.9 + formatting (#8947)
1 parent 7f72075 commit 7568a46

File tree

554 files changed

+32314
-27623
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

554 files changed

+32314
-27623
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ AppEngine version, listed here to ease deployment and troubleshooting.
44
## Next Release (replace with git tag when deployed)
55
* Bump runtimeVersion to `2025.09.08`.
66
* Upgraded stable Flutter analysis SDK to `3.35.3`.
7+
* Updated SDK constraint (and language version) to `3.9`
78

89
## `20250904t074800-all`
910
* Bump runtimeVersion to `2025.08.29`.

app/bin/tools/check_domain_access.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ Future<void> _checkHosts() async {
4343
for (final type in [InternetAddressType.IPv4, InternetAddressType.IPv6]) {
4444
final typeStr = type == InternetAddressType.IPv4 ? 'IPv4' : 'IPv6';
4545
try {
46-
final addresses =
47-
await InternetAddress.lookup(host, type: type).timeout(timeLimit);
46+
final addresses = await InternetAddress.lookup(
47+
host,
48+
type: type,
49+
).timeout(timeLimit);
4850
final failed = <InternetAddress>[];
4951
for (final address in addresses) {
5052
try {
@@ -56,7 +58,8 @@ Future<void> _checkHosts() async {
5658
}
5759
final successCount = addresses.length - failed.length;
5860
print(
59-
'- $host $typeStr resolve and connect succeeded: $successCount / ${addresses.length}');
61+
'- $host $typeStr resolve and connect succeeded: $successCount / ${addresses.length}',
62+
);
6063
} catch (e) {
6164
print('- $host $typeStr lookup failed: $e');
6265
}

app/bin/tools/check_drift.dart

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,9 @@ Future<_Sample> _sample({
7474
Future<_Item> _singleItem(SearchForm form) async {
7575
final params = form.toServiceQuery().toUriQueryParameters();
7676
final rs = await _client.get(
77-
Uri.parse('https://search-dot-dartlang-pub.appspot.com/search').replace(
78-
queryParameters: {
79-
...params,
80-
'debug-drift': '1',
81-
},
82-
),
77+
Uri.parse(
78+
'https://search-dot-dartlang-pub.appspot.com/search',
79+
).replace(queryParameters: {...params, 'debug-drift': '1'}),
8380
);
8481
if (rs.statusCode == 200) {
8582
final body = json.decode(rs.body) as Map<String, dynamic>;
@@ -90,8 +87,8 @@ Future<_Item> _singleItem(SearchForm form) async {
9087
final updatedPackages = (index['updatedPackages'] as List).cast<String>();
9188
final lastUpdated = DateTime.parse(index['lastUpdated'] as String);
9289

93-
final packagesList =
94-
(body['packages'] as List).cast<Map<String, dynamic>>();
90+
final packagesList = (body['packages'] as List)
91+
.cast<Map<String, dynamic>>();
9592
final packages = <String?>[];
9693
final scores = <String?, double?>{};
9794

@@ -119,9 +116,7 @@ class _Sample {
119116
final List<_Item>? items;
120117
_Diff? _diff;
121118

122-
_Sample({
123-
this.items,
124-
});
119+
_Sample({this.items});
125120

126121
int get length => items!.length;
127122
_Item get first => items!.first;
@@ -189,17 +184,18 @@ class _Diff {
189184
for (var j = i + 1; j < items.length; j++) {
190185
final item = items[i];
191186
final other = items[j];
192-
final updatedShared = item.updatedPackages!
193-
.toSet()
194-
.intersection(other.updatedPackages!.toSet());
187+
final updatedShared = item.updatedPackages!.toSet().intersection(
188+
other.updatedPackages!.toSet(),
189+
);
195190
final allUpdated = <String>{
196191
...item.updatedPackages!,
197-
...other.updatedPackages!
192+
...other.updatedPackages!,
198193
};
199194
updatedCounts.add(allUpdated.length - updatedShared.length);
200195

201-
final pkgShared =
202-
item.packages!.toSet().intersection(other.packages!.toSet());
196+
final pkgShared = item.packages!.toSet().intersection(
197+
other.packages!.toSet(),
198+
);
203199
final allPackages = <String?>{...item.packages!, ...other.packages!};
204200
packagesCounts.add(allPackages.length - pkgShared.length);
205201

@@ -219,20 +215,22 @@ class _Diff {
219215
updatedCount:
220216
updatedCounts.fold<int>(0, (sum, v) => sum + v) / items.length,
221217
updatedDuration: updatedDiffs.fold<Duration>(
222-
Duration.zero, (mv, d) => mv > d ? mv : d),
218+
Duration.zero,
219+
(mv, d) => mv > d ? mv : d,
220+
),
223221
);
224222
}
225223

226224
bool get hasDrift =>
227225
hasObservableDifference! || packagesCount! > 0.0 || scoreDiffPct! > 0.0;
228226

229227
Map<String, dynamic> toJson() => {
230-
'observable': hasObservableDifference,
231-
'pkg': packagesCount,
232-
'maxScore': scoreDiffPct,
233-
'updated': updatedCount,
234-
'maxDelta': updatedDuration,
235-
};
228+
'observable': hasObservableDifference,
229+
'pkg': packagesCount,
230+
'maxScore': scoreDiffPct,
231+
'updated': updatedCount,
232+
'maxDelta': updatedDuration,
233+
};
236234
}
237235

238236
class _FormWithSummary {

app/bin/tools/isolate_search_benchmark.dart

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,26 @@ final queries = [
2424
];
2525

2626
Future<void> main(List<String> args) async {
27-
print('Started. Current memory: ${ProcessInfo.currentRss ~/ 1024} KiB, '
28-
'max memory: ${ProcessInfo.maxRss ~/ 1024} KiB');
27+
print(
28+
'Started. Current memory: ${ProcessInfo.currentRss ~/ 1024} KiB, '
29+
'max memory: ${ProcessInfo.maxRss ~/ 1024} KiB',
30+
);
2931
final runner = await startSearchIsolate(snapshot: args.first);
30-
print('Loaded. Current memory: ${ProcessInfo.currentRss ~/ 1024} KiB, '
31-
'max memory: ${ProcessInfo.maxRss ~/ 1024} KiB');
32+
print(
33+
'Loaded. Current memory: ${ProcessInfo.currentRss ~/ 1024} KiB, '
34+
'max memory: ${ProcessInfo.maxRss ~/ 1024} KiB',
35+
);
3236

3337
for (var i = 0; i < 5; i++) {
3438
await _benchmark(runner);
3539
print('--');
3640
}
3741

3842
await runner.close();
39-
print('Done. Current memory: ${ProcessInfo.currentRss ~/ 1024} KiB, '
40-
'max memory: ${ProcessInfo.maxRss ~/ 1024} KiB');
43+
print(
44+
'Done. Current memory: ${ProcessInfo.currentRss ~/ 1024} KiB, '
45+
'max memory: ${ProcessInfo.maxRss ~/ 1024} KiB',
46+
);
4147
}
4248

4349
Future<void> _benchmark(IsolateRunner primary) async {
@@ -46,25 +52,31 @@ Future<void> _benchmark(IsolateRunner primary) async {
4652
for (var i = 0; i < 100; i++) {
4753
final random = Random(i);
4854
final items = queries
49-
.map((q) => ServiceSearchQuery.parse(
50-
query: q,
51-
tagsPredicate: TagsPredicate.regularSearch(),
52-
))
55+
.map(
56+
(q) => ServiceSearchQuery.parse(
57+
query: q,
58+
tagsPredicate: TagsPredicate.regularSearch(),
59+
),
60+
)
5361
.toList();
5462
items.shuffle(random);
55-
await Future.wait(items.map((q) async {
56-
final sw = Stopwatch()..start();
57-
await index.search(q);
58-
final d = sw.elapsed.inMicroseconds;
59-
durations.putIfAbsent('all', () => []).add(d);
60-
final key = q.parsedQuery.hasFreeText ? 'primary' : 'reduced';
61-
durations.putIfAbsent(key, () => []).add(d);
62-
}));
63+
await Future.wait(
64+
items.map((q) async {
65+
final sw = Stopwatch()..start();
66+
await index.search(q);
67+
final d = sw.elapsed.inMicroseconds;
68+
durations.putIfAbsent('all', () => []).add(d);
69+
final key = q.parsedQuery.hasFreeText ? 'primary' : 'reduced';
70+
durations.putIfAbsent(key, () => []).add(d);
71+
}),
72+
);
6373
}
6474
for (final e in durations.entries) {
6575
e.value.sort();
66-
print('${e.key.padLeft(10)}: '
67-
'${e.value.average.round().toString().padLeft(10)} avg '
68-
'${e.value[e.value.length * 90 ~/ 100].toString().padLeft(10)} p90');
76+
print(
77+
'${e.key.padLeft(10)}: '
78+
'${e.value.average.round().toString().padLeft(10)} avg '
79+
'${e.value[e.value.length * 90 ~/ 100].toString().padLeft(10)} p90',
80+
);
6981
}
7082
}

app/bin/tools/public_package_page_checker.dart

Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,28 @@ import 'package:pool/pool.dart';
1313
/// checks for rendering user-generated content (esp. markdown).
1414
Future<void> main(List<String> args) async {
1515
final argParser = ArgParser()
16-
..addOption('concurrency',
17-
abbr: 'c', defaultsTo: '1', help: 'Number of concurrent processing.')
16+
..addOption(
17+
'concurrency',
18+
abbr: 'c',
19+
defaultsTo: '1',
20+
help: 'Number of concurrent processing.',
21+
)
1822
..addOption('pub-hosted-url', abbr: 'p', help: 'The PUB_HOSTED_URL to use.')
1923
..addOption('limit', help: 'Stop after N successful checks.')
2024
..addFlag('help', abbr: 'h', defaultsTo: false, help: 'Show help.');
2125

2226
final argv = argParser.parse(args);
2327
if (argv['help'] as bool) {
2428
print(
25-
'Usage: dart public_package_page_checker.dart --pub-hosted-url https://staging-site/ -c 8');
29+
'Usage: dart public_package_page_checker.dart --pub-hosted-url https://staging-site/ -c 8',
30+
);
2631
print('Crawls and checks public package pages on pub.dev site');
2732
print(argParser.usage);
2833
return;
2934
}
3035

31-
final pubHostedUrl = (argv['pub-hosted-url'] as String?) ??
36+
final pubHostedUrl =
37+
(argv['pub-hosted-url'] as String?) ??
3238
Platform.environment['PUB_HOSTED_URL'];
3339
if (pubHostedUrl == null) {
3440
print('Missing PUB_HOSTED_URL.');
@@ -40,48 +46,47 @@ Future<void> main(List<String> args) async {
4046

4147
final client = httpRetryClient();
4248
try {
43-
final nameRs =
44-
await client.get(Uri.parse('$pubHostedUrl/api/package-names'));
45-
final packages =
46-
((json.decode(nameRs.body) as Map)['packages'] as List).cast<String>();
49+
final nameRs = await client.get(
50+
Uri.parse('$pubHostedUrl/api/package-names'),
51+
);
52+
final packages = ((json.decode(nameRs.body) as Map)['packages'] as List)
53+
.cast<String>();
4754
packages.shuffle();
4855

4956
var count = 0;
5057
var running = true;
5158
final pool = Pool(concurrency);
5259
await Future.wait(
5360
packages.map(
54-
(p) => pool.withResource(
55-
() async {
56-
if (!running) {
57-
return;
58-
}
61+
(p) => pool.withResource(() async {
62+
if (!running) {
63+
return;
64+
}
5965

60-
Future<String> checkContent(String subPath) async {
61-
final uri = Uri.parse('$pubHostedUrl/packages/$p$subPath');
62-
print('GET $uri');
63-
final rs = await client.get(uri);
64-
if (rs.statusCode != 200) {
65-
print('Failed to GET: $uri');
66-
throw StateError('Failed to GET "$uri".');
67-
}
68-
return rs.body;
66+
Future<String> checkContent(String subPath) async {
67+
final uri = Uri.parse('$pubHostedUrl/packages/$p$subPath');
68+
print('GET $uri');
69+
final rs = await client.get(uri);
70+
if (rs.statusCode != 200) {
71+
print('Failed to GET: $uri');
72+
throw StateError('Failed to GET "$uri".');
6973
}
74+
return rs.body;
75+
}
7076

71-
final mainBody = await checkContent('');
72-
if (mainBody.contains('$p/changelog')) {
73-
await checkContent('/changelog');
74-
}
75-
if (mainBody.contains('$p/example')) {
76-
await checkContent('/example');
77-
}
78-
count++;
79-
if (running && limit > 0 && count >= limit) {
80-
print('Limit reached, stopping...');
81-
running = false;
82-
}
83-
},
84-
),
77+
final mainBody = await checkContent('');
78+
if (mainBody.contains('$p/changelog')) {
79+
await checkContent('/changelog');
80+
}
81+
if (mainBody.contains('$p/example')) {
82+
await checkContent('/example');
83+
}
84+
count++;
85+
if (running && limit > 0 && count >= limit) {
86+
print('Limit reached, stopping...');
87+
running = false;
88+
}
89+
}),
8590
),
8691
);
8792
} finally {

app/bin/tools/sdk_search_benchmark.dart

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,18 @@ import 'package:pub_dev/search/sdk_mem_index.dart';
88

99
/// Loads a Dart SDK search snapshot and executes queries on it, benchmarking their total time to complete.
1010
Future<void> main() async {
11-
print('Started. Current memory: ${ProcessInfo.currentRss ~/ 1024} KiB, '
12-
'max memory: ${ProcessInfo.maxRss ~/ 1024} KiB');
11+
print(
12+
'Started. Current memory: ${ProcessInfo.currentRss ~/ 1024} KiB, '
13+
'max memory: ${ProcessInfo.maxRss ~/ 1024} KiB',
14+
);
1315
final index = await createSdkMemIndex();
14-
print('Loaded. Current memory: ${ProcessInfo.currentRss ~/ 1024} KiB, '
15-
'max memory: ${ProcessInfo.maxRss ~/ 1024} KiB');
16+
print(
17+
'Loaded. Current memory: ${ProcessInfo.currentRss ~/ 1024} KiB, '
18+
'max memory: ${ProcessInfo.maxRss ~/ 1024} KiB',
19+
);
1620

1721
// NOTE: please add more queries to this list, especially if there is a performance bottleneck.
18-
final queries = [
19-
'chart',
20-
'json',
21-
'camera',
22-
'android camera',
23-
'sql database',
24-
];
22+
final queries = ['chart', 'json', 'camera', 'android camera', 'sql database'];
2523

2624
final sw = Stopwatch()..start();
2725
var count = 0;
@@ -31,6 +29,8 @@ Future<void> main() async {
3129
}
3230
sw.stop();
3331
print('${(sw.elapsedMilliseconds / count).toStringAsFixed(2)} ms/request');
34-
print('Done. Current memory: ${ProcessInfo.currentRss ~/ 1024} KiB, '
35-
'max memory: ${ProcessInfo.maxRss ~/ 1024} KiB');
32+
print(
33+
'Done. Current memory: ${ProcessInfo.currentRss ~/ 1024} KiB, '
34+
'max memory: ${ProcessInfo.maxRss ~/ 1024} KiB',
35+
);
3636
}

0 commit comments

Comments
 (0)