Allow files for `compat_label_flag()`'s label attributes `default_value`, `runtime` and `_native_target`, staying compatible with the prior `label_flag()` behaviour. PiperOrigin-RevId: 971288432
diff --git a/bazel/private/compat_flag.bzl b/bazel/private/compat_flag.bzl index acabfe3..8ffd0c9 100644 --- a/bazel/private/compat_flag.bzl +++ b/bazel/private/compat_flag.bzl
@@ -222,8 +222,8 @@ _COMMON_LABEL_FLAG_ATTRS = { "fragment_field": attr.string(), - "default_value": attr.label(), - "runtime": attr.label(), + "default_value": attr.label(allow_files = True), + "runtime": attr.label(allow_files = True), "scope": attr.string(), } @@ -232,6 +232,7 @@ if HAS_NATIVE_PROTO_FLAGS and fragment_name: attrs["_native_target"] = attr.label( default = configuration_field(fragment = "proto", name = fragment_name), + allow_files = True, ) return rule( implementation = _compat_executable_label_rule_impl if executable else _compat_label_rule_impl,