forked from aspect-build/aspect-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.bazel
144 lines (132 loc) · 5.77 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")
load("@bazel_gazelle//:def.bzl", "gazelle")
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
load("@io_bazel_rules_go//go:def.bzl", "nogo")
load("@npm//:defs.bzl", "npm_link_all_packages")
cc_binary(
name = "hello",
srcs = ["src.c"],
)
npm_link_all_packages(name = "node_modules")
# When generating the documents for this repo bazel needs to be started so that we can generate
# the correct flags. To do this we need version from .bazelversion
exports_files([
".bazelversion",
"LICENSE",
"README.md",
])
nogo(
name = "nogo",
config = "nogo_config.json",
visibility = ["//visibility:public"],
deps = [
"@org_golang_x_tools//go/analysis/passes/asmdecl",
"@org_golang_x_tools//go/analysis/passes/assign",
"@org_golang_x_tools//go/analysis/passes/atomic",
"@org_golang_x_tools//go/analysis/passes/atomicalign",
"@org_golang_x_tools//go/analysis/passes/bools",
"@org_golang_x_tools//go/analysis/passes/buildssa",
"@org_golang_x_tools//go/analysis/passes/buildtag",
"@org_golang_x_tools//go/analysis/passes/cgocall",
"@org_golang_x_tools//go/analysis/passes/composite",
"@org_golang_x_tools//go/analysis/passes/copylock",
"@org_golang_x_tools//go/analysis/passes/ctrlflow",
"@org_golang_x_tools//go/analysis/passes/deepequalerrors",
"@org_golang_x_tools//go/analysis/passes/errorsas",
"@org_golang_x_tools//go/analysis/passes/findcall",
"@org_golang_x_tools//go/analysis/passes/framepointer",
"@org_golang_x_tools//go/analysis/passes/httpresponse",
"@org_golang_x_tools//go/analysis/passes/ifaceassert",
"@org_golang_x_tools//go/analysis/passes/inspect",
"@org_golang_x_tools//go/analysis/passes/loopclosure",
"@org_golang_x_tools//go/analysis/passes/lostcancel",
"@org_golang_x_tools//go/analysis/passes/nilfunc",
"@org_golang_x_tools//go/analysis/passes/nilness",
"@org_golang_x_tools//go/analysis/passes/pkgfact",
"@org_golang_x_tools//go/analysis/passes/printf",
"@org_golang_x_tools//go/analysis/passes/reflectvaluecompare",
"@org_golang_x_tools//go/analysis/passes/shadow",
"@org_golang_x_tools//go/analysis/passes/shift",
"@org_golang_x_tools//go/analysis/passes/sigchanyzer",
"@org_golang_x_tools//go/analysis/passes/sortslice",
"@org_golang_x_tools//go/analysis/passes/stdmethods",
"@org_golang_x_tools//go/analysis/passes/stringintconv",
"@org_golang_x_tools//go/analysis/passes/structtag",
"@org_golang_x_tools//go/analysis/passes/testinggoroutine",
"@org_golang_x_tools//go/analysis/passes/tests",
"@org_golang_x_tools//go/analysis/passes/unmarshal",
"@org_golang_x_tools//go/analysis/passes/unreachable",
"@org_golang_x_tools//go/analysis/passes/unsafeptr",
"@org_golang_x_tools//go/analysis/passes/unusedresult",
"@org_golang_x_tools//go/analysis/passes/unusedwrite",
"@org_golang_x_tools//go/analysis/passes/usesgenerics",
],
)
# gazelle:prefix aspect.build/cli
# gazelle:exclude **/*.pb.go
# gazelle:resolve go github.com/bazelbuild/buildtools/edit @com_github_bazelbuild_buildtools//edit:go_default_library
# gazelle:resolve go github.com/bazelbuild/buildtools/build @com_github_bazelbuild_buildtools//build:go_default_library
# gazelle-TODO:
# cannot use :map_kind go_proto_library go_proto_library //:go_proto_library.bzl
# because we need gazelle to understand the built-in kind, see https://github.com/bazelbuild/bazel-gazelle/issues/1162
# so instead we are using the aspect-build/rules_go fork which has our write_source_files feature
gazelle(name = "gazelle")
gazelle(
name = "gazelle_update_repos",
args = [
"-build_file_proto_mode=disable_global",
"-from_file=go.mod",
"-to_macro=go.bzl%deps",
"-prune",
],
command = "update-repos",
)
# Run this target to update all the generated .pb.go files in the repo:
# bazel run //:update_go_pb
#
# Note that each target also has a corresponding test asserting that the
# generated files stay up-to-date.
# Re-generate this list with:
# bazel 2>/dev/null query 'kind(go_proto_library, //...)' | xargs -I {} buildozer 'add additional_update_targets {}.update_go_pb' //:update_go_pb
write_source_files(
name = "update_go_pb",
additional_update_targets = [
"//bazel/analysis:bazel_go_proto.update_go_pb",
"//bazel/buildeventstream:buildeventstream_go_proto.update_go_pb",
"//bazel/command_line:command_line_go_proto.update_go_pb",
"//bazel/failure_details:failure_details_go_proto.update_go_pb",
"//bazel/flags:bazel_go_proto.update_go_pb",
"//bazel/invocation_policy:blaze_invocation_policy_go_proto.update_go_pb",
"//bazel/options:options_go_proto.update_go_pb",
"//bazel/query:blaze_query_aspect_mirror_go_proto.update_go_pb",
"//pkg/plugin/sdk/v1alpha1/proto:proto_go_proto.update_go_pb",
"//pkg/plugin/sdk/v1alpha2/proto:proto_go_proto.update_go_pb",
"//pkg/plugin/sdk/v1alpha3/proto:proto_go_proto.update_go_pb",
"//pkg/plugin/sdk/v1alpha4/proto:proto_go_proto.update_go_pb",
],
)
alias(
name = "aspect",
actual = "//cmd/aspect",
)
sh_binary(
name = "tidy",
srcs = ["tidy.sh"],
)
alias(
name = "go",
actual = "@go_sdk//:bin/go",
)
buildifier(
name = "buildifier.check",
# By default the diffs appear on stdout,
# but the rest of Buildifier appears on
# stderr making it harder to capture in Workflows,
# so we do a cheeky redirect here in the diff_command.
diff_command = "diff -U 5 >&2",
exclude_patterns = [
"./.git/*",
],
lint_mode = "warn",
mode = "diff",
)