-
Notifications
You must be signed in to change notification settings - Fork 322
/
BUILD
152 lines (140 loc) · 3.29 KB
/
BUILD
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
load("@aspect_rules_js//npm:defs.bzl", "npm_package", "stamped_package_json")
load("@gazelle//:def.bzl", "gazelle")
load("@rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
# gazelle:ignore
# gazelle:prefix github.com/bazelbuild/bazelisk
gazelle(name = "gazelle")
sh_test(
name = "py_bazelisk_test",
srcs = ["bazelisk_test.sh"],
args = ["PY"],
data = [
"bazelisk.py",
"releases_for_tests.json",
],
deps = ["@bazel_tools//tools/bash/runfiles"],
)
sh_test(
name = "py3_bazelisk_test",
srcs = ["bazelisk_test.sh"],
args = ["PY3"],
data = [
"bazelisk.py",
"releases_for_tests.json",
],
deps = ["@bazel_tools//tools/bash/runfiles"],
)
sh_test(
name = "go_bazelisk_test",
srcs = ["bazelisk_test.sh"],
args = ["GO"],
data = [
"releases_for_tests.json",
":bazelisk",
],
deps = ["@bazel_tools//tools/bash/runfiles"],
size = "large",
)
go_library(
name = "bazelisk_lib",
srcs = ["bazelisk.go"],
importpath = "github.com/bazelbuild/bazelisk",
visibility = ["//visibility:private"],
deps = [
"//core",
"//repositories",
],
)
go_test(
name = "bazelisk_version_test",
srcs = ["bazelisk_version_test.go"],
data = [
"sample-issues-migration.json",
],
embed = [":bazelisk_lib"],
importpath = "github.com/bazelbuild/bazelisk",
deps = [
"//config",
"//core",
"//httputil",
"//repositories",
"//versions",
],
)
go_binary(
name = "bazelisk",
embed = [":bazelisk_lib"],
visibility = ["//visibility:public"],
)
[
go_binary(
name = "bazelisk-%s-%s" % (os, arch),
out = "bazelisk-%s_%s" % (os, arch),
embed = [":bazelisk_lib"],
gc_linkopts = [
"-s",
"-w",
],
goarch = arch,
goos = os,
pure = "on",
visibility = ["//visibility:public"],
)
for os, arch in [
("darwin", "amd64"),
("darwin", "arm64"),
("linux", "amd64"),
("linux", "arm64")
]
]
[
go_binary(
name = "bazelisk-%s-%s" % (os, arch),
out = "bazelisk-%s_%s.exe" % (os, arch),
embed = [":bazelisk_lib"],
goarch = arch,
goos = os,
pure = "on",
visibility = ["//visibility:public"],
)
for os, arch in [
("windows", "amd64"),
("windows", "arm64")
]
]
genrule(
name = "bazelisk-darwin-universal",
srcs = [
":bazelisk-darwin-amd64",
":bazelisk-darwin-arm64",
],
outs = ["bazelisk-darwin_universal"],
cmd = "lipo -create -output \"$@\" $(SRCS)",
output_to_bindir = 1,
target_compatible_with = [
"@platforms//os:macos",
],
)
stamped_package_json(
name = "package",
# This key is defined by /stamp.sh
stamp_var = "BUILD_SCM_VERSION",
)
npm_package(
name = "npm_package",
srcs = [
"LICENSE",
"README.md",
"bazelisk.d.ts",
"bazelisk.js",
":bazelisk-darwin-amd64",
":bazelisk-darwin-arm64",
":bazelisk-linux-amd64",
":bazelisk-linux-arm64",
":bazelisk-windows-amd64",
":bazelisk-windows-arm64",
":package",
],
package = "@bazel/bazelisk",
publishable = True,
)