From 9620755ff7db9c2614ea1929fcc95bec22734cd0 Mon Sep 17 00:00:00 2001 From: Niklas Claesson Date: Wed, 13 Jun 2018 21:51:32 +0200 Subject: Print default option values that don't match the current value --- mesonbuild/interpreter.py | 18 ++++++++++++++++-- mesonbuild/mesonmain.py | 5 +++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 605eecb..d008eb9 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1855,6 +1855,7 @@ class Interpreter(InterpreterBase): self.default_project_options = default_project_options.copy() else: self.default_project_options = {} + self.project_default_options = {} self.build_func_dict() # build_def_files needs to be defined before parse_project is called self.build_def_files = [os.path.join(self.subdir, environment.build_filename)] @@ -1874,6 +1875,18 @@ class Interpreter(InterpreterBase): else: self.builtin['target_machine'] = self.builtin['host_machine'] + def get_non_matching_default_options(self): + env = self.environment + for def_opt_name, def_opt_value in self.project_default_options.items(): + for option_type in [ + env.coredata.builtins, env.coredata.compiler_options, + env.coredata.backend_options, env.coredata.base_options, + env.coredata.user_options]: + for cur_opt_name, cur_opt_value in option_type.items(): + if (def_opt_name == cur_opt_name and + def_opt_value != cur_opt_value.value): + yield (def_opt_name, def_opt_value, cur_opt_value.value) + def build_func_dict(self): self.funcs.update({'add_global_arguments': self.func_add_global_arguments, 'add_project_arguments': self.func_add_project_arguments, @@ -2377,9 +2390,10 @@ external dependencies (including libraries) must go to "dependencies".''') # values previously set from command line. That means that changing # default_options in a project will trigger a reconfigure but won't # have any effect. + self.project_default_options = mesonlib.stringlistify(kwargs.get('default_options', [])) + self.project_default_options = coredata.create_options_dict(self.project_default_options) if self.environment.first_invocation: - default_options = mesonlib.stringlistify(kwargs.get('default_options', [])) - default_options = coredata.create_options_dict(default_options) + default_options = self.project_default_options default_options.update(self.default_project_options) else: default_options = {} diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index a4406be..b70fd61 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -141,6 +141,11 @@ class MesonApp: profile.runctx('intr.run()', globals(), locals(), filename=fname) else: intr.run() + # Print all default option values that don't match the current value + for def_opt_name, def_opt_value, cur_opt_value in intr.get_non_matching_default_options(): + mlog.log('Option', mlog.bold(def_opt_name), 'is:', + mlog.bold(str(cur_opt_value)), + '[default: {}]'.format(str(def_opt_value))) try: dumpfile = os.path.join(env.get_scratch_dir(), 'build.dat') # We would like to write coredata as late as possible since we use the existence of -- cgit v1.1