Bug 1393454 Do not compile rust gtest crate if --disable-tests is set r=ted
authorTom Ritter <tom@mozilla.com>
Mon, 28 Aug 2017 13:12:24 -0500
changeset 377920 08122b5e49f891ddb42f73c87ac8f152d1b38ea4
parent 377919 25e63f4eac0a4ef7cb2490f4bd4aea0ec22a9d30
child 377921 855146d4433352ac00bb0ce56d5f259362ea72aa
push id94356
push userarchaeopteryx@coole-files.de
push dateThu, 31 Aug 2017 12:39:46 +0000
treeherdermozilla-inbound@bd99b156f9e4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1393454
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 1393454 Do not compile rust gtest crate if --disable-tests is set r=ted MozReview-Commit-ID: 1HgK0D1kGNu
moz.configure
toolkit/library/gtest/moz.build
toolkit/toolkit.mozbuild
--- a/moz.configure
+++ b/moz.configure
@@ -265,19 +265,19 @@ set_config('BUILD_BACKENDS', build_backe
 option('--disable-gtest-in-build',
        help='Force disable building the gtest libxul during the build.',
        when='--enable-compile-environment')
 
 # Determine whether to build the gtest xul. This happens in automation
 # on Desktop platforms with the exception of Windows PGO, where linking
 # xul-gtest.dll takes too long.
 @depends('MOZ_PGO', build_project, target, 'MOZ_AUTOMATION', '--disable-gtest-in-build',
-         when='--enable-compile-environment')
-def build_gtest(pgo, build_project, target, automation, enabled):
-    if not enabled:
+         enable_tests, when='--enable-compile-environment')
+def build_gtest(pgo, build_project, target, automation, enabled, enable_tests):
+    if not enable_tests or not enabled:
         return None
     if (automation and build_project == 'browser' and
         not (pgo and target.os == 'WINNT')):
         return True
 
 set_config('LINK_GTEST_DURING_COMPILE', build_gtest)
 
 # Awk detection
--- a/toolkit/library/gtest/moz.build
+++ b/toolkit/library/gtest/moz.build
@@ -1,18 +1,22 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 FINAL_TARGET = 'dist/bin/gtest'
 
+if CONFIG['ENABLE_TESTS']:
+	USE_LIBS += [
+	    'gkrust-gtest',
+	]
+
 USE_LIBS += [
-    'gkrust-gtest',
     'static:xul',
     # xul-gtest is an intermediate static library. It is used as FINAL_TARGET
     # for gtest code.
     # If the FINAL_TARGET were the library in this directory, then the gtest
     # code would end up before static:xul, and before StaticXULComponentStart,
     # which needs to stay first.
     'xul-gtest',
 ]
--- a/toolkit/toolkit.mozbuild
+++ b/toolkit/toolkit.mozbuild
@@ -1,16 +1,20 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+if CONFIG['ENABLE_TESTS']:
+    DIRS += [
+        '/toolkit/library/gtest/rust',
+    ]
+
 DIRS += [
-    '/toolkit/library/gtest/rust',
     '/toolkit/library/rust',
 ]
 
 if CONFIG['MOZ_SANDBOX']:
     DIRS += ['/security/sandbox']
 
 DIRS += [
     # Depends on NSS and NSPR, and must be built after sandbox or else B2G emulator