diff --git a/docs/.bazelrc b/docs/.bazelrc index 9eb0697f..1771ca23 100644 --- a/docs/.bazelrc +++ b/docs/.bazelrc @@ -3,5 +3,4 @@ # https://github.com/bazelbuild/stardoc/issues/112 common --incompatible_allow_tags_propagation -common --noenable_bzlmod build --workspace_status_command=tools/workspace_status.sh diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index b24eea8d..072459e2 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -1,5 +1,5 @@ load("@bazel_skylib//rules:build_test.bzl", "build_test") -load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc") +load("@stardoc//stardoc:stardoc.bzl", "stardoc") genrule( name = "flatten_header_vm", @@ -8,8 +8,9 @@ genrule( "docs.bzl", ], outs = ["flatten_header.vm"], - cmd = "$(location gen_header.sh) $(location docs.bzl) $@", + cmd = "PYTHON3=$(PYTHON3) $(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 diff --git a/docs/MODULE.bazel b/docs/MODULE.bazel new file mode 100644 index 00000000..993104c8 --- /dev/null +++ b/docs/MODULE.bazel @@ -0,0 +1,12 @@ +bazel_dep(name = "rules_foreign_cc") + +local_path_override( + module_name = "rules_foreign_cc", + path = "..", +) + +bazel_dep(name = "stardoc", version = "0.6.2", dev_dependency = True) + +bazel_dep(name = "rules_python", version = "0.31.0", dev_dependency = True) +bazel_dep(name = "gazelle", version = "0.36.0", dev_dependency = True) +bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True) diff --git a/docs/WORKSPACE.bazel b/docs/WORKSPACE.bazel index 5fba8251..e69de29b 100644 --- a/docs/WORKSPACE.bazel +++ b/docs/WORKSPACE.bazel @@ -1,51 +0,0 @@ -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") diff --git a/docs/gen_header.sh b/docs/gen_header.sh index 16cfcbe3..33202357 100755 --- a/docs/gen_header.sh +++ b/docs/gen_header.sh @@ -20,7 +20,7 @@ TABLE_OF_CONTENTS=$(grep "=" "$1" \ | sed '/^$/d' \ | sed '/^#/d' \ | sed 's/ = .*//' \ -| python -c 'import sys; print("\n".join(["- [{}](#{})".format(symbol.strip(), symbol.strip().lower()) for symbol in sys.stdin.readlines()]))' \ +| ${PYTHON3} -c 'import sys; print("\n".join(["- [{}](#{})".format(symbol.strip(), symbol.strip().lower()) for symbol in sys.stdin.readlines()]))' \ | sort -f ) diff --git a/docs/stardoc_deps.bzl b/docs/stardoc_deps.bzl deleted file mode 100644 index b614c8e0..00000000 --- a/docs/stardoc_deps.bzl +++ /dev/null @@ -1,7 +0,0 @@ -"""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 diff --git a/docs/stardoc_repository.bzl b/docs/stardoc_repository.bzl deleted file mode 100644 index 7c63be7f..00000000 --- a/docs/stardoc_repository.bzl +++ /dev/null @@ -1,15 +0,0 @@ -"""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", - ], - ) diff --git a/foreign_cc/BUILD.bazel b/foreign_cc/BUILD.bazel index 36ff3080..c9e616f8 100644 --- a/foreign_cc/BUILD.bazel +++ b/foreign_cc/BUILD.bazel @@ -20,6 +20,7 @@ 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", @@ -74,6 +75,7 @@ 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", @@ -104,6 +106,7 @@ 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", diff --git a/foreign_cc/built_tools/BUILD.bazel b/foreign_cc/built_tools/BUILD.bazel index 29f8d06b..eeeb6fe6 100644 --- a/foreign_cc/built_tools/BUILD.bazel +++ b/foreign_cc/built_tools/BUILD.bazel @@ -4,7 +4,6 @@ bzl_library( name = "cmake_build", srcs = ["cmake_build.bzl"], visibility = ["//visibility:public"], - deps = ["//foreign_cc:defs"], ) bzl_library( diff --git a/foreign_cc/private/BUILD.bazel b/foreign_cc/private/BUILD.bazel index ccbe9db9..cd1cf93f 100644 --- a/foreign_cc/private/BUILD.bazel +++ b/foreign_cc/private/BUILD.bazel @@ -75,10 +75,7 @@ bzl_library( bzl_library( name = "detect_root", srcs = ["detect_root.bzl"], - visibility = [ - "//foreign_cc:__subpackages__", - "//test:__subpackages__", - ], + visibility = ["//foreign_cc:__subpackages__"], ) bzl_library(