From fd185319f99749aeb1992a6e8949aa533a116760 Mon Sep 17 00:00:00 2001 From: Pat Doyle Date: Fri, 23 May 2025 21:43:31 -0700 Subject: [PATCH 1/2] first attempt --- .../clang-tools-extra/unittests/BUILD.bazel | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/utils/bazel/llvm-project-overlay/clang-tools-extra/unittests/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang-tools-extra/unittests/BUILD.bazel index e282e98bd571f..9ec49eff08af3 100644 --- a/utils/bazel/llvm-project-overlay/clang-tools-extra/unittests/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/clang-tools-extra/unittests/BUILD.bazel @@ -2,6 +2,7 @@ # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +load("@bazel_skylib//rules:expand_template.bzl", "expand_template") load("@rules_cc//cc:defs.bzl", "cc_test") package( @@ -54,6 +55,15 @@ cc_test( ], ) +expand_template( + name = "clang_doc_config", + out = "clang-doc/config.h", + substitutions = { + "#define CLANG_DOC_TEST_ASSET_DIR \"${CLANG_DOC_TEST_ASSET_DIR}\"": "#define CLANG_DOC_TEST_ASSET_DIR \"clang-tools-extra/clang-doc/assets\"", + }, + template = "clang-doc/config.h.cmake", +) + cc_test( name = "clang_doc_test", size = "small", @@ -65,7 +75,6 @@ cc_test( allow_empty = False, ), data = ["//clang-tools-extra/clang-doc:assets"], - local_defines = ['CLANG_DOC_TEST_ASSET_DIR=\\"clang-tools-extra/clang-doc/assets\\"'], deps = [ "//clang:ast", "//clang:basic", From 9807f6a0ca2160a09241af0a00c4dddf8687a726 Mon Sep 17 00:00:00 2001 From: Pat Doyle Date: Sat, 24 May 2025 01:15:16 -0700 Subject: [PATCH 2/2] should work now --- .../clang-tools-extra/unittests/BUILD.bazel | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/utils/bazel/llvm-project-overlay/clang-tools-extra/unittests/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang-tools-extra/unittests/BUILD.bazel index 9ec49eff08af3..09c0f50b43d13 100644 --- a/utils/bazel/llvm-project-overlay/clang-tools-extra/unittests/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/clang-tools-extra/unittests/BUILD.bazel @@ -56,7 +56,7 @@ cc_test( ) expand_template( - name = "clang_doc_config", + name = "clang_doc_config_h", out = "clang-doc/config.h", substitutions = { "#define CLANG_DOC_TEST_ASSET_DIR \"${CLANG_DOC_TEST_ASSET_DIR}\"": "#define CLANG_DOC_TEST_ASSET_DIR \"clang-tools-extra/clang-doc/assets\"", @@ -64,6 +64,11 @@ expand_template( template = "clang-doc/config.h.cmake", ) +cc_library( + name = "clang_doc_config", + hdrs = ["clang-doc/config.h"], +) + cc_test( name = "clang_doc_test", size = "small", @@ -73,9 +78,12 @@ cc_test( "clang-doc/*.h", ], allow_empty = False, + exclude = ["clang-doc/config.h"], ), data = ["//clang-tools-extra/clang-doc:assets"], + includes = ["clang-doc"], deps = [ + ":clang_doc_config", "//clang:ast", "//clang:basic", "//clang-tools-extra/clang-doc:generators",