Bug 1384241 - Pre: Extract acdefines() helper function. r=gps
authorNick Alexander <nalexander@mozilla.com>
Wed, 26 Jul 2017 19:31:18 -0700
changeset 420477 28a461fb134e1bf57733fedf3a73bcf3e297839e
parent 420476 af665482a57dfbc858da67d9c167c34094fc18ea
child 420478 597ee9bd109727236e2179e11c5141d4cee4d7c2
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1384241
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1384241 - Pre: Extract acdefines() helper function. r=gps MozReview-Commit-ID: 6TstvuluvH3
python/mozbuild/mozbuild/backend/configenvironment.py
python/mozbuild/mozbuild/backend/tup.py
--- a/python/mozbuild/mozbuild/backend/configenvironment.py
+++ b/python/mozbuild/mozbuild/backend/configenvironment.py
@@ -7,17 +7,20 @@ from __future__ import absolute_import
 import os
 import sys
 
 from collections import Iterable
 from types import StringTypes, ModuleType
 
 import mozpack.path as mozpath
 
-from mozbuild.util import ReadOnlyDict
+from mozbuild.util import (
+    memoized_property,
+    ReadOnlyDict,
+)
 from mozbuild.shellutil import quote as shell_quote
 
 
 if sys.version_info.major == 2:
     text_type = unicode
 else:
     text_type = str
 
@@ -189,14 +192,21 @@ class ConfigEnvironment(object):
             self.substs_unicode[k] = v
 
         self.substs_unicode = ReadOnlyDict(self.substs_unicode)
 
     @property
     def is_artifact_build(self):
         return self.substs.get('MOZ_ARTIFACT_BUILDS', False)
 
+    @memoized_property
+    def acdefines(self):
+        acdefines = dict((name, self.defines[name])
+                         for name in self.defines
+                         if name not in self.non_global_defines)
+        return ReadOnlyDict(acdefines)
+
     @staticmethod
     def from_config_status(path):
         config = BuildConfig.from_config_status(path)
 
         return ConfigEnvironment(config.topsrcdir, config.topobjdir,
             config.defines, config.non_global_defines, config.substs, path)
--- a/python/mozbuild/mozbuild/backend/tup.py
+++ b/python/mozbuild/mozbuild/backend/tup.py
@@ -231,21 +231,18 @@ class TupOnly(CommonBackend, PartialBack
 
         for objdir, backend_file in sorted(self._backend_files.items()):
             for obj in backend_file.delayed_generated_files:
                 self._process_generated_file(backend_file, obj)
             with self._write_file(fh=backend_file):
                 pass
 
         with self._write_file(mozpath.join(self.environment.topobjdir, 'Tuprules.tup')) as fh:
-            acdefines = [name for name in self.environment.defines
-                if not name in self.environment.non_global_defines]
-            acdefines_flags = ' '.join(['-D%s=%s' % (name,
-                shell_quote(self.environment.defines[name]))
-                for name in sorted(acdefines)])
+            acdefines_flags = ' '.join(['-D%s=%s' % (name, shell_quote(value))
+                for (name, value) in sorted(self.environment.acdefines.iteritems())])
             # TODO: AB_CD only exists in Makefiles at the moment.
             acdefines_flags += ' -DAB_CD=en-US'
 
             # TODO: BOOKMARKS_INCLUDE_DIR is used by bookmarks.html.in, and is
             # only defined in browser/locales/Makefile.in
             acdefines_flags += ' -DBOOKMARKS_INCLUDE_DIR=%s/browser/locales/en-US/profile' % self.environment.topsrcdir
 
             # Use BUILD_FASTER to avoid CXXFLAGS/CPPFLAGS in