Bug 1393454 Do not compile rust gtest crate if --disable-tests is set
MozReview-Commit-ID: 1HgK0D1kGNu
--- 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