Skip to content

Commit 6b1dfa7

Browse files
authored
[infra] Toplevel analysis options (dart-lang#3084)
1 parent ed8075b commit 6b1dfa7

3 files changed

Lines changed: 21 additions & 8 deletions

File tree

‎analysis_options.yaml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
include: package:dart_flutter_team_lints/analysis_options.yaml
2+
13
formatter:
24
trailing_commas: preserve

‎pubspec.yaml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ workspace:
118118
# - pkgs/swiftgen # TODO
119119
# - pkgs/swiftgen/example # TODO
120120

121+
# Used in tool/
122+
dev_dependencies:
123+
args: ^2.7.0
124+
dart_flutter_team_lints: ^3.5.2
125+
yaml: ^3.1.3
126+
121127
# Hook user-defines are specified in the pub workspace.
122128
hooks:
123129
user_defines:

‎tool/ci.dart‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
import 'dart:io';
65
import 'dart:ffi';
6+
import 'dart:io';
77

88
import 'package:args/args.dart';
99
import 'package:yaml/yaml.dart';
1010

1111
void main(List<String> arguments) async {
1212
final parser = makeArgParser();
1313

14-
final ArgResults argResults = parser.parse(arguments);
14+
final argResults = parser.parse(arguments);
1515

1616
final packages = loadPackagesFromPubspec();
1717

@@ -69,9 +69,9 @@ ArgParser makeArgParser() {
6969
/// task's name, its default state, and the help message for its corresponding
7070
/// command-line flag.
7171
///
72-
/// The main execution loop iterates through a list of [Task] instances. For each
73-
/// instance, it uses [shouldRun] to determine if the task should be executed
74-
/// based on the command-line flags, and if so, calls the [run] method.
72+
/// The main execution loop iterates through a list of [Task] instances. For
73+
/// each instance, it uses [shouldRun] to determine if the task should be
74+
/// executed based on the command-line flags, and if so, calls the [run] method.
7575
abstract class Task {
7676
/// The name of the task, used for the command-line flag.
7777
///
@@ -151,7 +151,12 @@ class AnalyzeTask extends Task {
151151
required List<String> packages,
152152
required ArgResults argResults,
153153
}) async {
154-
await _runProcess('dart', ['analyze', '--fatal-infos', ...packages]);
154+
await _runProcess('dart', [
155+
'analyze',
156+
'--fatal-infos',
157+
...packages,
158+
'tool',
159+
]);
155160
}
156161
}
157162

@@ -364,7 +369,7 @@ List<String> loadPackagesFromPubspec() {
364369
final pubspecYaml = loadYaml(
365370
File.fromUri(repositoryRoot.resolve('pubspec.yaml')).readAsStringSync(),
366371
);
367-
final workspace = (pubspecYaml['workspace'] as List).cast<String>();
372+
final workspace = ((pubspecYaml as Map)['workspace'] as List).cast<String>();
368373
final packages = workspace
369374
.where(
370375
(package) =>
@@ -426,7 +431,7 @@ Future<void> _runProcess(
426431
final exitCode = await process.exitCode;
427432

428433
if (exitCode != 0) {
429-
print('+$commandString failed with exitCode ${exitCode}.');
434+
print('+$commandString failed with exitCode $exitCode.');
430435
exit(exitCode);
431436
}
432437
}

0 commit comments

Comments
 (0)