allow supplying custom gn args in gn wrapper (flutter/engine#41794)

allows to supply gn args that do not have their cli switches (yet), like this:
```sh
python3 ./tools/gn --gn-args 'use_default_linux_sysroot=false'
```

*List which issues are fixed by this PR. You must list at least one issue.*
https://github.com/flutter/flutter/issues/126197

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
lauren n. liberda 2023-05-11 22:13:50 +02:00 committed by GitHub
parent 3b10a111f4
commit 998f826cb9

View File

@ -1116,6 +1116,14 @@ def parse_args(args):
# Verbose output.
parser.add_argument('--verbose', default=False, action='store_true')
parser.add_argument(
'--gn-args',
action='append',
help='Additional gn args to be passed to gn. If you '
'need to use this, it should probably be another switch '
'in //flutter/tools/gn.',
)
return parser.parse_args(args)
@ -1171,6 +1179,7 @@ def main(argv):
command.append('--export-compile-commands=default')
gn_args = to_command_line(to_gn_args(args))
gn_args.extend(args.gn_args or [])
out_dir = get_out_dir(args)
command.append(out_dir)
command.append('--args=%s' % ' '.join(gn_args))