-
Notifications
You must be signed in to change notification settings - Fork 1
/
BUILD.bazel
160 lines (148 loc) · 4.02 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
load("@bazel_gazelle//:def.bzl", "gazelle")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("//:version.bzl", "VERSION")
# gazelle:prefix github.com/kindlyops/deleterious
# gazelle:exclude dummy.go
gazelle(
name = "gazelle",
external = "vendored",
)
go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "github.com/kindlyops/deleterious",
visibility = ["//visibility:private"],
deps = ["//cmd:go_default_library"],
)
go_binary(
name = "deleterious-linux",
embed = [":go_default_library"],
goarch = "amd64",
goos = "linux",
visibility = ["//visibility:public"],
x_defs = {
"version": VERSION,
},
)
go_binary(
name = "deleterious-linux-arm",
embed = [":go_default_library"],
goarch = "arm64",
goos = "linux",
visibility = ["//visibility:public"],
x_defs = {
"version": VERSION,
},
)
go_binary(
name = "deleterious-darwin",
embed = [":go_default_library"],
goarch = "amd64",
goos = "darwin",
visibility = ["//visibility:public"],
x_defs = {
"version": VERSION,
},
)
go_binary(
name = "deleterious-darwin-m1",
embed = [":go_default_library"],
goarch = "amd64",
goos = "darwin",
visibility = ["//visibility:public"],
x_defs = {
"version": VERSION,
},
)
go_binary(
name = "deleterious-windows",
embed = [":go_default_library"],
goarch = "amd64",
goos = "windows",
visibility = ["//visibility:public"],
x_defs = {
"version": VERSION,
},
)
alias(
name = "deleterious",
actual = select({
"@io_bazel_rules_go//go/platform:linux_amd64": ":deleterious-linux",
"@io_bazel_rules_go//go/platform:linux_arm64": ":deleterious-linux-arm",
"@io_bazel_rules_go//go/platform:darwin_amd64": ":deleterious-darwin",
"@io_bazel_rules_go//go/platform:darwin_arm64": ":deleterious-darwin-m1",
"@io_bazel_rules_go//go/platform:windows_amd64": ":deleterious-windows",
"//conditions:default": ":vbs-linux",
}),
)
pkg_tar(
name = "bdist",
srcs = [
"//:deleterious-darwin",
"//:deleterious-darwin-m1",
"//:deleterious-linux",
"//:deleterious-linux-arm",
"//:deleterious-windows",
],
tags = ["manual"],
visibility = ["//visibility:private"],
)
sh_binary(
name = "install",
srcs = ["install.sh"],
args = ["$(location :bdist.tar)"],
data = [":bdist.tar"],
tags = ["manual"],
)
go_test(
name = "go_default_test",
size = "small",
srcs = ["main_test.go"],
args = ["-cli"] + select({
"@io_bazel_rules_go//go/platform:linux_amd64": [
"$(location :deleterious-linux)",
],
"@io_bazel_rules_go//go/platform:linux_arm64": [
"$(location :deleterious-linux-arm)",
],
"@io_bazel_rules_go//go/platform:darwin_amd64": [
"$(location :deleterious-darwin)",
],
"@io_bazel_rules_go//go/platform:darwin_arm64": [
"$(location :deleterious-darwin-m1)",
],
"//conditions:default": [],
}),
data = select({
"@io_bazel_rules_go//go/platform:linux_amd64": [
":deleterious-linux",
],
"@io_bazel_rules_go//go/platform:linux_arm64": [
":deleterious-linux-arm",
],
"@io_bazel_rules_go//go/platform:darwin_amd64": [
":deleterious-darwin",
],
"@io_bazel_rules_go//go/platform:darwin_arm64": [
":deleterious-darwin-m1",
],
"//conditions:default": [],
}),
embed = [":go_default_library"],
rundir = ".",
deps = ["//vendor/github.com/bazelbuild/rules_go/go/tools/bazel"],
)
sh_binary(
name = "vendor",
srcs = ["vendor.sh"],
args = [
"$(location @bazel_gazelle//cmd/gazelle)",
],
data = [
"@bazel_gazelle//cmd/gazelle",
"@go_sdk//:files",
],
tags = ["manual"],
visibility = ["//visibility:public"],
)