Use the Abseil flags library when Abseil is present

When built with `--define=absl=1` under Bazel, GoogleTest
flags use ABSL_FLAG instead of GoogleTest's own implementation.

There are some minor behavior differences in this mode.

The most notable difference is that unrecognized flags result
in a flag parsing error, and are not returned to the user though
a modified argc/argv, unless they appear after the positional
argument delimiter ("--").

For example, to pass a non-Abseil flag, you would have to do
./mytest --gtest_color=false -- --myflag=myvalue

The documentation at https://abseil.io/docs/cpp/guides/flags
may be helpful in understanding the behavior.

There are some other minor differences. For example,
passing --help results in the program returning 1 instead of 0.

https://github.com/google/googletest/issues/3646

PiperOrigin-RevId: 439312700
Change-Id: Id696a25f50f24a5b1785c45ca8fa59794f86fd5c
This commit is contained in:
Derek Mauro
2022-04-04 07:38:23 -07:00
committed by Copybara-Service
parent af29db7ec2
commit 25dcdc7e8b
9 changed files with 244 additions and 115 deletions

View File

@@ -4,9 +4,9 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "com_google_absl",
sha256 = "aeba534f7307e36fe084b452299e49b97420667a8d28102cf9a0daeed340b859",
strip_prefix = "abseil-cpp-7971fb358ae376e016d2d4fc9327aad95659b25e",
urls = ["https://github.com/abseil/abseil-cpp/archive/7971fb358ae376e016d2d4fc9327aad95659b25e.zip"], # 2021-05-20T02:59:16Z
sha256 = "93451aaccbf6a9618df7182fdf9ecf281284d6418a0d66eff33ae0cf05eba417",
strip_prefix = "abseil-cpp-ec33f404bb16564a9aea3044cd8504d6885165b0",
urls = ["https://github.com/abseil/abseil-cpp/archive/ec33f404bb16564a9aea3044cd8504d6885165b0.zip"], # 2022-03-03T14:43:16Z
)
http_archive(