mirror of
https://github.com/google/googletest.git
synced 2025-04-02 19:08:12 +00:00
googletest: Add testonly alias of :gtest for testonly cc_libraries to use.
While a testonly library can certainly depend on a non-testonly library, gtest itself is logically testonly, but is not tagged as such for historical reasons. Having a testonly target allows gradual migrations towards a testonly-only world. PiperOrigin-RevId: 731807655 Change-Id: Ie16f17fb74b80bb6200767a3ac5bafa424162146
This commit is contained in:
parent
144d335538
commit
72189081ca
14
BUILD.bazel
14
BUILD.bazel
@ -83,6 +83,10 @@ cc_library(
|
||||
)
|
||||
|
||||
# Google Test including Google Mock
|
||||
|
||||
# For an actual test, use `gtest` and also `gtest_main` if you depend on gtest's
|
||||
# main(). For a library, use `gtest_for_library` instead if the library can be
|
||||
# testonly.
|
||||
cc_library(
|
||||
name = "gtest",
|
||||
srcs = glob(
|
||||
@ -167,6 +171,16 @@ cc_library(
|
||||
}),
|
||||
)
|
||||
|
||||
# `gtest`, but testonly. See guidance on `gtest` for when to use this.
|
||||
alias(
|
||||
name = "gtest_for_library",
|
||||
actual = ":gtest",
|
||||
testonly = True,
|
||||
)
|
||||
|
||||
# Implements main() for tests using gtest. Prefer to depend on `gtest` as well
|
||||
# to ensure compliance with the layering_check Bazel feature where only the
|
||||
# direct hdrs values are available.
|
||||
cc_library(
|
||||
name = "gtest_main",
|
||||
srcs = ["googlemock/src/gmock_main.cc"],
|
||||
|
Loading…
x
Reference in New Issue
Block a user