Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
61 changes: 35 additions & 26 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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")
Loading