gecko-dev/toolkit/library/gtest/rust/moz.build
Mike Hommey fa98d8f6d9 Bug 1868980 - Avoid base include flags spreading to the cc crate. r=firefox-build-system-reviewers,ahochheiden
The cc crate was upgraded in bug 1866934, and one of the changes it
contains is to notify cargo to trigger rebuilds when environment
variables change[1].

As we invoke cargo from different directories, and as we pass the
computed compiler flags through CFLAGS_* variables in rust.mk, and
as those computed compiler flags contain -I flags for includes in
the current directory, each cargo invocation ends up with different
values of the CFLAGS_* variable, which, while it doesn't have a
consequence on the build itself, does now trigger a rebuild of crates
using cc, causing longer build times when building gtest.

Those -I flags, however, are not necessary for Rust, so we eliminate
them, working around the problem. The solution is fragile, but is the
simplest we can do short of doing much more intrusive changes.

1. 962af5387b

Differential Revision: https://phabricator.services.mozilla.com/D196138
2023-12-12 20:40:08 +00:00

19 lines
639 B
Python

# -*- 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/.
include("../../rust/gkrust-features.mozbuild")
if CONFIG["LIBFUZZER"]:
gkrust_features += ["gecko-fuzz-targets"]
RustLibrary(
"gkrust-gtest",
gkrust_features,
output_category=None if CONFIG["LINK_GTEST_DURING_COMPILE"] else "gtest",
)
COMPILE_FLAGS["BASE_INCLUDES"] = []
HOST_COMPILE_FLAGS["BASE_INCLUDES"] = []