Commit 6c2bc2ff authored by Luca Burelli's avatar Luca Burelli Committed by Dan Kalowsky
Browse files

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: default avatarLuca Burelli <l.burelli@arduino.cc>
parent cbe07bcb
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -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_")]