diff options
author | Abseil Team <absl-team@google.com> | 2024-02-14 04:56:05 (GMT) |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-02-14 04:56:40 (GMT) |
commit | 9756ee7cbaef1b6652065616ab832810a6032bbf (patch) | |
tree | 041375a32f431daeeaa6d3078164ecf9f2b7dd43 | |
parent | 6eb225cb8823c254d3a64549f2e1efad05c01757 (diff) | |
download | googletest-9756ee7cbaef1b6652065616ab832810a6032bbf.zip googletest-9756ee7cbaef1b6652065616ab832810a6032bbf.tar.gz googletest-9756ee7cbaef1b6652065616ab832810a6032bbf.tar.bz2 |
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
-rw-r--r-- | BUILD.bazel | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/BUILD.bazel b/BUILD.bazel index b1e3b7f..e407ae2 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -56,6 +56,12 @@ config_setting( constraint_values = ["@platforms//os:openbsd"], ) +# NOTE: Fuchsia is not an officially supported platform. +config_setting( + name = "fuchsia", + constraint_values = ["@platforms//os:fuchsia"], +) + config_setting( name = "msvc_compiler", flag_values = { @@ -147,6 +153,17 @@ cc_library( "@com_googlesource_code_re2//:re2", ], "//conditions:default": [], + }) + select({ + # `gtest-death-test.cc` has `EXPECT_DEATH` that spawns a process, + # expects it to crash and inspects its logs with the given matcher, + # so that's why these libraries are needed. + # Otherwise, builds targeting Fuchsia would fail to compile. + ":fuchsia": [ + "@fuchsia_sdk//pkg/fdio", + "@fuchsia_sdk//pkg/syslog", + "@fuchsia_sdk//pkg/zx", + ], + "//conditions:default": [], }), ) |