Bug 902825 - Add non_global() to set non-global variables in moz.configure; r?glandium draft
authorMike Shal <mshal@mozilla.com>
Wed, 04 Oct 2017 16:19:18 -0400
changeset 675774 3b65a1496653b0768a6b973cdf923d531d8dd33c
parent 675773 93b87c6825c3e1c6831dc4f7e6590e677ed9dd56
child 675775 efbf131008f7c62ede3654fdaf11750f164fe222
push id83240
push userbmo:mshal@mozilla.com
push dateThu, 05 Oct 2017 21:34:38 +0000
reviewersglandium
bugs902825
milestone58.0a1
Bug 902825 - Add non_global() to set non-global variables in moz.configure; r?glandium In order to mark certain config items as non-global, we need a mechanism to create them in moz.configure and combine it with the list of those from old-configure. MozReview-Commit-ID: FpCjTm2saLF
build/moz.configure/old.configure
python/mozbuild/mozbuild/configure/__init__.py
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -384,29 +384,34 @@ def old_configure(prepare_configure, ext
 def set_old_configure_config(name, value):
     __sandbox__.set_config_impl(name, value)
 
 # Same as set_old_configure_config, but for set_define.
 @imports('__sandbox__')
 def set_old_configure_define(name, value):
     __sandbox__.set_define_impl(name, value)
 
+# Same as set_old_configure_config, but for non_global.
+@imports('__sandbox__')
+def set_old_configure_non_global(name):
+    __sandbox__.non_global_impl(name)
+
 
 @depends(old_configure)
 @imports('types')
 def post_old_configure(raw_config):
     for k, v in raw_config['substs']:
         set_old_configure_config(
             k[1:-1], v[1:-1] if isinstance(v, types.StringTypes) else v)
 
     for k, v in dict(raw_config['defines']).iteritems():
         set_old_configure_define(k[1:-1], v[1:-1])
 
-    set_old_configure_config('non_global_config',
-                             raw_config['non_global_config'])
+    for k in raw_config['non_global_config']:
+        set_old_configure_non_global(k)
 
 
 # Assuming no other option is declared after this function, handle the
 # env options that were injected by mozconfig_options by creating dummy
 # Option instances and having the sandbox's CommandLineHelper handle
 # them. We only do so for options that haven't been declared so far,
 # which should be a proxy for the options that old-configure handles
 # and that we don't know anything about.
--- a/python/mozbuild/mozbuild/configure/__init__.py
+++ b/python/mozbuild/mozbuild/configure/__init__.py
@@ -859,16 +859,20 @@ class ConfigureSandbox(dict):
         explicitly undefined (-U).
         '''
         when = self._normalize_when(when, 'set_define')
 
         defines = self._config.setdefault('DEFINES', {})
         self._execution_queue.append((
             self._resolve_and_set, (defines, name, value, when)))
 
+    def non_global_impl(self, name):
+        non_global_config = self._config.setdefault('non_global_config', [])
+        non_global_config.append(name)
+
     def imply_option_impl(self, option, value, reason=None, when=None):
         '''Implementation of imply_option().
         Injects additional options as if they had been passed on the command
         line. The `option` argument is a string as in option()'s `name` or
         `env`. The option must be declared after `imply_option` references it.
         The `value` argument indicates the value to pass to the option.
         It can be:
         - True. In this case `imply_option` injects the positive option