bug 1481614 - detect icecream usage in build telemetry. r=chmanchester,glandium

This patch adds detection for when icecream is in use to build telemetry.
icecream is commonly enabled in two ways: by either setting CC/CXX to point
to icecream's cc/c++ symlinks, or by setting adding
mk_add_options 'export CCACHE_PREFIX=icecc' to a mozconfig when also using
ccache. For the former, this patch adds a simple configure check to see
if CXX is a symlink to a file named 'icecc'. For the latter this patch adds
CCACHE_PREFIX as a configure subst to capture the value.

We don't currently have a facility for writing telemetry tests that depend on
configure values. Local manual testing shows that it does work as expected.

Differential Revision: https://phabricator.services.mozilla.com/D18138

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ted Mielczarek 2019-02-25 19:06:27 +00:00
Родитель 9183dfa10e
Коммит 0539de896a
3 изменённых файлов: 24 добавлений и 1 удалений

Просмотреть файл

@ -322,6 +322,12 @@ 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]))
# Distinguish ccache from sccache.
@ -1221,6 +1227,15 @@ host_cxx_compiler = compiler('C++', host, c_compiler=host_c_compiler,
building_with_gcc = depends(c_compiler)(lambda info: info.type == 'gcc')
@depends(cxx_compiler)
@imports('os')
def cxx_is_icecream(info):
if (os.path.islink(info.compiler) and os.path.basename(
os.readlink(info.compiler)) == '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

Просмотреть файл

@ -271,6 +271,10 @@ export CCACHE_CPP2=1
endif
endif
ifdef CCACHE_PREFIX
export CCACHE_PREFIX
endif
# Set link flags according to whether we want a console.
ifeq ($(OS_ARCH),WINNT)
ifdef MOZ_WINCONSOLE

Просмотреть файл

@ -209,12 +209,16 @@ def get_build_opts(substs):
('opt', 'MOZ_OPTIMIZE', bool),
('ccache', 'CCACHE', bool),
('sccache', 'MOZ_USING_SCCACHE', bool),
# TODO: detect icecream: https://bugzilla.mozilla.org/show_bug.cgi?id=1481614
)
}
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':
opts['icecream'] = True
return opts
except BuildEnvironmentNotFoundException:
return {}