Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@matanlurey
Copy link
Contributor

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 --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.

Copy link
Member

@gaaclarke gaaclarke left a 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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}) : extaGnArgs = List.unmodifiable(extraGnArgs) {
}) : extraGnArgs = List.unmodifiable(extraGnArgs) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thank you!

Comment on lines 128 to 129
'Both --rbe and --lto (and their --no-x variants) should be '
'specified as direct arguments to "et" and not using "--gn-args".',
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Comment on lines +550 to +569
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,
);
Copy link
Member

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?

Copy link
Contributor Author

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']),
Copy link
Member

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 --?

Copy link
Contributor Author

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'),
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment on lines 117 to 118
'Arguments provided to --gn-args must be flags (booleans) and be '
'specified as either in the format "--flag". Options that are not '
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup! Thanks, done!

Comment on lines 266 to 279
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);
}
Copy link
Member

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.

Copy link
Contributor Author

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.');
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

@gaaclarke gaaclarke left a 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 = {
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@matanlurey matanlurey added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 30, 2024
@auto-submit
Copy link
Contributor

auto-submit bot commented Oct 30, 2024

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.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 30, 2024
@matanlurey matanlurey added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 30, 2024
@auto-submit auto-submit bot merged commit 1c488c7 into flutter:main Oct 30, 2024
30 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 30, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 30, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 31, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 31, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Oct 31, 2024
…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
nick9822 pushed a commit to nick9822/flutter that referenced this pull request Dec 18, 2024
…#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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a --gn-args (or similar) to forward from et to gn

4 participants