This repository has been archived by the owner on Dec 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WORKSPACE
311 lines (226 loc) · 9.38 KB
/
WORKSPACE
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
# Bazel workspace created by @bazel/create 2.3.0
# Declares that this directory is the root of a Bazel workspace.
# See https://docs.bazel.build/versions/master/build-ref.html#workspace
# **********************************
# CH01 - Variables
# CH01 - Python
# CH02 - Skylib
# CH03 - NodeJS
# CH04 - Golang
# CH05 - Gazelle
# CH06 - Google Protobuf
# CH07 - TypeScript
# CH08 - SASS
# CH09 - Docker
# **********************************
workspace(
# How this workspace would be referenced with absolute labels from another workspace
name = "oswee",
# Map the @npm bazel workspace to the node_modules directory.
# This lets Bazel use the same node_modules as other local tooling.
managed_directories = {"@npm": ["node_modules"]},
)
# **********************************
# Variables
# **********************************
NODEJS_VERSION = "15.2.1"
NODEJS_SHA256 = "a13dc3282312f8e862b02e5aacd93a7dffe5b01d55f60f3a6042b10523b5d7b3"
YARN_VERSION = "1.22.10"
YARN_SHA256 = "7e433d4a77e2c79e6a7ae4866782608a8e8bcad3ec6783580577c59538381a6e"
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
# **********************************
# Python
# ----------------------------------
# Required for rules_docker to work properly
# **********************************
http_archive(
name = "rules_python",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.1.0/rules_python-0.1.0.tar.gz",
sha256 = "b6d46438523a3ec0f3cead544190ee13223a52f6a6765a29eae7b7cc24cc83a0",
)
# **********************************
# Skylib
# **********************************
http_archive(
name = "bazel_skylib",
urls = [
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
],
sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
)
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()
load("@bazel_skylib//lib:versions.bzl", "versions")
versions.check(minimum_bazel_version = "3.7.0")
# **********************************
# NodeJS
# **********************************
# Install the nodejs "bootstrap" package
# This provides the basic tools for running and packaging nodejs programs in Bazel
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "452bef42c4b2fbe0f509a2699ffeb3ae2c914087736b16314dbd356f3641d7e5",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/2.3.0/rules_nodejs-2.3.0.tar.gz"],
)
# The yarn_install rule runs yarn anytime the package.json or yarn.lock file changes.
# It also extracts and installs any Bazel rules distributed in an npm package.
load("@build_bazel_rules_nodejs//:index.bzl", "check_bazel_version", "node_repositories", "yarn_install")
# The minimum bazel version to use with this repo is v3.7.0.
check_bazel_version(
minimum_bazel_version = "3.7.0",
)
node_repositories(
# name = "nodejs", # This is build in name, included in this comment for the clarity
node_version = NODEJS_VERSION,
yarn_version = YARN_VERSION,
# OPTIONAL
yarn_repositories = {
"%s" % YARN_VERSION: ("yarn-v%s.tar.gz" % YARN_VERSION, "yarn-v%s" % YARN_VERSION, "%s" % YARN_SHA256),
},
node_repositories = {
"%s-linux_amd64" % NODEJS_VERSION: ("node-v%s-linux-x64.tar.xz" % NODEJS_VERSION, "node-v%s-linux-x64" % NODEJS_VERSION, "%s" % NODEJS_SHA256),
},
package_json = ["//:package.json"],
preserve_symlinks = True,
)
yarn_install(
# Name this npm so that Bazel Label references look like @npm//package
name = "npm",
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
symlink_node_modules = True, # Expose installed packages for the IDE and the developer. See managed_directories.
)
# **********************************
# Golang
# **********************************
http_archive(
name = "io_bazel_rules_go",
sha256 = "207fad3e6689135c5d8713e5a17ba9d1290238f47b9ba545b63d9303406209c6",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.24.7/rules_go-v0.24.7.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/v0.24.7/rules_go-v0.24.7.tar.gz",
],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(
go_version = "1.15.5",
)
load("@io_bazel_rules_go//extras:embed_data_deps.bzl", "go_embed_data_dependencies")
go_embed_data_dependencies()
# Examples
# - https://github.com/buildbuddy-io/buildbuddy/blob/feeff7d86fc266c93f05c46f7dab5d9462cca7f7/WORKSPACE
# **********************************
# Gazelle
# **********************************
http_archive(
name = "bazel_gazelle",
sha256 = "b85f48fa105c4403326e9525ad2b2cc437babaa6e15a3fc0b1dbab0ab064bc7c",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.2/bazel-gazelle-v0.22.2.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.2/bazel-gazelle-v0.22.2.tar.gz",
],
)
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
gazelle_dependencies()
load("//:third_party/repositories.bzl", "go_repositories")
# gazelle:repository_macro third_party/repositories.bzl%go_repositories
go_repositories()
# **********************************
# Google Protobuf
# **********************************
http_archive(
name = "com_google_protobuf",
sha256 = "1c744a6a1f2c901e68c5521bc275e22bdc66256eeb605c2781923365b7087e5f",
strip_prefix = "protobuf-3.13.0",
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.13.0.zip"],
)
load("@com_google_protobuf//:protobuf_deps.bzl","protobuf_deps")
protobuf_deps()
http_archive(
name = "rules_proto",
sha256 = "602e7161d9195e50246177e7c55b2f39950a9cf7366f74ed5f22fd45750cd208",
strip_prefix = "rules_proto-97d8af4dc474595af3900dd85cb3a29ad28cc313",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz",
"https://github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz",
],
)
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
rules_proto_dependencies()
rules_proto_toolchains()
# Install any Bazel rules which were extracted earlier by the yarn_install rule.
# load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
# install_bazel_dependencies()
# http_archive(
# name = "googleapi",
# sha256 = "51849d3ef693c88eb7692875eb444ef7131502e3fa200f25fc0a37b1e7e55ab5",
# strip_prefix = "googleapis-a111a53c0c6722afcd793b64724ceef7862db5b9",
# url = "https://github.com/googleapis/googleapis/archive/a111a53c0c6722afcd793b64724ceef7862db5b9.zip",
# )
# **********************************
# TypeScript
# **********************************
# load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace")
# ts_setup_workspace()
# Load labs dependencies. (for ts_proto_library)
load("@npm//@bazel/labs:package.bzl", "npm_bazel_labs_dependencies")
npm_bazel_labs_dependencies()
# **********************************
# SASS
# **********************************
# **********************************
# Docker
# **********************************
http_archive(
name = "io_bazel_rules_docker",
# patches = ["//:rules_docker.pr1650.patch"],
sha256 = "1698624e878b0607052ae6131aa216d45ebb63871ec497f26c67455b34119c80",
strip_prefix = "rules_docker-0.15.0",
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.15.0/rules_docker-v0.15.0.tar.gz"],
)
load("@io_bazel_rules_docker//toolchains/docker:toolchain.bzl",
docker_toolchain_configure="toolchain_configure"
)
docker_toolchain_configure(
name = "docker_config",
# OPTIONAL: Path to a directory which has a custom docker client config.json.
# See https://docs.docker.com/engine/reference/commandline/cli/#configuration-files
# for more details.
#client_config="<enter absolute path to your docker config directory here>",
# OPTIONAL: Path to the docker binary.
# Should be set explicitly for remote execution.
docker_path="/usr/bin/podman",
# OPTIONAL: Path to the gzip binary.
gzip_path="/usr/bin/gzip",
# OPTIONAL: Bazel target for the gzip tool.
#gzip_target="<enter absolute path (i.e., must start with repo name @...//:...) to an executable gzip target>",
# OPTIONAL: Path to the xz binary.
# Should be set explicitly for remote execution.
xz_path="/usr/bin/xz",
# OPTIONAL: List of additional flags to pass to the docker command.
docker_flags = [
# "--tls",
"--log-level=info",
],
)
load(
"@io_bazel_rules_docker//repositories:repositories.bzl",
container_repositories = "repositories",
)
container_repositories()
load("@io_bazel_rules_docker//repositories:deps.bzl", container_deps = "deps")
container_deps()
load("@io_bazel_rules_docker//container:container.bzl", "container_pull")
container_pull(
name = "alpine_linux_amd64",
registry = "index.docker.io",
repository = "library/alpine",
tag = "3.8",
)
# load("@io_bazel_rules_docker//repositories:pip_repositories.bzl", "pip_deps")
# pip_deps()
# load("@io_bazel_rules_docker//go:image.bzl", _go_image_repos = "repositories")
# _go_image_repos()