From 9cf20c44db9421115c37f041896c618114926260 Mon Sep 17 00:00:00 2001 From: Xander McCarthy <19922103+CodingCanuck@users.noreply.github.com> Date: Tue, 19 Jul 2022 17:15:44 +0200 Subject: [PATCH] Make `jemalloc` compatible with bazel `malloc` (#9) --- BUILD.bazel | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index c193c75..109cfdf 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -3,16 +3,20 @@ load("@rules_foreign_cc//foreign_cc:configure.bzl", "configure_make_variant") filegroup( name = "all", srcs = glob(["**"]), - visibility = ["//visibility:public"], ) -alias( +# Wrap the cmake-built jemalloc code in a cc_library which can then be passed +# to a bazel cc_binary or cc_target `malloc` attribute. +# TODO(https://github.com/bazelbuild/rules_foreign_cc/issues/227): Remove this +# wrapper when bazel allows any target to be pasesd to `malloc`. +cc_library( # The `configure_make_variant` wrapper around `configure_make` doesn't # pass the 'visibility' setting correctly; it gets lost. As a - # workaround we use an alias with the correct visibility setting. + # workaround we wrap the target to give the correct visibility setting. + # TODO(xander): File an issue on `rules_foreign_cc` to preserve visibility. name = "jemalloc", - actual = "jemalloc_preinstalled_make", visibility = ["//visibility:public"], + deps = [":jemalloc_preinstalled_make"], ) configure_make_variant(