-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathBUILD.bazel
99 lines (85 loc) · 2.21 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
load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_test")
load("@bazeldnf//:def.bzl", "bazeldnf")
load("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test")
load("@rules_multirun//:defs.bzl", "command", "multirun")
exports_files([
"MODULE.bazel",
])
# gazelle:prefix source.monogon.dev
# gazelle:go_naming_convention import
# gazelle:exclude **/gomod-generated-placeholder.go
# gazelle:exclude .bazeldnf/**
gazelle(name = "gazelle")
gazelle_test(
name = "gazelle_test",
workspace = "//:MODULE.bazel",
)
BUILDIFIER_EXCLUDES = [
"./.git/*",
"./.ijwb/*",
]
# Buildifier formats all Starlark files.
buildifier(
name = "buildifier",
exclude_patterns = BUILDIFIER_EXCLUDES,
lint_mode = "fix",
mode = "fix",
)
buildifier_test(
name = "buildifier_test",
exclude_patterns = BUILDIFIER_EXCLUDES,
lint_mode = "warn",
lint_warnings = [
"-module-docstring",
"-function-docstring-args",
"-function-docstring",
"-function-docstring-header",
"-function-docstring-return",
"-unnamed-macro", #TODO(tim): Update code to pass this
],
no_sandbox = True,
workspace = "//:MODULE.bazel",
)
# Shortcut for the Go SDK
alias(
name = "go",
actual = "@io_bazel_rules_go//go",
visibility = ["//visibility:public"],
)
# bazeldnf binary
bazeldnf(name = "bazeldnf")
# Shortcuts for top-level binaries/tools
# Shortcut for kubectl when running through bazel run
# (don't depend on this, it might turn into an env-based PATH shortcut, use
# @io_k8s_kubernetes//cmd/kubectl instead)
alias(
name = "kubectl",
actual = "@io_k8s_kubernetes//cmd/kubectl:kubectl",
)
# Shortcut for the Delve debugger for interactive debugging
alias(
name = "dlv",
actual = "@com_github_go_delve_delve//cmd/dlv:dlv",
)
alias(
name = "goimports",
actual = "@org_golang_x_tools//cmd/goimports:goimports",
visibility = ["//visibility:public"],
)
command(
name = "go-mod-tidy",
arguments = [
"mod",
"tidy",
],
command = ":go",
)
# Shortcut to update go.mod, gazelle files and formatting.
multirun(
name = "tidy",
commands = [
":go-mod-tidy",
":gazelle",
":buildifier",
],
)