Skip to content

Commit 9756ee7

Browse files
Abseil Teamcopybara-github
Abseil Team
authored andcommitted
Support Fuchsia target builds.
The Fuchsia team has been using either fork branches (https://fuchsia.googlesource.com/third_ party/github.com/google/googletest/+/refs/heads/sandbox/fuchsia_bazel_sdk) or patch files (https://cs.opensource.google/fuchsia/fuchsia/+/main:build/bazel/patches/googletest/fuchsia-support.bundle) to support googletest-based tests that run against a Fuchsia target device. As our SDK is maturing and @platforms//os:fuchsia constraint has been added for a while now, upstream Fuchsia gtest support to reduce technical debt and overhead. This change is noop for non-fuchsia platform builds. PiperOrigin-RevId: 606843739 Change-Id: I61e0eb9c641f288d7ae57354fc0b484fce013223
1 parent 6eb225c commit 9756ee7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

BUILD.bazel

+17
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ config_setting(
5656
constraint_values = ["@platforms//os:openbsd"],
5757
)
5858

59+
# NOTE: Fuchsia is not an officially supported platform.
60+
config_setting(
61+
name = "fuchsia",
62+
constraint_values = ["@platforms//os:fuchsia"],
63+
)
64+
5965
config_setting(
6066
name = "msvc_compiler",
6167
flag_values = {
@@ -147,6 +153,17 @@ cc_library(
147153
"@com_googlesource_code_re2//:re2",
148154
],
149155
"//conditions:default": [],
156+
}) + select({
157+
# `gtest-death-test.cc` has `EXPECT_DEATH` that spawns a process,
158+
# expects it to crash and inspects its logs with the given matcher,
159+
# so that's why these libraries are needed.
160+
# Otherwise, builds targeting Fuchsia would fail to compile.
161+
":fuchsia": [
162+
"@fuchsia_sdk//pkg/fdio",
163+
"@fuchsia_sdk//pkg/syslog",
164+
"@fuchsia_sdk//pkg/zx",
165+
],
166+
"//conditions:default": [],
150167
}),
151168
)
152169

0 commit comments

Comments
 (0)