-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD.bazel
95 lines (84 loc) · 2.88 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
load("@bazel_gazelle//:def.bzl", "DEFAULT_LANGUAGES", "gazelle", "gazelle_binary")
load("@rules_python//gazelle:def.bzl", "GAZELLE_PYTHON_RUNTIME_DEPS")
load("@com_github_ash2k_bazel_tools//multirun:def.bzl", "command", "multirun")
##### Gazelle configration options
# https://github.com/bazelbuild/bazel-gazelle#running-gazelle-with-bazel
# gazelle:prefix github.com/TerrenceHo/monorepo
# gazelle:build_file_name BUILD.bazel
#
# Exclusions
# gazelle:exclude */vendor
# gazelle:exclude .bazel
# gazelle:exclude bazel-out
# gazelle:exclude **/node_modules
# gazelle:exclude third_party
# gazelle:exclude *_test.go
# Being explicit about naming conventions
# gazelle:go_naming_convention import
# gazelle:go_naming_convention_external import
# gazelle:map_kind go_binary go_binary //bazel/go:default.bzl
# gazelle:map_kind go_library go_library //bazel/go:default.bzl
# gazelle:map_kind go_test go_test //bazel/go:default.bzl
# gazelle:map_kind py_binary py_binary //bazel/python:rules.bzl
# gazelle:map_kind py_library py_library //bazel/python:rules.bzl
# gazelle:map_kind py_test py_test //bazel/python:rules.bzl
# For each Python project, add it as a root, so that the imports don't have to
# be relative from the root of the monorepo, which makes it more Pythonic in
# terms of classic project setup.
# gazelle:python_root //example-python
gazelle_binary(
name = "gazelle_binary",
languages = DEFAULT_LANGUAGES + [
"@rules_python//gazelle", # use gazelle from rules_python
],
visibility = ["//visibility:public"],
)
gazelle(
name = "gazelle",
data = GAZELLE_PYTHON_RUNTIME_DEPS,
gazelle = "//:gazelle_binary",
)
# update_build_files is a convenience target. See
# https://github.com/bazelbuild/bazel-gazelle#update-repos.
gazelle(
name = "update_build_files",
command = "update",
data = GAZELLE_PYTHON_RUNTIME_DEPS,
gazelle = "//:gazelle_binary",
)
# check_build_files diffs which BUILD files are going to change. Exits with code
# 1 if files need to change, else code 0.
gazelle(
name = "check_build_files",
command = "update",
data = GAZELLE_PYTHON_RUNTIME_DEPS,
extra_args = [
"-mode",
"diff",
],
gazelle = "//:gazelle_binary",
)
# update_go_deps is a convenience target. See
# https://github.com/bazelbuild/bazel-gazelle#update-repos.
gazelle(
name = "update_go_deps",
args = [
"-to_macro=bazel/go/deps.bzl%fetch_go_deps",
"-from_file=go.mod",
# -build_file_proto_mod=disable_global is set so that all pregenerated
# pb.go files are used for all external repos. Prevents lots of
# warnings.
# "-build_file_proto_mode=disable_global",
"-prune=true",
],
command = "update-repos",
)
##### CI Rules
# run all image pushing rules in parallel using multirun
multirun(
name = "push_all",
commands = [
"//fastlinks/cmd/fastlinks:push",
],
jobs = 0,
)