tools: Add env var to filter output configs (fixes #2423)

Adds a new GN_OUT_CONFIGS environment variable that, if specified,
will limit the generated configurations to a list of comma-delimited
values (e.g. "Debug_GN_x64,Release_GN_x64").
This commit is contained in:
Marshall Greenblatt 2024-01-11 13:08:47 -05:00
parent a097b62b6e
commit 0d50d5a8c6
1 changed files with 12 additions and 0 deletions

View File

@ -624,6 +624,18 @@ def GetAllPlatformConfigs(build_args):
result['Release_GN_' + cpu + '_sandbox'] = GetConfigArgsSandbox(
platform, args, False, cpu)
out_configs = os.environ.get('GN_OUT_CONFIGS', None)
if not out_configs is None:
# Only generate the specified configurations.
out_configs = [c.strip() for c in out_configs.split(',')]
for key in list(result.keys()):
if not key in out_configs:
msg('Not generating %s configuration due to GN_OUT_CONFIGS' % key)
del result[key]
if not bool(result):
raise Exception('No supported configurations in GN_OUT_CONFIGS ("%s")' %
','.join(out_configs))
return result