diff --git a/MODULE.bazel b/MODULE.bazel index 23e060f..d5fbc8d 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,5 +1,7 @@ module(name = "hedron_compile_commands") +bazel_dep(name = "rules_python", version = "1.0.0") + p = use_extension("//:workspace_setup.bzl", "hedron_compile_commands_extension") pt = use_extension("//:workspace_setup_transitive.bzl", "hedron_compile_commands_extension") ptt = use_extension("//:workspace_setup_transitive_transitive.bzl", "hedron_compile_commands_extension") diff --git a/refresh_compile_commands.bzl b/refresh_compile_commands.bzl index 0210d42..a8b6538 100644 --- a/refresh_compile_commands.bzl +++ b/refresh_compile_commands.bzl @@ -57,6 +57,7 @@ refresh_compile_commands( # Implementation load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain") +load("@rules_python//python:py_binary.bzl", _py_binary = "py_binary") def refresh_compile_commands( @@ -64,6 +65,7 @@ def refresh_compile_commands( targets = None, exclude_headers = None, exclude_external_sources = False, + py_binary = _py_binary, **kwargs): # For the other common attributes. Tags, compatible_with, etc. https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes. # Convert the various, acceptable target shorthands into the dictionary format # 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. @@ -92,7 +94,7 @@ def refresh_compile_commands( _expand_template(name = script_name, labels_to_flags = targets, exclude_headers = exclude_headers, exclude_external_sources = exclude_external_sources, **kwargs) # Combine them so the wrapper calls the main script - native.py_binary( + py_binary( name = name, main = version_checker_script_name, srcs = [version_checker_script_name, script_name],