Skip to content

Commit a25b2cb

Browse files
alexeaglearrdemaspect-marvin
authored
chore: switch to bzl_library that checks docs (#655)
workaround bazelbuild/bazel-skylib#568 --------- Co-authored-by: Reid D. McKenzie <[email protected]> Co-authored-by: aspect-marvin[bot] <[email protected]>
1 parent 2ee2858 commit a25b2cb

File tree

10 files changed

+101
-21
lines changed

10 files changed

+101
-21
lines changed

BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ load("@rules_python_gazelle_plugin//modules_mapping:def.bzl", "modules_mapping")
88
# gazelle:exclude internal_deps.bzl
99
# gazelle:exclude py/tests/
1010
# gazelle:exclude examples/django
11+
# gazelle:map_kind bzl_library bzl_library @bazel_lib//:bzl_library.bzl
1112

1213
gazelle_python_manifest(
1314
name = "gazelle_python_manifest",

MODULE.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ module(
1111
# py_image_layer requires 2.x for the `tar` rule.
1212
# py_image_layer needs compute_unused_inputs attribute
1313
# py_image_layer needs repo_mapping fix.
14-
bazel_dep(name = "aspect_bazel_lib", version = "2.16.0")
14+
bazel_dep(name = "aspect_bazel_lib", version = "2.16.0") # TODO(alexeagle): remove
1515
bazel_dep(name = "aspect_tools_telemetry", version = "0.2.8")
16+
bazel_dep(name = "bazel_lib", version = "3.0.0-rc.0")
1617
bazel_dep(name = "bazel_skylib", version = "1.4.2")
1718
bazel_dep(name = "rules_python", version = "0.29.0")
1819
bazel_dep(name = "platforms", version = "0.0.7")

internal_deps.bzl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ def rules_py_internal_deps():
3939
],
4040
)
4141

42+
http_archive(
43+
name = "bazel_lib",
44+
sha256 = "0758ace949a93f709230a8e08ef35c5f0aacae2ff5d219b27da1d21d8233a709",
45+
strip_prefix = "bazel-lib-3.0.0-rc.0",
46+
url = "https://github.com/bazel-contrib/bazel-lib/releases/download/v3.0.0-rc.0/bazel-lib-v3.0.0-rc.0.tar.gz",
47+
)
48+
4249
# Override bazel_skylib distribution to fetch sources instead
4350
# so that the gazelle extension is included
4451
# see https://github.com/bazelbuild/bazel-skylib/issues/250

py/BUILD.bazel

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
1+
load("@bazel_lib//:bzl_library.bzl", "bzl_library")
22
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
33

44
# For stardoc to reference the files
@@ -19,6 +19,7 @@ bzl_library(
1919
visibility = ["//visibility:public"],
2020
deps = [
2121
"//py/private/toolchain:autodetecting",
22+
"@bazel_tools//tools/build_defs/repo:cache.bzl",
2223
"@bazel_tools//tools/build_defs/repo:http.bzl",
2324
"@bazel_tools//tools/build_defs/repo:utils.bzl",
2425
],
@@ -42,3 +43,32 @@ bzl_library(
4243
"@aspect_bazel_lib//lib:utils",
4344
],
4445
)
46+
47+
# This needs to dep on @aspect_tools_telemetry_report but we don't have that in WORKSPACE
48+
# gazelle:exclude extensions.bzl
49+
# bzl_library(
50+
# name = "extensions",
51+
# srcs = [
52+
# "extensions.bzl",
53+
# "@aspect_tools_telemetry_report//:defs.bzl",
54+
# ],
55+
# visibility = ["//visibility:public"],
56+
# deps = [
57+
# ":toolchains",
58+
# "//tools:version",
59+
# ],
60+
# )
61+
62+
bzl_library(
63+
name = "toolchains",
64+
srcs = ["toolchains.bzl"],
65+
visibility = ["//visibility:public"],
66+
deps = [
67+
"//py/private/toolchain:autodetecting",
68+
"//py/private/toolchain:repo",
69+
"//py/private/toolchain:tools",
70+
"//tools:version",
71+
"@aspect_bazel_lib//lib:repositories",
72+
"@bazel_tools//tools/build_defs/repo:http.bzl",
73+
],
74+
)

py/private/BUILD.bazel

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
1+
load("@bazel_lib//:bzl_library.bzl", "bzl_library")
22

33
package(default_visibility = [
44
"//docs:__pkg__",
@@ -87,18 +87,6 @@ bzl_library(
8787
],
8888
)
8989

90-
bzl_library(
91-
name = "providers",
92-
srcs = ["providers.bzl"],
93-
visibility = ["//py:__subpackages__"],
94-
)
95-
96-
bzl_library(
97-
name = "py_executable",
98-
srcs = ["py_executable.bzl"],
99-
visibility = ["//py:__subpackages__"],
100-
)
101-
10290
bzl_library(
10391
name = "py_pex_binary",
10492
srcs = ["py_pex_binary.bzl"],
@@ -110,11 +98,21 @@ bzl_library(
11098
)
11199

112100
bzl_library(
113-
name = "virtual",
114-
srcs = ["virtual.bzl"],
101+
name = "providers",
102+
srcs = ["providers.bzl"],
103+
)
104+
105+
bzl_library(
106+
name = "py_executable",
107+
srcs = ["py_executable.bzl"],
115108
)
116109

117110
bzl_library(
118111
name = "transitions",
119112
srcs = ["transitions.bzl"],
120113
)
114+
115+
bzl_library(
116+
name = "virtual",
117+
srcs = ["virtual.bzl"],
118+
)

py/private/py_venv/BUILD.bazel

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
1+
load("@bazel_lib//:bzl_library.bzl", "bzl_library")
22
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
33
load(":defs.bzl", "py_venv_test")
44

@@ -50,3 +50,9 @@ py_venv_test(
5050
imports = ["."],
5151
main = "test_link.py",
5252
)
53+
54+
bzl_library(
55+
name = "defs",
56+
srcs = ["defs.bzl"],
57+
deps = [":py_venv"],
58+
)

py/private/toolchain/BUILD.bazel

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
1+
load("@bazel_lib//:bzl_library.bzl", "bzl_library")
22
load(":tools.bzl", "resolved_venv_toolchain")
33

44
exports_files(
@@ -33,11 +33,27 @@ bzl_library(
3333
deps = ["//py/private:py_semantics"],
3434
)
3535

36+
bzl_library(
37+
name = "repo",
38+
srcs = ["repo.bzl"],
39+
visibility = ["//py:__subpackages__"],
40+
deps = [
41+
":tools",
42+
"//tools:integrity",
43+
"//tools:version",
44+
],
45+
)
46+
3647
bzl_library(
3748
name = "tools",
3849
srcs = ["tools.bzl"],
3950
visibility = [
4051
"//py:__subpackages__",
52+
"//tools:__subpackages__",
53+
],
54+
deps = [
55+
":types",
56+
"@bazel_skylib//lib:structs",
4157
],
4258
)
4359

py/repositories.bzl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ def http_archive(name, **kwargs):
2121
def rules_py_dependencies():
2222
"""Fetch rules_py's dependencies"""
2323

24+
http_archive(
25+
name = "bazel_lib",
26+
sha256 = "0758ace949a93f709230a8e08ef35c5f0aacae2ff5d219b27da1d21d8233a709",
27+
strip_prefix = "bazel-lib-3.0.0-rc.0",
28+
url = "https://github.com/bazel-contrib/bazel-lib/releases/download/v3.0.0-rc.0/bazel-lib-v3.0.0-rc.0.tar.gz",
29+
)
30+
2431
# The minimal version of bazel_skylib we require
2532
http_archive(
2633
name = "bazel_skylib",

py/unstable/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
1+
load("@bazel_lib//:bzl_library.bzl", "bzl_library")
22

33
# For stardoc to reference the files
44
exports_files(["defs.bzl"])
@@ -8,6 +8,6 @@ bzl_library(
88
srcs = ["defs.bzl"],
99
visibility = ["//visibility:public"],
1010
deps = [
11-
"//py/private/py_venv:defs.bzl",
11+
"//py/private/py_venv:defs",
1212
],
1313
)

tools/BUILD.bazel

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
load("@bazel_lib//:bzl_library.bzl", "bzl_library")
2+
3+
bzl_library(
4+
name = "version",
5+
srcs = ["version.bzl"],
6+
visibility = ["//visibility:public"],
7+
)
8+
9+
bzl_library(
10+
name = "integrity",
11+
srcs = ["integrity.bzl"],
12+
visibility = ["//visibility:public"],
13+
deps = ["//py/private/toolchain:tools"],
14+
)

0 commit comments

Comments
 (0)