From 7d0c4c5ab6760e4487230f9eda87c352609be553 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 18 Mar 2020 08:25:19 +0200 Subject: Pattern-type config.** variables with global visibility by default --- libbuild2/context.cxx | 85 +++++++++++++++++++++++++-------------------------- 1 file changed, 42 insertions(+), 43 deletions(-) (limited to 'libbuild2/context.cxx') diff --git a/libbuild2/context.cxx b/libbuild2/context.cxx index 827894b..724a16e 100644 --- a/libbuild2/context.cxx +++ b/libbuild2/context.cxx @@ -476,65 +476,64 @@ namespace build2 // Enter builtin variables and patterns. // + const auto v_g (variable_visibility::normal); // Global. + const auto v_p (variable_visibility::project); + const auto v_t (variable_visibility::target); + const auto v_q (variable_visibility::prereq); - // All config.* variables are by default overridable. + // All config.** variables are by default overridable with global + // visibility. // - vp.insert_pattern ("config.**", nullopt, true, nullopt, true, false); + // For the config.**.configured semantics, see config::unconfigured(). + // + vp.insert_pattern ("config.**", nullopt, true, v_g, true, false); + vp.insert_pattern ("config.**.configured", false, v_p); // file.cxx:import() (note that order is important; see insert_pattern()). // - vp.insert_pattern ( - "config.import.*", true, variable_visibility::normal, true); - vp.insert_pattern ( - "config.import.**", true, variable_visibility::normal, true); + vp.insert_pattern ("config.import.*", true, v_g, true); + vp.insert_pattern ("config.import.**", true, v_g, true); // module.cxx:boot/init_module(). // - { - auto v_p (variable_visibility::project); - - vp.insert_pattern ("**.booted", false, v_p); - vp.insert_pattern ("**.loaded", false, v_p); - vp.insert_pattern ("**.configured", false, v_p); - } - - { - auto v_p (variable_visibility::project); - auto v_t (variable_visibility::target); - auto v_q (variable_visibility::prereq); + // Note that we also have the config..configured variable (see + // above). + // + vp.insert_pattern ("**.booted", false /* overridable */, v_p); + vp.insert_pattern ("**.loaded", false, v_p); + vp.insert_pattern ("**.configured", false, v_p); - var_src_root = &vp.insert ("src_root"); - var_out_root = &vp.insert ("out_root"); - var_src_base = &vp.insert ("src_base"); - var_out_base = &vp.insert ("out_base"); + var_src_root = &vp.insert ("src_root"); + var_out_root = &vp.insert ("out_root"); + var_src_base = &vp.insert ("src_base"); + var_out_base = &vp.insert ("out_base"); - var_forwarded = &vp.insert ("forwarded", v_p); + var_forwarded = &vp.insert ("forwarded", v_p); - // Note that subprojects is not typed since the value requires - // pre-processing (see file.cxx). - // - var_project = &vp.insert ("project", v_p); - var_amalgamation = &vp.insert ("amalgamation", v_p); - var_subprojects = &vp.insert ("subprojects", v_p); - var_version = &vp.insert ("version", v_p); + // Note that subprojects is not typed since the value requires + // pre-processing (see file.cxx). + // + var_project = &vp.insert ("project", v_p); + var_amalgamation = &vp.insert ("amalgamation", v_p); + var_subprojects = &vp.insert ("subprojects", v_p); + var_version = &vp.insert ("version", v_p); - var_project_url = &vp.insert ("project.url", v_p); - var_project_summary = &vp.insert ("project.summary", v_p); + var_project_url = &vp.insert ("project.url", v_p); + var_project_summary = &vp.insert ("project.summary", v_p); - var_import_target = &vp.insert ("import.target"); + var_import_target = &vp.insert ("import.target"); - var_extension = &vp.insert ("extension", v_t); - var_clean = &vp.insert ("clean", v_t); - var_backlink = &vp.insert ("backlink", v_t); - var_include = &vp.insert ("include", v_q); + var_extension = &vp.insert ("extension", v_t); + var_clean = &vp.insert ("clean", v_t); + var_backlink = &vp.insert ("backlink", v_t); + var_include = &vp.insert ("include", v_q); - // Backlink executables and (generated) documentation by default. - // - gs.target_vars[exe::static_type]["*"].assign (var_backlink) = "true"; - gs.target_vars[doc::static_type]["*"].assign (var_backlink) = "true"; + // Backlink executables and (generated) documentation by default. + // + gs.target_vars[exe::static_type]["*"].assign (var_backlink) = "true"; + gs.target_vars[doc::static_type]["*"].assign (var_backlink) = "true"; - var_build_meta_operation = &vp.insert ("build.meta_operation"); - } + var_build_meta_operation = &vp.insert ("build.meta_operation"); // Register builtin rules. // -- cgit v1.1