diff --git a/BUILD.bazel b/BUILD.bazel index 3df2f63cab..d266eb41a7 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -12,6 +12,7 @@ # License for the specific language governing permissions and limitations under # the License. load("@bazel_skylib//rules:copy_file.bzl", "copy_file") +load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands") licenses(["notice"]) @@ -36,3 +37,23 @@ copy_file( out = "clangd", allow_symlink = True, ) + +# The Fuchsia SDK is only supported on Linux hosts, so the target that +# generates compile commands for targets built for Fuchsia is separate from +# the more general-purpose `refresh_compile_commands` target. +refresh_compile_commands( + name = "refresh_compile_commands_for_fuchsia_sdk", + out_dir = ".compile_commands", + target_compatible_with = select({ + "@platforms//os:linux": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + target_groups = { + "fuchsia": [ + [ + "//pw_bluetooth_sapphire/fuchsia/bt_host:pkg.arm64", + "--config=fuchsia", + ], + ], + }, +)