Skip to content

Commit

Permalink
Revert "fix(docs): Port docs generation to bzlmod to fix user facing …
Browse files Browse the repository at this point in the history
…doc generation" (#1194)
  • Loading branch information
jsharpe authored Apr 12, 2024
1 parent 50b7d9b commit f055b5b
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 20 deletions.
1 change: 1 addition & 0 deletions docs/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
# https://github.com/bazelbuild/stardoc/issues/112
common --incompatible_allow_tags_propagation

common --noenable_bzlmod
build --workspace_status_command=tools/workspace_status.sh
5 changes: 2 additions & 3 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@stardoc//stardoc:stardoc.bzl", "stardoc")
load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc")

genrule(
name = "flatten_header_vm",
Expand All @@ -8,9 +8,8 @@ genrule(
"docs.bzl",
],
outs = ["flatten_header.vm"],
cmd = "PYTHON3=$(PYTHON3) $(location gen_header.sh) $(location docs.bzl) $@",
cmd = "$(location gen_header.sh) $(location docs.bzl) $@",
output_to_bindir = True,
toolchains=["@rules_python//python:current_py_toolchain"],
)

# Note that the stardoc `out` files are prefixed with `stardoc_` so the
Expand Down
12 changes: 0 additions & 12 deletions docs/MODULE.bazel

This file was deleted.

51 changes: 51 additions & 0 deletions docs/WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
workspace(name = "rules_foreign_cc_docs")

local_repository(
name = "rules_foreign_cc",
path = "..",
)

load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")

rules_foreign_cc_dependencies()

load("//:stardoc_repository.bzl", "stardoc_repository")

stardoc_repository()

load("//:stardoc_deps.bzl", "stardoc_deps")

stardoc_deps()

# Gazelle dependencies

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "bazel_gazelle",
sha256 = "b7387f72efb59f876e4daae42f1d3912d0d45563eac7cb23d1de0b094ab588cf",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz",
],
)

http_archive(
name = "bazel_skylib_gazelle_plugin",
sha256 = "747addf3f508186234f6232674dd7786743efb8c68619aece5fb0cac97b8f415",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-gazelle-plugin-1.5.0.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-gazelle-plugin-1.5.0.tar.gz",
],
)

load("@bazel_skylib_gazelle_plugin//:workspace.bzl", "bazel_skylib_gazelle_plugin_workspace")

bazel_skylib_gazelle_plugin_workspace()

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
load("@bazel_skylib_gazelle_plugin//:setup.bzl", "bazel_skylib_gazelle_plugin_setup")

bazel_skylib_gazelle_plugin_setup()

gazelle_dependencies(go_repository_default_config = "//:WORKSPACE.bazel")
2 changes: 1 addition & 1 deletion docs/gen_header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ TABLE_OF_CONTENTS=$(grep "=" "$1" \
| sed '/^$/d' \
| sed '/^#/d' \
| sed 's/ = .*//' \
| ${PYTHON3} -c 'import sys; print("\n".join(["- [{}](#{})".format(symbol.strip(), symbol.strip().lower()) for symbol in sys.stdin.readlines()]))' \
| python -c 'import sys; print("\n".join(["- [{}](#{})".format(symbol.strip(), symbol.strip().lower()) for symbol in sys.stdin.readlines()]))' \
| sort -f
)

Expand Down
7 changes: 7 additions & 0 deletions docs/stardoc_deps.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""A wrapper for defining stardoc dependencies to make instantiating
it in a WORKSPACE file more consistent
"""

load("@io_bazel_stardoc//:setup.bzl", _stardoc_repositories = "stardoc_repositories")

stardoc_deps = _stardoc_repositories
15 changes: 15 additions & 0 deletions docs/stardoc_repository.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""A module for defining the stardoc repository"""

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

def stardoc_repository():
maybe(
http_archive,
name = "io_bazel_stardoc",
sha256 = "3fd8fec4ddec3c670bd810904e2e33170bedfe12f90adf943508184be458c8bb",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/stardoc/releases/download/0.5.3/stardoc-0.5.3.tar.gz",
"https://github.com/bazelbuild/stardoc/releases/download/0.5.3/stardoc-0.5.3.tar.gz",
],
)
3 changes: 0 additions & 3 deletions foreign_cc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ bzl_library(
srcs = ["cmake.bzl"],
visibility = ["//visibility:public"],
deps = [
"//foreign_cc/built_tools:cmake_build",
"//foreign_cc/private:cc_toolchain_util",
"//foreign_cc/private:cmake_script",
"//foreign_cc/private:detect_root",
Expand Down Expand Up @@ -75,7 +74,6 @@ bzl_library(
srcs = ["make.bzl"],
visibility = ["//visibility:public"],
deps = [
"//foreign_cc/built_tools:make_build",
"//foreign_cc/private:cc_toolchain_util",
"//foreign_cc/private:detect_root",
"//foreign_cc/private:framework",
Expand Down Expand Up @@ -106,7 +104,6 @@ bzl_library(
srcs = ["ninja.bzl"],
visibility = ["//visibility:public"],
deps = [
"//foreign_cc/built_tools:ninja_build",
"//foreign_cc/private:detect_root",
"//foreign_cc/private:framework",
"//toolchains/native_tools:tool_access",
Expand Down
1 change: 1 addition & 0 deletions foreign_cc/built_tools/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ bzl_library(
name = "cmake_build",
srcs = ["cmake_build.bzl"],
visibility = ["//visibility:public"],
deps = ["//foreign_cc:defs"],
)

bzl_library(
Expand Down
5 changes: 4 additions & 1 deletion foreign_cc/private/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ bzl_library(
bzl_library(
name = "detect_root",
srcs = ["detect_root.bzl"],
visibility = ["//foreign_cc:__subpackages__"],
visibility = [
"//foreign_cc:__subpackages__",
"//test:__subpackages__",
],
)

bzl_library(
Expand Down

0 comments on commit f055b5b

Please sign in to comment.