Bug 1398897 - Move includes associated with CPP_UNIT_TESTS to the CppUnitTests template. r=glandium
authorChris Manchester <cmanchester@mozilla.com>
Wed, 20 Sep 2017 12:43:24 -0700
changeset 431614 e4ac1e17ffe51b34721a569b259d57cb6f965628
parent 431613 ae4d0410545f5a85746dc7869e48b386f13b7032
child 431615 b4c11ce9704c7c358cb5d352e452f8dc8fd6f38e
push id7785
push userryanvm@gmail.com
push dateThu, 21 Sep 2017 13:39:55 +0000
treeherdermozilla-beta@06d4034a8a03 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1398897
milestone57.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 1398897 - Move includes associated with CPP_UNIT_TESTS to the CppUnitTests template. r=glandium MozReview-Commit-ID: DhjnzhAjoyy
build/templates.mozbuild
python/mozbuild/mozbuild/frontend/emitter.py
--- a/build/templates.mozbuild
+++ b/build/templates.mozbuild
@@ -47,16 +47,18 @@ 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.
     '''
+    COMPILE_FLAGS['EXTRA_INCLUDES'] = ['-I%s/dist/include' % TOPOBJDIR,
+                                       '-I%s/dist/include/testing' % TOPOBJDIR]
     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
@@ -1029,22 +1029,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),