diff --git a/BUILD.bazel b/BUILD.bazel index a8a476e..e06e1b6 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,6 +1,12 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") +# For stardoc to reference the files +exports_files( + ["with_cfg.bzl"], + visibility = ["//docs:__pkg__"], +) + bzl_library( name = "with_cfg", srcs = ["with_cfg.bzl"], diff --git a/MODULE.bazel b/MODULE.bazel index cf81f8d..361a37b 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -4,6 +4,7 @@ module( compatibility_level = 1, ) +bazel_dep(name = "bazel_features", version = "1.22.0") bazel_dep(name = "bazel_skylib", version = "1.4.1") bazel_dep(name = "platforms", version = "0.0.6") @@ -12,15 +13,9 @@ bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.4.1", dev_dependenc bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True) bazel_dep(name = "gazelle", version = "0.33.0", dev_dependency = True, repo_name = "bazel_gazelle") bazel_dep(name = "rules_testing", version = "0.4.0", dev_dependency = True) -bazel_dep(name = "stardoc", dev_dependency = True) -git_override( - module_name = "stardoc", - commit = "3baa5d1761970c6285d2ac9c3adccfaac42f54c5", - remote = "https://github.com/bazelbuild/stardoc.git", -) - bazel_dep(name = "rules_java", version = "7.6.1", dev_dependency = True) bazel_dep(name = "rules_proto", version = "6.0.0", dev_dependency = True) +bazel_dep(name = "stardoc", version = "0.7.2", dev_dependency = True) bazel_dep(name = "toolchains_protoc", version = "0.3.0", dev_dependency = True) protoc = use_extension( diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index 6af6a4b..bfcb77c 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -5,7 +5,7 @@ load("@rules_proto//proto:proto_lang_toolchain.bzl", "proto_lang_toolchain") stardoc_with_diff_test( name = "defs", - bzl_library_target = "//with_cfg:defs", + bzl_library_target = "//:with_cfg", ) update_docs(name = "update") diff --git a/docs/defs.md b/docs/defs.md index 11f1c5c..f4b7361 100644 --- a/docs/defs.md +++ b/docs/defs.md @@ -7,6 +7,8 @@ ## original_settings
+load("@with_cfg.bzl", "original_settings")
+
 original_settings(name)
 
@@ -53,6 +55,8 @@ original_settings( ## with_cfg
+load("@with_cfg.bzl", "with_cfg")
+
 with_cfg(kind, executable, implicit_targets, extra_providers)
 
diff --git a/with_cfg/BUILD.bazel b/with_cfg/BUILD.bazel index 1aa2afd..0fcef46 100644 --- a/with_cfg/BUILD.bazel +++ b/with_cfg/BUILD.bazel @@ -1,6 +1,6 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") -# For stardoc to reference the files +# Legacy export, no longer used by this module. exports_files(["defs.bzl"]) bzl_library( diff --git a/with_cfg/private/BUILD.bazel b/with_cfg/private/BUILD.bazel index 3a3f526..01e5547 100644 --- a/with_cfg/private/BUILD.bazel +++ b/with_cfg/private/BUILD.bazel @@ -153,5 +153,6 @@ bzl_library( ":select", ":setting", ":utils", + "@bazel_features//:features", ], ) diff --git a/with_cfg/private/providers.bzl b/with_cfg/private/providers.bzl index 7aa1c30..46a2bee 100644 --- a/with_cfg/private/providers.bzl +++ b/with_cfg/private/providers.bzl @@ -9,6 +9,7 @@ RuleInfo = provider(fields = [ "kind", "native", "providers", + "supports_inheritance", "test", ]) diff --git a/with_cfg/private/with_cfg.bzl b/with_cfg/private/with_cfg.bzl index 15542a3..451325e 100644 --- a/with_cfg/private/with_cfg.bzl +++ b/with_cfg/private/with_cfg.bzl @@ -127,6 +127,7 @@ def with_cfg( implicit_targets = implicit_targets, providers = DEFAULT_PROVIDERS + extra_providers, native = _is_native(kind), + supports_inheritance = _supports_inheritance(kind), ) return make_builder(rule_info) @@ -155,5 +156,9 @@ def is_test(rule_name): def _is_native(kind): return str(kind).startswith("