[Bazel] Introduce "//clang:bundle_resources" for D146591
authorNAKAMURA Takumi <geek4civic@gmail.com>
Wed, 19 Apr 2023 23:23:56 +0000 (08:23 +0900)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Wed, 19 Apr 2023 23:45:37 +0000 (08:45 +0900)
utils/bazel/llvm-project-overlay/clang/BUILD.bazel

index 2ecbe18..7014b90 100644 (file)
@@ -406,6 +406,14 @@ genrule(
     cmd = "echo '#undef CLANG_REVISION' > $@",
 )
 
+py_binary(
+    name = "bundle_resources",
+    srcs = [
+        "utils/bundle_resources.py",
+    ],
+    main = "utils/bundle_resources.py",
+)
+
 # A hacky library to expose some internal headers of the `basic` library to its
 # own implementation source files using a stripped include prefix rather than
 # file-relative-inclusion. This is inherently non-modular as these headers will
@@ -817,6 +825,18 @@ cc_library(
     ],
 )
 
+genrule(
+    name = "HTMLLogger_gen",
+    outs = ["lib/Analysis/FlowSensitive/HTMLLogger.inc"],
+    srcs = [
+        "lib/Analysis/FlowSensitive/HTMLLogger.html",
+        "lib/Analysis/FlowSensitive/HTMLLogger.css",
+        "lib/Analysis/FlowSensitive/HTMLLogger.js",
+    ],
+    tools = [":bundle_resources"],
+    cmd = "$(location :bundle_resources) $@ $(SRCS)",
+)
+
 cc_library(
     name = "analysis",
     srcs = glob([
@@ -824,15 +844,21 @@ cc_library(
         "lib/Analysis/FlowSensitive/*.cpp",
         "lib/Analysis/*.cpp",
         "lib/Analysis/*.h",
-    ]),
+    ]) + [
+        "lib/Analysis/FlowSensitive/HTMLLogger.inc",
+    ],
     hdrs = glob([
         "include/clang/Analysis/**/*.h",
     ]),
-    includes = ["include"],
+    includes = [
+        "include",
+        "lib/Analysis/FlowSensitive",
+    ],
     textual_hdrs = glob([
         "include/clang/Analysis/**/*.def",
     ]),
     deps = [
+        ":HTMLLogger_gen",
         ":ast",
         ":ast_matchers",
         ":basic",