You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add output_dir parameter to control where compile_commands.json is written
New macro/rule parameter `output_dir` (default empty == workspace root,
matching the historical behaviour). When set, both the pre-write unlink
and the open() target are rerouted to `<output_dir>/compile_commands.json`.
Backport of hedronvision#210 (ilev4ik).
Copy file name to clipboardExpand all lines: refresh_compile_commands.bzl
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -65,6 +65,7 @@ def refresh_compile_commands(
65
65
targets=None,
66
66
exclude_headers=None,
67
67
exclude_external_sources=False,
68
+
output_dir="",
68
69
**kwargs): # For the other common attributes. Tags, compatible_with, etc. https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes.
69
70
# Convert the various, acceptable target shorthands into the dictionary format
70
71
# In Python, `type(x) == y` is an antipattern, but [Starlark doesn't support inheritance](https://bazel.build/rules/language), so `isinstance` doesn't exist, and this is the correct way to switch on type.
@@ -90,7 +91,7 @@ def refresh_compile_commands(
90
91
91
92
# Generate the core, runnable python script from refresh.template.py
" {windows_default_include_paths}": "\n".join([" %r,"%pathforpathinfind_cpp_toolchain(ctx).built_in_include_directories]), # find_cpp_toolchain is from https://docs.bazel.build/versions/main/integrating-with-rules-cc.html
# For Windows INCLUDE. If this were eliminated, for example by the resolution of https://github.com/clangd/clangd/issues/123, we'd be able to just use a macro and skylib's expand_template rule: https://github.com/bazelbuild/bazel-skylib/pull/330
0 commit comments