From 94fff646553a2f0a96f7f6663161447c31595965 Mon Sep 17 00:00:00 2001 From: UebelAndre Date: Tue, 15 Sep 2026 13:34:22 -0700 Subject: [PATCH] chore(deps): Migrate from aspect_bazel_lib to bazel_lib The module was renamed to `bazel_lib`. Version 3.x also dropped `lib/docs.bzl` and its transitive dependency on stardoc, so `stardoc` is now a direct dev dependency and `//docs` calls `stardoc()` and `write_source_files()` directly instead of the `stardoc_with_diff_test` and `update_docs` wrappers. Dev-dependency only; no change for consumers of the ruleset. --- MODULE.bazel | 3 ++- docs/BUILD.bazel | 61 +++++++++++++++++++++++++++--------------------- 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 8338420..05704ff 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -38,9 +38,10 @@ bazel_dep(name = "rules_cc", version = "0.0.16") bazel_dep(name = "gazelle", version = "0.35.0", dev_dependency = True, repo_name = "bazel_gazelle") bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.4.1", dev_dependency = True) -bazel_dep(name = "aspect_bazel_lib", version = "2.19.4", dev_dependency = True) +bazel_dep(name = "bazel_lib", version = "3.7.2", dev_dependency = True) bazel_dep(name = "buildifier_prebuilt", version = "8.2.0.2", dev_dependency = True) bazel_dep(name = "rules_python", version = "1.5.0", dev_dependency = True) +bazel_dep(name = "stardoc", version = "0.8.1", dev_dependency = True) toolchains = use_extension("//devicetree/private:extensions.bzl", "toolchains") toolchains.hermetic( diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index f77da72..43b6ab4 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -1,30 +1,39 @@ -# This load statement must be in the docs/ package rather than anything users depend on -# so that the dependency on stardoc doesn't leak to them. -load("@aspect_bazel_lib//lib:docs.bzl", "stardoc_with_diff_test", "update_docs") +# These load statements must be in the docs/ package rather than anything users +# depend on so that the dependency on stardoc doesn't leak to them. +load("@bazel_lib//lib:write_source_files.bzl", "write_source_files") +load("@stardoc//stardoc:stardoc.bzl", "stardoc") -stardoc_with_diff_test( - name = "api/devicetree_library", - bzl_library_target = "//devicetree:devicetree_library", -) - -stardoc_with_diff_test( - name = "api/dtb", - bzl_library_target = "//devicetree:dtb", -) +# Each entry documents `//devicetree:{name}` into the checked-in `api/{name}.md`. +# Run `bazel run //docs:update` to regenerate them. +API_DOCS = [ + # keep sorted + "devicetree_library", + "dtb", + "dtb_composite", + "dtbo", + "toolchain", +] -stardoc_with_diff_test( - name = "api/dtb_composite", - bzl_library_target = "//devicetree:dtb_composite", -) +[ + stardoc( + name = "api/{}".format(doc), + out = "api/{}-docgen.md".format(doc), + input = "//devicetree:{}.bzl".format(doc), + # stardoc produces different line endings on Windows + # which makes the diff_test fail + target_compatible_with = select({ + "@platforms//os:windows": ["@platforms//:incompatible"], + "//conditions:default": [], + }), + deps = ["//devicetree:{}".format(doc)], + ) + for doc in API_DOCS +] -stardoc_with_diff_test( - name = "api/dtbo", - bzl_library_target = "//devicetree:dtbo", +write_source_files( + name = "update", + files = { + "api/{}.md".format(doc): "api/{}-docgen.md".format(doc) + for doc in API_DOCS + }, ) - -stardoc_with_diff_test( - name = "api/toolchain", - bzl_library_target = "//devicetree:toolchain", -) - -update_docs(name = "update")