From 4ffdf0dc789b3d31b9b8e70adc08954a3368108a Mon Sep 17 00:00:00 2001 From: Mai Hussien <70515749+mai93@users.noreply.github.com> Date: Wed, 26 Apr 2023 22:23:06 -0700 Subject: [PATCH] Move shared headers to a private filegroup --- bazel/glog.bzl | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bazel/glog.bzl b/bazel/glog.bzl index 620c212..52d28e5 100644 --- a/bazel/glog.bzl +++ b/bazel/glog.bzl @@ -156,6 +156,16 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs): "//conditions:default": [], }) + # Needed to use these headers in `glog` and the test targets without exposing them as public targets in `glog` + native.filegroup( + name = "shared_headers", + srcs = [ + "src/base/mutex.h", + "src/stacktrace.h", + "src/utilities.h", + ] + ) + native.cc_library( name = "glog", visibility = ["//visibility:public"], @@ -177,17 +187,15 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs): "src/symbolize.h", "src/utilities.cc", "src/vlog_is_on.cc", + ":shared_headers", ] + select({ "@bazel_tools//src/conditions:windows": windows_only_srcs, "//conditions:default": [], }), hdrs = [ "src/base/commandlineflags.h", - "src/base/mutex.h", "src/glog/log_severity.h", "src/glog/platform.h", - "src/stacktrace.h", - "src/utilities.h", ":logging_h", ":raw_logging_h", ":stl_logging_h", @@ -227,6 +235,7 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs): visibility = ["//visibility:public"], srcs = [ ":config_h", + ":shared_headers", "src/googletest.h", "src/" + test_name + "_unittest.cc", ],