[PATCH] D141175: [bazel] Split out Annotations from `TestingSupport`

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 19:09:10 PST 2023


rupprecht created this revision.
rupprecht added a reviewer: GMNGeoffrey.
Herald added a project: All.
rupprecht requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The Annotations helper class does not have a gtest or gmock dependency, but because it's bundled with the rest of TestingSupport, it gets one. By splitting it out, a target can use it without being forced to use LLVM's copy of gtest.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141175

Files:
  utils/bazel/llvm-project-overlay/llvm/BUILD.bazel


Index: utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
===================================================================
--- utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+++ utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
@@ -4417,22 +4417,39 @@
 cc_library(
     name = "TestingSupport",
     testonly = True,
-    srcs = glob([
-        "lib/Testing/Support/*.cpp",
-        "lib/Testing/Support/*.h",
-    ]),
-    hdrs = glob([
-        "include/llvm/Testing/Support/*.h",
-    ]),
+    srcs = glob(
+        [
+            "lib/Testing/Support/*.cpp",
+            "lib/Testing/Support/*.h",
+        ],
+        exclude = ["lib/Testing/Support/Annotations.cpp"],
+    ),
+    hdrs = glob(
+        [
+            "include/llvm/Testing/Support/*.h",
+        ],
+        exclude = ["include/llvm/Testing/Support/Annotations.h"],
+    ),
     copts = llvm_copts,
     deps = [
         ":Support",
+        ":TestingAnnotations",
         ":config",
         "//third-party/unittest:gmock",
         "//third-party/unittest:gtest",
     ],
 )
 
+# Split out of TestingSupport to allow using this with a different gmock/gtest version.
+cc_library(
+    name = "TestingAnnotations",
+    testonly = True,
+    srcs = ["lib/Testing/Support/Annotations.cpp"],
+    hdrs = ["include/llvm/Testing/Support/Annotations.h"],
+    copts = llvm_copts,
+    deps = [":Support"],
+)
+
 ################################################################################
 # Begin testonly binary utilities
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141175.487032.patch
Type: text/x-patch
Size: 1506 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230107/57a384cb/attachment.bin>


More information about the llvm-commits mailing list