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 658697 22ee4ea3f8ad9ccb25f84a88d4a3113674c50e62
parent 658696 462ea0f1fef646ec086d2a74adc05e4b190d5723
child 729721 dda27f1bebb9d071555d82446e2ae7ba496e88af
push id77839
push userbmo:sledru@mozilla.com
push dateMon, 04 Sep 2017 14:21:36 +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':