Bug 1549762 - Don't build mozglue linker tests if building with icecream. r=glandium
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 15 May 2019 13:40:23 +0000
changeset 532763 57ad9770bc01ffdbc52f841d8e437820a8a222f1
parent 532762 bbbbed508f9be54d655124bc1662d6b2cb47cbef
child 532764 02f031c0f789c7b8c21ad281cddad59ba4a9a8a9
push id11272
push userapavel@mozilla.com
push dateThu, 16 May 2019 15:28:22 +0000
treeherdermozilla-beta@2265bfc5920d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1549762
milestone68.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 1549762 - Don't build mozglue linker tests if building with icecream. r=glandium As icecream doesn't deal well with .incbin. Differential Revision: https://phabricator.services.mozilla.com/D30951
build/moz.configure/toolchain.configure
mozglue/linker/moz.build
python/mozbuild/mozbuild/telemetry.py
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -252,17 +252,18 @@ def ccache(value):
 
 
 ccache = check_prog('CCACHE', progs=(), input=ccache)
 
 js_option(env='CCACHE_PREFIX',
           nargs=1,
           help='Compiler prefix to use when using ccache')
 
-set_config('CCACHE_PREFIX', depends_if('CCACHE_PREFIX')(lambda prefix: prefix[0]))
+ccache_prefix = depends_if('CCACHE_PREFIX')(lambda prefix: prefix[0])
+set_config('CCACHE_PREFIX', ccache_prefix)
 
 # Distinguish ccache from sccache.
 
 
 @depends_if(ccache)
 def ccache_is_sccache(ccache):
     return check_cmd_output(ccache, '--version').startswith('sccache')
 
@@ -1162,22 +1163,25 @@ host_c_compiler = compiler('C', host, ot
 host_cxx_compiler = compiler('C++', host, c_compiler=host_c_compiler,
                              other_compiler=cxx_compiler,
                              other_c_compiler=c_compiler)
 
 # Generic compiler-based conditions.
 building_with_gcc = depends(c_compiler)(lambda info: info.type == 'gcc')
 
 
-@depends(cxx_compiler)
+@depends(cxx_compiler, ccache_prefix)
 @imports('os')
-def cxx_is_icecream(info):
+def cxx_is_icecream(info, ccache_prefix):
     if (os.path.islink(info.compiler) and os.path.basename(
             os.readlink(info.compiler)) == 'icecc'):
         return True
+    if ccache_prefix and os.path.basename(ccache_prefix) == 'icecc':
+        return True
+
 set_config('CXX_IS_ICECREAM', cxx_is_icecream)
 
 
 @depends(c_compiler)
 def msvs_version(info):
     # clang-cl emulates the same version scheme as cl. And MSVS_VERSION needs to
     # be set for GYP on Windows.
     if info.type == 'clang-cl':
--- a/mozglue/linker/moz.build
+++ b/mozglue/linker/moz.build
@@ -16,17 +16,27 @@ SOURCES += [
 Library('linker')
 
 FINAL_LIBRARY = 'mozglue'
 
 DEFINES['IMPL_MFBT'] = True
 
 DisableStlWrapping()
 
-TEST_DIRS += ['tests']
+# Avoid building the linker tests if building with icecc since it doesn't deal
+# well with .incbin.
+#
+# A better solution would be to set ICECC=no in the environment before building
+# these objects to force the local build, but moz.build lacks such a capability
+# at the moment.
+#
+# TODO: Remove this when https://github.com/icecc/icecream/pull/463 is merged
+# and in a release.
+if not CONFIG['CXX_IS_ICECREAM']:
+    TEST_DIRS += ['tests']
 
 if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
     CXXFLAGS += ['-Wno-error=shadow']
 
 DEFINES['XZ_USE_CRC64'] = 1
 
 USE_LIBS += [
     'xz-embedded',
--- a/python/mozbuild/mozbuild/telemetry.py
+++ b/python/mozbuild/mozbuild/telemetry.py
@@ -213,20 +213,17 @@ def get_build_opts(substs):
                 ('opt', 'MOZ_OPTIMIZE', bool),
                 ('ccache', 'CCACHE', bool),
                 ('sccache', 'MOZ_USING_SCCACHE', bool),
             )
         }
         compiler = substs.get('CC_TYPE', None)
         if compiler:
             opts['compiler'] = str(compiler)
-        # icecream may be enabled by setting CC/CXX to symlinks to icecc,
-        # or if using it together with ccache by setting CCACHE_PREFIX=icecc.
-        prefix = os.path.basename(substs.get('CCACHE_PREFIX', ''))
-        if substs.get('CXX_IS_ICECREAM', None) or prefix == 'icecc':
+        if substs.get('CXX_IS_ICECREAM', None):
             opts['icecream'] = True
         return opts
     except BuildEnvironmentNotFoundException:
         return {}
 
 
 def get_build_attrs(attrs):
     '''