Browse Source

west build: warn about conditional flags in 'extra_configs'

The 'west build' command does not know about conditional flags (in the
format 'type:value:CONFIG_FOO=bar') in the 'extra_configs' argument of
Twister testcase.yaml files, and currently converts them to malformed
arguments that are silently ignored by cmake.

This change adds a check to 'west build' to clearly warn the user if the
'extra_configs' list contains conditional flags and provide a hint on
how to add them to the CMake command line.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
pull/80998/head
Luca Burelli 8 months ago committed by Dan Kalowsky
parent
commit
6c2bc2ff37
  1. 14
      scripts/west_commands/build.py

14
scripts/west_commands/build.py

@ -361,7 +361,19 @@ class Build(Forceable): @@ -361,7 +361,19 @@ class Build(Forceable):
arg_list = extra
if data == 'extra_configs':
args = ["-D{}".format(arg.replace('"', '\"')) for arg in arg_list]
args = []
for arg in arg_list:
equals = arg.find('=')
colon = arg.rfind(':', 0, equals)
if colon != -1:
# conditional configs (xxx:yyy:CONFIG_FOO=bar)
# are not supported by 'west build'
self.wrn('"west build" does not support '
'conditional config "{}". Add "-D{}" '
'to the supplied CMake arguments if '
'desired.'.format(arg, arg[colon+1:]))
continue
args.append("-D{}".format(arg.replace('"', '\"')))
elif data == 'extra_args':
# Retain quotes around config options
config_options = [arg for arg in arg_list if arg.startswith("CONFIG_")]

Loading…
Cancel
Save