-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.bazel
48 lines (43 loc) · 1.33 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
load("@gazelle//:def.bzl", "gazelle")
load("@rules_go//go:def.bzl", "go_library", "go_test")
load("helper.bzl", "cross_compile_binary")
load("platforms.bzl", "PLATFORMS")
# Name of the binary
NAME = "smart-dns-updater"
# gazelle:prefix github.com/imeyer/smart-dns-updater
gazelle(name = "gazelle")
go_library(
name = "{}_lib".format(NAME),
srcs = ["main.go"],
importpath = "github.com/imeyer/{}".format(NAME),
visibility = ["//visibility:private"],
x_defs = {
"version": "{STABLE_VERSION}",
"gitSha": "{STABLE_GIT_SHA}",
},
deps = [
"@com_github_burntsushi_toml//:toml",
"@com_github_miekg_dns//:dns",
"@com_github_prometheus_client_golang//prometheus",
"@com_github_prometheus_client_golang//prometheus/promhttp",
"@org_golang_google_api//dns/v1:dns",
],
)
# Create go_binary targets for each platform-arch combination
[cross_compile_binary(
name = NAME,
goarch = goarch,
goos = goos,
) for (goos, goarch) in PLATFORMS]
go_test(
name = "{}_test".format(NAME),
size = "small",
srcs = ["main_test.go"],
embed = [":{}_lib".format(NAME)],
deps = [
"@com_github_miekg_dns//:dns",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//mock",
"@com_github_stretchr_testify//require",
],
)