Move includes associated with CPP_UNIT_TESTS to the CppUnitTests template.
draft
Move includes associated with CPP_UNIT_TESTS to the CppUnitTests template.
MozReview-Commit-ID: DhjnzhAjoyy
--- a/build/templates.mozbuild
+++ b/build/templates.mozbuild
@@ -47,16 +47,19 @@ def SimplePrograms(names, ext='.cpp'):
@template
def CppUnitTests(names, ext='.cpp'):
'''Template for C++ unit tests.
Those have a single source with the same base name as the executable.
'''
+ dist_include_testing = '-I%s/dist/include/testing' % TOPOBJDIR
+ if dist_include_testing not in COMPILE_FLAGS['EXTRA_INCLUDES']:
+ COMPILE_FLAGS['EXTRA_INCLUDES'] += [dist_include_testing]
CPP_UNIT_TESTS += names
SOURCES += ['%s%s' % (name, ext) for name in names]
Binary()
@template
def Library(name):
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -1025,22 +1025,16 @@ class TreeMetadataEmitter(LoggingMixin):
'does not exist: %s (resolved to %s)' % (local_include,
local_include.full_path), context)
include_obj = LocalInclude(context, local_include)
local_includes.append(include_obj.path.full_path)
yield include_obj
computed_flags.resolve_flags('LOCAL_INCLUDES', ['-I%s' % p for p in local_includes])
- if len(context['CPP_UNIT_TESTS']):
- # TODO: Move this to the CppUnitTests template.
- dist_include_testing = mozpath.join(self.config.topobjdir,
- 'dist', 'include', 'testing')
- computed_flags.flags['EXTRA_INCLUDES'].append('-I%s' % dist_include_testing)
-
for obj in self._handle_linkables(context, passthru, generated_files):
yield obj
generated_files.update(['%s%s' % (k, self.config.substs.get('BIN_SUFFIX', '')) for k in self._binaries.keys()])
components = []
for var, cls in (
('BRANDING_FILES', BrandingFiles),