diff --git a/doc_build/BUILD b/doc_build/BUILD index d45155b0..00cfaba4 100644 --- a/doc_build/BUILD +++ b/doc_build/BUILD @@ -116,8 +116,9 @@ bzl_library( name = "rules_pkg_lib", srcs = [ "//:version.bzl", + ], + deps = [ "//pkg:bzl_srcs", - "@bazel_skylib//lib:paths", ], visibility = ["//visibility:public"], ) diff --git a/pkg/BUILD b/pkg/BUILD index b3115f58..df6fd252 100644 --- a/pkg/BUILD +++ b/pkg/BUILD @@ -12,9 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_pkg//pkg/private:make_starlark_library.bzl", "starlark_library") - # -*- coding: utf-8 -*- +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("@rules_python//python:defs.bzl", "py_binary", "py_library") package(default_applicable_licenses = ["//:license"]) @@ -51,7 +50,7 @@ filegroup( ], ) -starlark_library( +bzl_library( name = "bzl_srcs", srcs = [ ":standard_package", @@ -62,6 +61,10 @@ starlark_library( "//pkg/private/zip:standard_package", "//pkg/releasing:standard_package", ], + deps = [ + "@rules_python//python:defs_bzl", + "@bazel_skylib//lib:paths", + ], visibility = ["//visibility:public"], ) diff --git a/pkg/private/make_starlark_library.bzl b/pkg/private/make_starlark_library.bzl deleted file mode 100644 index c6b0dee9..00000000 --- a/pkg/private/make_starlark_library.bzl +++ /dev/null @@ -1,35 +0,0 @@ -"""Turn a label_list of mixed sources and bzl_library's into a bzl_library. - -The sources can be anything. Only the ones that end in ".bzl" will be added. -""" - -load("@bazel_skylib//:bzl_library.bzl", "StarlarkLibraryInfo") - -def _make_starlark_library(ctx): - direct = [] - transitive = [] - for src in ctx.attr.srcs: - if StarlarkLibraryInfo in src: - transitive.append(src[StarlarkLibraryInfo]) - else: - for file in src[DefaultInfo].files.to_list(): - if file.path.endswith(".bzl"): - # print(file.path) - direct.append(file) - all_files = depset(direct, transitive = transitive) - return [ - DefaultInfo(files = all_files, runfiles = ctx.runfiles(transitive_files = all_files)), - StarlarkLibraryInfo(srcs = direct, transitive_srcs = all_files), - ] - -starlark_library = rule( - implementation = _make_starlark_library, - attrs = { - "srcs": attr.label_list( - doc = "Any mix of source files. Only .bzl files will be used.", - allow_files = True, - cfg = "exec", - mandatory = True, - ), - }, -)