Bug 1394734 - Update mozbuild to reflect the removal of GNU_CC / _MSC_VER r?glandium draft
authorSylvestre Ledru <sledru@mozilla.com>
Mon, 04 Sep 2017 16:13:28 +0200
changeset 658732 1d14233b3b19b54d68c69e9ab28a349298da2c23
parent 658695 6e813ab64ec4e4138b953cd6eedc8fd3e3bc822b
child 729739 f2540acf5db854d9d7e84ffea2da237d7f438714
push id77858
push userbmo:sledru@mozilla.com
push dateMon, 04 Sep 2017 18:41:39 +0000
reviewersglandium
bugs1394734
milestone57.0a1
Bug 1394734 - Update mozbuild to reflect the removal of GNU_CC / _MSC_VER r?glandium MozReview-Commit-ID: 9Y8DuUXXjZG
python/mozbuild/mozbuild/action/test_archive.py
python/mozbuild/mozbuild/frontend/data.py
python/mozbuild/mozbuild/frontend/emitter.py
python/mozbuild/mozbuild/frontend/gyp_reader.py
--- a/python/mozbuild/mozbuild/action/test_archive.py
+++ b/python/mozbuild/mozbuild/action/test_archive.py
@@ -440,17 +440,17 @@ ARCHIVE_FILES = {
             'base': 'build',
             'pattern': 'automation.py',
             'dest': 'xpcshell',
         },
     ],
 }
 
 
-if buildconfig.substs.get('MOZ_ASAN') and buildconfig.substs.get('CLANG_CL'):
+if buildconfig.substs.get('MOZ_ASAN') and buildconfig.substs.get('CC_TYPE') == 'clang-cl':
     asan_dll = {
         'source': buildconfig.topobjdir,
         'base': 'dist/bin',
         'pattern': os.path.basename(buildconfig.substs['MOZ_CLANG_RT_ASAN_LIB_PATH']),
         'dest': 'bin'
     }
     ARCHIVE_FILES['common'].append(asan_dll)
 
--- a/python/mozbuild/mozbuild/frontend/data.py
+++ b/python/mozbuild/mozbuild/frontend/data.py
@@ -345,17 +345,17 @@ class Linkable(ContextDerived):
         if obj.cxx_link and not isinstance(obj, SharedLibrary):
             self.cxx_link = True
         obj.refs.append(self)
 
     def link_system_library(self, lib):
         # The '$' check is here as a special temporary rule, allowing the
         # inherited use of make variables, most notably in TK_LIBS.
         if not lib.startswith('$') and not lib.startswith('-'):
-            if self.config.substs.get('GNU_CC'):
+            if self.config.substs.get('CC_TYPE') in ('clang', 'gcc'):
                 lib = '-l%s' % lib
             else:
                 lib = '%s%s%s' % (
                     self.config.import_prefix,
                     lib,
                     self.config.import_suffix,
                 )
         self.linked_system_libs.append(lib)
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -945,17 +945,17 @@ class TreeMetadataEmitter(LoggingMixin):
         elif dist_install is False:
             passthru.variables['NO_DIST_INSTALL'] = True
 
         # Ideally, this should be done in templates, but this is difficult at
         # the moment because USE_STATIC_LIBS can be set after a template
         # returns. Eventually, with context-based templates, it will be
         # possible.
         if (context.config.substs.get('OS_ARCH') == 'WINNT' and
-                not context.config.substs.get('GNU_CC')):
+                context.config.substs.get('CC_TYPE') not in ('clang', 'gcc')):
             use_static_lib = (context.get('USE_STATIC_LIBS') and
                               not context.config.substs.get('MOZ_ASAN'))
             rtl_flag = '-MT' if use_static_lib else '-MD'
             if (context.config.substs.get('MOZ_DEBUG') and
                     not context.config.substs.get('MOZ_NO_DEBUG_RTL')):
                 rtl_flag += 'd'
             # Use a list, like MOZBUILD_*FLAGS variables
             passthru.variables['RTL_FLAGS'] = [rtl_flag]
--- a/python/mozbuild/mozbuild/frontend/gyp_reader.py
+++ b/python/mozbuild/mozbuild/frontend/gyp_reader.py
@@ -238,17 +238,17 @@ def process_gyp_result(gyp_result, gyp_d
                 if ext == '.s':
                     use_defines_in_asflags = True
 
             # The context expects alphabetical order when adding sources
             context['SOURCES'] = alphabetical_sorted(sources)
             context['UNIFIED_SOURCES'] = alphabetical_sorted(unified_sources)
 
             defines = target_conf.get('defines', [])
-            if bool(config.substs['_MSC_VER']) and no_chromium:
+            if config.substs['CC_TYPE'] == "msvc" and no_chromium:
                 msvs_settings = gyp.msvs_emulation.MsvsSettings(spec, {})
                 defines.extend(msvs_settings.GetComputedDefines(c))
             for define in defines:
                 if '=' in define:
                     name, value = define.split('=', 1)
                     context['DEFINES'][name] = value
                 else:
                     context['DEFINES'][define] = True
@@ -365,17 +365,17 @@ class GypProcessor(object):
         self._gyp_dir_attrs = gyp_dir_attrs
         self._action_overrides = action_overrides
         self.execution_time = 0.0
         self._results = []
 
         # gyp expects plain str instead of unicode. The frontend code gives us
         # unicode strings, so convert them.
         path = encode(path)
-        if bool(config.substs['_MSC_VER']):
+        if config.substs['CC_TYPE'] == 'msvc':
             # This isn't actually used anywhere in this generator, but it's needed
             # to override the registry detection of VC++ in gyp.
             os.environ['GYP_MSVS_OVERRIDE_PATH'] = 'fake_path'
 
             # TODO bug 1371485 upgrade vendored version of GYP to something that
             # doesn't barf when MSVS_VERSION==2017.
             msvs_version = config.substs['MSVS_VERSION']
             if msvs_version == '2017':