-
Notifications
You must be signed in to change notification settings - Fork 6k
Add and use mergeGnArgs with --gn-args from et.
#56228
Conversation
gaaclarke
left a comment
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.
lgtm, only things I'd change is fix the name typo and remove some of the duplication to the test
| required this.concurrency, | ||
| }) { | ||
| required Iterable<String> extraGnArgs, | ||
| }) : extaGnArgs = List.unmodifiable(extraGnArgs) { |
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.
| }) : extaGnArgs = List.unmodifiable(extraGnArgs) { | |
| }) : extraGnArgs = List.unmodifiable(extraGnArgs) { |
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.
Done, thank you!
| 'Both --rbe and --lto (and their --no-x variants) should be ' | ||
| 'specified as direct arguments to "et" and not using "--gn-args".', |
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.
nit: the error message should probably be generated from reservedGnArgs
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.
Done!
| final testEnv = TestEnvironment.withTestEngine(); | ||
| addTearDown(testEnv.cleanup); | ||
|
|
||
| final testConfig = TestBuilderConfig(); | ||
| testConfig.addBuild( | ||
| name: 'linux/host_debug', | ||
| dimension: TestDroneDimension.linux, | ||
| ); | ||
|
|
||
| final parser = ArgParser(); | ||
| final builds = BuildPlan.configureArgParser( | ||
| parser, | ||
| testEnv.environment, | ||
| configs: { | ||
| 'linux_test_config': testConfig.buildConfig( | ||
| path: 'ci/builders/linux_test_config.json', | ||
| ), | ||
| }, | ||
| help: false, | ||
| ); |
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.
This whole section is duplicated across tests, can we factor it out?
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.
As this PR is a net positive and unblocks the Dart SDK team, let me land as-is and I'll follow-up shortly in flutter/flutter#157870.
| ); | ||
|
|
||
| final result = BuildPlan.fromArgResults( | ||
| parser.parse(['--gn-args', '--foo', '--gn-args', '--bar']), |
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.
The arg parser doesn't support this being something like --gn-args --foo --bar --?
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.
It does not.
| throwsA(isA<FatalError>().having( | ||
| (e) => e.toString(), | ||
| 'toString()', | ||
| contains('Arguments provided to --gn-args must be'), |
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.
nit: pull this text into a variable or don't assert the text so it isn't duplicated here. It's nice when there is a single place people can update the text.
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.
Done.
| 'Arguments provided to --gn-args must be flags (booleans) and be ' | ||
| 'specified as either in the format "--flag". Options that are not ' |
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.
Did you mean to say either --flag or --no-flag here?
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.
Yup! Thanks, done!
| bool _isFlag(String arg) { | ||
| return !arg.contains('=') && !arg.contains(' ') && !arg.startsWith('--'); | ||
| } | ||
|
|
||
| (String, bool) _extractRawFlag(String flagArgument) { | ||
| assert(flagArgument.startsWith('--'), 'Must be a valid flag argument.'); | ||
| var rawFlag = flagArgument.substring(2); | ||
| var flagValue = true; | ||
| if (rawFlag.startsWith('no-')) { | ||
| rawFlag = rawFlag.substring(3); | ||
| flagValue = false; | ||
| } | ||
| return (rawFlag, flagValue); | ||
| } |
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.
Looks like these were moved to another file, and need to be deleted here.
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.
Done.
| } | ||
|
|
||
| (String, bool) _extractRawFlag(String flagArgument) { | ||
| assert(_isFlag(flagArgument), 'Must be a valid flag argument.'); |
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.
et doesn't run with asserts enabled, IIRC, but I think tests are run with asserts enabled? With that setup, is there a test that will hit this assert? Should this be throwing an ArgumentError instead of asserting?
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.
Tests are run, but this assertion is stale - it's handled above. Removed.
gaaclarke
left a comment
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.
lgtm!
| /// | ||
| /// Instead, provide them explicitly as other [BuildPlan] arguments. | ||
| @visibleForTesting | ||
| static const reservedGnArgs = { |
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.
do we have a map of "bad flag" -> "et flag"? that might help whoever is running et --extraflags
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.
In this particular case, the arguments are identical.
I can clarify that in the error message and leave a breadcrumb that if we expand this list to ensure it's clear to the user.
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.
Done!
|
auto label is removed for flutter/engine/56228, due to - The status or check suite Linux linux_unopt has failed. Please fix the issues identified (or deflake) before re-applying this label. |
…157893) flutter/engine@9295eeb...090c33a 2024-10-30 skia-flutter-autoroll@skia.org Roll Skia from 85b77db25fa3 to 3c62d4a94d78 (1 revision) (flutter/engine#56248) 2024-10-30 skia-flutter-autoroll@skia.org Roll Dart SDK from 4566845d8e30 to 6a8058eef22c (1 revision) (flutter/engine#56246) 2024-10-30 skia-flutter-autoroll@skia.org Roll Skia from f334411b0a08 to 85b77db25fa3 (5 revisions) (flutter/engine#56245) 2024-10-30 matanlurey@users.noreply.github.com Add and use `mergeGnArgs` with `--gn-args` from `et`. (flutter/engine#56228) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC chinmaygarde@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…#56228) Closes flutter#156909. This PR adds (and implements) the `--gn-args` (extra command-line GN args) functionality by generalizing on the concept of "merged" GN args that @zanderso had special-cased for `--lto` and `--rbe`, and further testing it. There is also a logical place for us to expand support of merged arguments at a future point in time.
Closes flutter/flutter#156909.
This PR adds (and implements) the
--gn-args(extra command-line GN args) functionality by generalizing on the concept of "merged" GN args that @zanderso had special-cased for--ltoand--rbe, and further testing it.There is also a logical place for us to expand support of merged arguments at a future point in time.