From 6929bf6cb0162d1ac2b17c34b502611012f9197c Mon Sep 17 00:00:00 2001 From: HONG Yifan Date: Mon, 30 Sep 2024 15:11:44 -0700 Subject: [PATCH] Move rules_pkg_lib to //pkg ... next to the .bzl files. This is because the //doc_build package is not loadable when rules_pkg itself is not the root Bazel module, because stardoc is a dev_dependency. So, //doc_build:rules_pkg_lib is not usable by clients of rules_pkg. Move the target to //pkg, next to the .bzl files. Also add @rules_python//python:defs_bzl used by pkg_install. Link: https://github.com/bazelbuild/rules_pkg/issues/897 Signed-off-by: HONG Yifan --- doc_build/BUILD | 10 ++-------- pkg/BUILD | 13 +++++++++++++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/doc_build/BUILD b/doc_build/BUILD index d45155b0..a6f9d883 100644 --- a/doc_build/BUILD +++ b/doc_build/BUILD @@ -19,7 +19,6 @@ How to: git commit -m 'update docs' docs/latest.md """ -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("@rules_python//python:defs.bzl", "py_binary") load("@stardoc//stardoc:stardoc.bzl", "stardoc") load("//:version.bzl", "version") @@ -111,14 +110,9 @@ stardoc( ], ) -# gather all rules that should be documented -bzl_library( +alias( name = "rules_pkg_lib", - srcs = [ - "//:version.bzl", - "//pkg:bzl_srcs", - "@bazel_skylib//lib:paths", - ], + actual = "//pkg:rules_pkg_lib", visibility = ["//visibility:public"], ) diff --git a/pkg/BUILD b/pkg/BUILD index b3115f58..fecaba40 100644 --- a/pkg/BUILD +++ b/pkg/BUILD @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("@rules_pkg//pkg/private:make_starlark_library.bzl", "starlark_library") # -*- coding: utf-8 -*- @@ -65,6 +66,18 @@ starlark_library( visibility = ["//visibility:public"], ) +# gather all rules that should be documented +bzl_library( + name = "rules_pkg_lib", + srcs = [ + "//:version.bzl", + "//pkg:bzl_srcs", + "@bazel_skylib//lib:paths", + "@rules_python//python:defs_bzl", + ], + visibility = ["//visibility:public"], +) + # Used by pkg_rpm in rpm.bzl. py_binary( name = "make_rpm",