-
Notifications
You must be signed in to change notification settings - Fork 3
Update to Dart 3.11 and analyzer 10 #58
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
Changes from all commits
f4f6d5d
b75c3ee
524b78e
7e1b3ce
d1a9e96
79169cf
ef4bf3f
d9effae
84d7ece
8260ba9
b3ad4be
6ae8807
4d0652a
cbe0054
3bda04c
f13084c
08a3d93
0406b0e
7142c7d
be96618
78f311c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,6 @@ analyzer: | |
| exclude: | ||
| - example/** | ||
| - lib/**.g.dart | ||
| language: | ||
| strict-inference: true | ||
| strict-raw-types: true | ||
|
|
||
| formatter: | ||
| trailing_commas: preserve | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed old unsupported options and added config to keep trailing commas as that reduces the amount of formatting changes |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,22 +8,30 @@ const testPreset = '--preset=browser-aggregate'; | |
|
|
||
| final argParser = ArgParser() | ||
| ..addFlag('help', abbr: 'h') | ||
| ..addFlag('release', | ||
| defaultsTo: false, help: 'Build in release mode (dart2js).') | ||
| ..addOption('mode', | ||
| allowed: ['args', 'build', 'test'], | ||
| allowedHelp: { | ||
| 'args': | ||
| 'Print to stderr the build and test args needed to run browser aggregate tests.\n' | ||
| 'Useful for integrating this into other test runners.', | ||
| 'build': 'Build the browser aggregate tests.', | ||
| 'test': 'Build and run browser aggregate tests.', | ||
| }, | ||
| defaultsTo: 'test') | ||
| ..addOption('build-args', | ||
| help: 'Args to pass to the build runner process.\n' | ||
| 'Run "dart run build_runner build -h -v" to see all available ' | ||
| 'options.'); | ||
| ..addFlag( | ||
| 'release', | ||
| defaultsTo: false, | ||
| help: 'Build in release mode (dart2js).', | ||
| ) | ||
| ..addOption( | ||
| 'mode', | ||
| allowed: ['args', 'build', 'test'], | ||
| allowedHelp: { | ||
| 'args': | ||
| 'Print to stderr the build and test args needed to run browser aggregate tests.\n' | ||
| 'Useful for integrating this into other test runners.', | ||
| 'build': 'Build the browser aggregate tests.', | ||
| 'test': 'Build and run browser aggregate tests.', | ||
| }, | ||
| defaultsTo: 'test', | ||
| ) | ||
| ..addOption( | ||
| 'build-args', | ||
| help: | ||
| 'Args to pass to the build runner process.\n' | ||
| 'Run "dart run build_runner build -h -v" to see all available ' | ||
| 'options.', | ||
| ); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only formatting changes in this file |
||
|
|
||
| enum Mode { | ||
| // Print build and test args separated by `--` | ||
|
|
@@ -95,13 +103,15 @@ void buildAggregateTestYaml(Mode mode, {String? userBuildArgs}) { | |
| // Users may also supply additional build arguments. For example, some | ||
| // repos may need to specify a custom build.yaml file to be used. | ||
| ...?userBuildArgs?.split(' '), | ||
| '--build-filter=dart_test.browser_aggregate.yaml' | ||
| '--build-filter=dart_test.browser_aggregate.yaml', | ||
| ]; | ||
| logIf(mode != Mode.args, 'Building browser aggregate test config...'); | ||
| logIf(mode != Mode.args, '$executable ${args.join(' ')}'); | ||
| var result = Process.runSync(executable, args); | ||
| logIf(result.exitCode != 0 || mode != Mode.args, | ||
| '${result.stderr}\n${result.stdout}'); | ||
| logIf( | ||
| result.exitCode != 0 || mode != Mode.args, | ||
| '${result.stderr}\n${result.stdout}', | ||
| ); | ||
| if (result.exitCode != 0) { | ||
| exit(result.exitCode); | ||
| } | ||
|
|
@@ -116,24 +126,29 @@ List<String> parseAggregateTestPaths(Mode mode) { | |
| logIf(mode != Mode.args, '\nReading browser aggregate test config...'); | ||
| final configFile = File('dart_test.browser_aggregate.yaml'); | ||
| if (!configFile.existsSync()) { | ||
| stdout | ||
| .writeln(r'''browser aggregation is not enabled. Update your build.yaml: | ||
| stdout.writeln( | ||
| r'''browser aggregation is not enabled. Update your build.yaml: | ||
|
|
||
| # build.yaml | ||
| targets: | ||
| $default: | ||
| builders: | ||
| test_html_builder: | ||
| options: | ||
| browser_aggregation: true'''); | ||
| browser_aggregation: true''', | ||
| ); | ||
| exit(1); | ||
| } | ||
|
|
||
| final config = | ||
| loadYaml(configFile.readAsStringSync(), sourceUrl: configFile.uri); | ||
| final config = loadYaml( | ||
| configFile.readAsStringSync(), | ||
| sourceUrl: configFile.uri, | ||
| ); | ||
| late List<String> paths; | ||
| try { | ||
| paths = List<String>.from(config['presets']['browser-aggregate']['paths']); | ||
| paths = List<String>.from( | ||
| config['presets']['browser-aggregate']['paths'], | ||
| ); | ||
| } catch (e, stack) { | ||
| stdout | ||
| ..writeln('Failed to read test paths from "${configFile.uri}"') | ||
|
|
@@ -152,68 +167,89 @@ targets: | |
| /// | ||
| /// [userBuildArgs] is interpreted as a space delimited string of additional | ||
| /// build_runner build arguments and will also be included. | ||
| List<String> buildRunnerBuildArgs(List<String> testPaths, | ||
| {bool? release, String? userBuildArgs}) => | ||
| [ | ||
| ...?userBuildArgs?.split(' '), | ||
| if (release ?? false) '--release', | ||
| for (final path in testPaths) | ||
| '--build-filter=${p.setExtension(path, '.**')}', | ||
| ]; | ||
| List<String> buildRunnerBuildArgs( | ||
| List<String> testPaths, { | ||
| bool? release, | ||
| String? userBuildArgs, | ||
| }) => [ | ||
| ...?userBuildArgs?.split(' '), | ||
| if (release ?? false) '--release', | ||
| for (final path in testPaths) '--build-filter=${p.setExtension(path, '.**')}', | ||
| ]; | ||
|
|
||
| /// Builds aggregate tests at [testPaths]. | ||
| /// | ||
| /// Includes `--release` if [release] is true. | ||
| Future<void> buildTests(List<String> testPaths, | ||
| {bool? release, String? userBuildArgs}) async { | ||
| Future<void> buildTests( | ||
| List<String> testPaths, { | ||
| bool? release, | ||
| String? userBuildArgs, | ||
| }) async { | ||
| final executable = 'dart'; | ||
| final args = [ | ||
| 'run', | ||
| 'build_runner', | ||
| 'build', | ||
| '--delete-conflicting-outputs', | ||
| ...buildRunnerBuildArgs(testPaths, | ||
| release: release, userBuildArgs: userBuildArgs), | ||
| ...buildRunnerBuildArgs( | ||
| testPaths, | ||
| release: release, | ||
| userBuildArgs: userBuildArgs, | ||
| ), | ||
| ]; | ||
| stdout | ||
| ..writeln() | ||
| ..writeln('Building browser aggregate tests...') | ||
| ..writeln('$executable ${args.join(' ')}'); | ||
| final process = await Process.start(executable, args, | ||
| mode: ProcessStartMode.inheritStdio); | ||
| final process = await Process.start( | ||
| executable, | ||
| args, | ||
| mode: ProcessStartMode.inheritStdio, | ||
| ); | ||
| exitCode = await process.exitCode; | ||
| } | ||
|
|
||
| /// Builds and runs aggregate tests at [testPaths]. | ||
| /// | ||
| /// Includes `--release` if [release] is true. | ||
| Future<void> runTests(List<String> testPaths, | ||
| {bool? release, String? userBuildArgs}) async { | ||
| Future<void> runTests( | ||
| List<String> testPaths, { | ||
| bool? release, | ||
| String? userBuildArgs, | ||
| }) async { | ||
| final executable = 'dart'; | ||
| final args = [ | ||
| 'run', | ||
| 'build_runner', | ||
| 'test', | ||
| ...buildRunnerBuildArgs(testPaths, | ||
| release: release, userBuildArgs: userBuildArgs), | ||
| ...buildRunnerBuildArgs( | ||
| testPaths, | ||
| release: release, | ||
| userBuildArgs: userBuildArgs, | ||
| ), | ||
| '--', | ||
| testPreset, | ||
| ]; | ||
| stdout | ||
| ..writeln() | ||
| ..writeln('Running browser aggregate tests...') | ||
| ..writeln('$executable ${args.join(' ')}'); | ||
| final process = await Process.start(executable, args, | ||
| mode: ProcessStartMode.inheritStdio); | ||
| final process = await Process.start( | ||
| executable, | ||
| args, | ||
| mode: ProcessStartMode.inheritStdio, | ||
| ); | ||
| exitCode = await process.exitCode; | ||
| } | ||
|
|
||
| /// Prints the build and test args separated by `--` needed to build or run the | ||
| /// browser aggregate tests. | ||
| void printArgs(List<String> testPaths) { | ||
| stdout.write([ | ||
| ...buildRunnerBuildArgs(testPaths), | ||
| '--', | ||
| testPreset, | ||
| ].join(' ')); | ||
| stdout.write( | ||
| [ | ||
| ...buildRunnerBuildArgs(testPaths), | ||
| '--', | ||
| testPreset, | ||
| ].join(' '), | ||
| ); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format before format check is needed for consistency between CI/local