Bug 902825 - Change ALLSUBSTS to GLOBAL_SUBSTS; r?glandium draft
authorMike Shal <mshal@mozilla.com>
Wed, 04 Oct 2017 16:23:10 -0400
changeset 675775 efbf131008f7c62ede3654fdaf11750f164fe222
parent 675774 3b65a1496653b0768a6b973cdf923d531d8dd33c
child 675776 06de8d4404ccb85aa21d18ea808d3be4e51e5887
push id83240
push userbmo:mshal@mozilla.com
push dateThu, 05 Oct 2017 21:34:38 +0000
reviewersglandium
bugs902825
milestone58.0a1
Bug 902825 - Change ALLSUBSTS to GLOBAL_SUBSTS; r?glandium Non-global config items are those that are excluded from GLOBAL_SUBSTS and GLOBAL_DEFINES. Now that ALLSUBSTS no longer contains all the substs, we change its name to GLOBAL_SUBSTS to make the intent more apparent. By removing non-global items from ALLSUBSTS, we can avoid touching autoconf.mk and needlessly rebuilding world when a subst changes. MozReview-Commit-ID: 7BSYF4f7r1E
config/autoconf-js.mk.in
config/autoconf.mk.in
python/mozbuild/mozbuild/backend/configenvironment.py
python/mozbuild/mozbuild/test/backend/test_configenvironment.py
--- a/config/autoconf-js.mk.in
+++ b/config/autoconf-js.mk.in
@@ -1,6 +1,6 @@
 ifndef INCLUDED_AUTOCONF_MK
 INCLUDED_AUTOCONF_MK = autoconf-js.mk
 include $(DEPTH)/config/emptyvars-js.mk
-@ALLSUBSTS@
+@GLOBAL_SUBSTS@
 include $(topsrcdir)/config/baseconfig.mk
 endif
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -1,6 +1,6 @@
 ifndef INCLUDED_AUTOCONF_MK
 INCLUDED_AUTOCONF_MK = autoconf.mk
 include $(DEPTH)/config/emptyvars.mk
-@ALLSUBSTS@
+@GLOBAL_SUBSTS@
 include $(topsrcdir)/config/baseconfig.mk
 endif
--- a/python/mozbuild/mozbuild/backend/configenvironment.py
+++ b/python/mozbuild/mozbuild/backend/configenvironment.py
@@ -98,20 +98,20 @@ class ConfigEnvironment(object):
       - substs is a dict filled from AC_SUBST in autoconf.
 
     ConfigEnvironment automatically defines one additional substs variable
     from all the defines not appearing in non_global_config:
       - ACDEFINES contains the defines in the form -DNAME=VALUE, for use on
         preprocessor command lines. The order in which defines were given
         when creating the ConfigEnvironment is preserved.
     and two other additional subst variables from all the other substs:
-      - ALLSUBSTS contains the substs in the form NAME = VALUE, in sorted
+      - GLOBAL_SUBSTS contains the substs in the form NAME = VALUE, in sorted
         order, for use in autoconf.mk. It includes ACDEFINES
-        Only substs with a VALUE are included, such that the resulting file
-        doesn't change when new empty substs are added.
+        Only global substs with a VALUE are included, such that the resulting
+        file doesn't change when new empty substs are added.
         This results in less invalidation of build dependencies in the case
         of autoconf.mk..
       - ALLEMPTYSUBSTS contains the substs with an empty value, in the form
         NAME =.
 
     ConfigEnvironment expects a "top_srcdir" subst to be set with the top
     source directory, in msys format on windows. It is used to derive a
     "srcdir" subst when treating config files. It can either be an absolute
@@ -152,18 +152,19 @@ class ConfigEnvironment(object):
             shell_quote(self.defines[name]).replace('$', '$$'))
             for name in sorted(global_defines)])
         def serialize(name, obj):
             if isinstance(obj, StringTypes):
                 return obj
             if isinstance(obj, Iterable):
                 return ' '.join(obj)
             raise Exception('Unhandled type %s for %s', type(obj), str(name))
-        self.substs['ALLSUBSTS'] = '\n'.join(sorted(['%s = %s' % (name,
-            serialize(name, self.substs[name])) for name in self.substs if self.substs[name]]))
+        self.substs['GLOBAL_SUBSTS'] = '\n'.join(sorted(['%s = %s' % (name,
+            serialize(name, self.substs[name])) for name in self.substs if self.substs[name] and
+            name not in self.non_global_config]))
         self.substs['ALLEMPTYSUBSTS'] = '\n'.join(sorted(['%s =' % name
             for name in self.substs if not self.substs[name]]))
 
         self.substs = ReadOnlyDict(self.substs)
 
         self.external_source_dir = None
         external = self.substs.get('EXTERNAL_SOURCE_DIR', '')
         if external:
--- a/python/mozbuild/mozbuild/test/backend/test_configenvironment.py
+++ b/python/mozbuild/mozbuild/test/backend/test_configenvironment.py
@@ -30,31 +30,31 @@ class ConfigEnvironment(ConfigStatus.Con
 
             d = dict(self.substs_unicode)
             d[u'top_srcdir'] = top_srcdir.decode('utf-8')
             self.substs_unicode = ReadOnlyDict(d)
 
 
 class TestEnvironment(unittest.TestCase):
     def test_auto_substs(self):
-        '''Test the automatically set values of ACDEFINES, ALLSUBSTS
+        '''Test the automatically set values of ACDEFINES, GLOBAL_SUBSTS
         and ALLEMPTYSUBSTS.
         '''
         env = ConfigEnvironment('.', '.',
                   defines = { 'foo': 'bar', 'baz': 'qux 42',
                               'abc': "d'e'f", 'extra': 'foobar' },
                   non_global_config = ['extra', 'ignore'],
                   substs = { 'FOO': 'bar', 'FOOBAR': '', 'ABC': 'def',
                              'bar': 'baz qux', 'zzz': '"abc def"',
                              'qux': '' })
         # non_global_config should be filtered out in ACDEFINES.
         # Original order of the defines need to be respected in ACDEFINES
         self.assertEqual(env.substs['ACDEFINES'], """-Dabc='d'\\''e'\\''f' -Dbaz='qux 42' -Dfoo=bar""")
-        # Likewise for ALLSUBSTS, which also must contain ACDEFINES
-        self.assertEqual(env.substs['ALLSUBSTS'], '''ABC = def
+        # Likewise for GLOBAL_SUBSTS, which also must contain ACDEFINES
+        self.assertEqual(env.substs['GLOBAL_SUBSTS'], '''ABC = def
 ACDEFINES = -Dabc='d'\\''e'\\''f' -Dbaz='qux 42' -Dfoo=bar
 FOO = bar
 bar = baz qux
 zzz = "abc def"''')
         # ALLEMPTYSUBSTS contains all substs with no value.
         self.assertEqual(env.substs['ALLEMPTYSUBSTS'], '''FOOBAR =
 qux =''')