This repository has been archived by the owner on May 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
BUILD.bazel
116 lines (101 loc) · 2.41 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier", "buildifier_test")
load("//rules/py/vendorred:pypi.bzl", "entry_point")
package(default_visibility = ["//visibility:public"])
# export default pyproject.toml config
filegroup(
name = "pyproject",
srcs = ["pyproject.toml"],
)
exports_files([
"pyproject.toml",
"README.md",
"yarn.lock",
])
[
alias(
name = tool,
actual = entry_point(tool),
)
for tool in [
"black",
"isort",
"ruff",
]
]
genrule(
name = "make-pypi-requirements",
srcs = ["@pypi//:requirements.bzl"],
outs = ["pypi.clean.bzl"],
cmd = " | ".join([
"cat $<",
"cat >$@",
]),
)
write_file(
name = "gen-pypi-starlark",
out = "update-pypi.sh",
content = [
# This depends on bash, which is not going to work on Windows.
"#!/usr/bin/env bash",
"cd $BUILD_WORKSPACE_DIRECTORY",
"cp -fv bazel-bin/pypi.clean.bzl rules/py/vendorred/pypi.bzl",
],
)
sh_binary(
name = "vendor-pypi",
srcs = ["update-pypi.sh"],
data = [":make-pypi-requirements"],
)
genrule(
name = "make-external-requirements",
srcs = ["@external//:requirements.bzl"],
outs = ["external.clean.bzl"],
cmd = " | ".join([
"cat $<",
"cat >$@",
]),
)
write_file(
name = "gen-external-starlark",
out = "update-external.sh",
content = [
# This depends on bash, which is not going to work on Windows.
"#!/usr/bin/env bash",
"cd $BUILD_WORKSPACE_DIRECTORY",
"cp -fv bazel-bin/external.clean.bzl rules/py/vendorred/external.bzl",
],
)
sh_binary(
name = "vendor-external",
srcs = ["update-external.sh"],
data = [":make-external-requirements"],
)
alias(
name = "flake8",
actual = "//rules/py:flake8",
)
alias(
name = "buildozer",
actual = "@com_github_bazelbuild_buildtools//buildozer",
)
buildifier(
name = "buildfmt",
exclude_patterns = ["./rules/py/vendorred/*"],
)
buildifier_test(
name = "buildcheck",
srcs = glob([
"**/*.bzl",
"**/*.bazel",
"monitoring/**/*/BUILD",
]),
exclude_patterns = ["./rules/py/vendorred/*"],
no_sandbox = True,
verbose = True,
workspace = "//:WORKSPACE",
)
alias(
name = "pyright",
actual = "@npm//:node_modules/pyright/index.js",
)