forked from googleapis/googleapis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WORKSPACE
495 lines (370 loc) · 17.9 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
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
workspace(
name = "com_google_googleapis",
)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
##############################################################################
# Common
##############################################################################
load("//:repository_rules.bzl", "switched_rules_by_language")
switched_rules_by_language(
name = "com_google_googleapis_imports",
cc = True,
csharp = True,
gapic = True,
go = True,
grpc = True,
java = True,
nodejs = True,
php = True,
python = True,
ruby = True,
)
_bazel_skylib_version = "1.4.0"
_bazel_skylib_sha256 = "f24ab666394232f834f74d19e2ff142b0af17466ea0c69a3f4c276ee75f6efce"
http_archive(
name = "bazel_skylib",
sha256 = _bazel_skylib_sha256,
urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/{0}/bazel-skylib-{0}.tar.gz".format(_bazel_skylib_version)],
)
# Protobuf depends on very old version of rules_jvm_external.
# Importing older version of rules_jvm_external first (this is one of the things that protobuf_deps() call
# below will do) breaks the Java client library generation process, so importing the proper version explicitly before calling protobuf_deps().
RULES_JVM_EXTERNAL_TAG = "4.5"
RULES_JVM_EXTERNAL_SHA = "b17d7388feb9bfa7f2fa09031b32707df529f26c91ab9e5d909eb1676badd9a6"
http_archive(
name = "rules_jvm_external",
sha256 = RULES_JVM_EXTERNAL_SHA,
strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG,
)
load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")
rules_jvm_external_deps()
load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup")
rules_jvm_external_setup()
# Python rules should go early in the dependencies list, otherwise a wrong
# version of the library will be selected as a transitive dependency of gRPC.
_rules_python_version = "0.26.0"
_rules_python_sha256 = "9d04041ac92a0985e344235f5d946f71ac543f1b1565f2cdbc9a2aaee8adf55b"
http_archive(
name = "rules_python",
sha256 = _rules_python_sha256,
strip_prefix = "rules_python-{}".format(_rules_python_version),
url = "https://github.com/bazelbuild/rules_python/archive/{}.tar.gz".format(_rules_python_version),
)
http_archive(
name = "rules_pkg",
sha256 = "8a298e832762eda1830597d64fe7db58178aa84cd5926d76d5b744d6558941c2",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz",
"https://github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz",
],
)
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
rules_pkg_dependencies()
# This must be above the download of gRPC (in C++ section) and
# rules_gapic_repositories because both depend on rules_go and we need to manage
# our version of rules_go explicitly rather than depend on the version those
# bring in transitively.
_io_bazel_rules_go_version = "0.34.0"
http_archive(
name = "io_bazel_rules_go",
sha256 = "16e9fca53ed6bd4ff4ad76facc9b7b651a89db1689a2877d6fd7b82aa824e366",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v{0}/rules_go-v{0}.zip".format(_io_bazel_rules_go_version),
"https://github.com/bazelbuild/rules_go/releases/download/v{0}/rules_go-v{0}.zip".format(_io_bazel_rules_go_version),
],
)
##############################################################################
# C++
##############################################################################
# C++ must go before everything else, since the key dependencies (protobuf and gRPC)
# are C++ repositories and they have the highest chance to have the correct versions of the
# transitive dependencies (for those dependencies which are shared by many other repositories
# imported in this workspace).
#
# This comes before Protobuf's section, meaning we prioritize gRPC's dependencies
# (including upb and absl) over Protobuf's. Because the gRPC team prioritizes their
# own dependencies when they test gRPC and Protobuf compatibility, gRPC's dependencies have
# better chance to make it work.
#
# Note, even though protobuf and gRPC are mostly written in C++, they are used to generate stuff
# for most of the other languages as well, so they can be considered as the core cross-language
# dependencies.
# Import boringssl explicitly to override what gRPC imports as its dependency.
# Boringssl build fails on gcc12 without this fix:
# https://github.com/google/boringssl/commit/8462a367bb57e9524c3d8eca9c62733c63a63cf4,
# which is present only in the newest version of boringssl, not the one imported
# by gRPC. Remove this import once gRPC depends on a newer version.
http_archive(
name = "boringssl",
sha256 = "b460f8673f3393e58ce506e9cdde7f2c3b2575b075f214cb819fb57d809f052b",
strip_prefix = "boringssl-bb41bc007079982da419c0ec3186e510cbcf09d0",
urls = [
"https://github.com/google/boringssl/archive/bb41bc007079982da419c0ec3186e510cbcf09d0.zip",
],
)
_grpc_version = "1.55.1"
_grpc_sha256 = "17c0685da231917a7b3be2671a7b13b550a85fdda5e475313264c5f51c4da3f8"
http_archive(
name = "com_github_grpc_grpc",
sha256 = _grpc_sha256,
strip_prefix = "grpc-%s" % _grpc_version,
urls = ["https://github.com/grpc/grpc/archive/v%s.zip" % _grpc_version],
)
# Explicitly declaring Protobuf version, while Protobuf dependency is already
# instantiated in grpc_deps().
http_archive(
name = "com_google_protobuf",
sha256 = "0b0395d34e000f1229679e10d984ed7913078f3dd7f26cf0476467f5e65716f4",
strip_prefix = "protobuf-23.2",
urls = ["https://github.com/protocolbuffers/protobuf/archive/v23.2.tar.gz"],
)
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
grpc_deps()
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps", "PROTOBUF_MAVEN_ARTIFACTS")
# This is actually already done within grpc_deps but calling this for Bazel convention.
protobuf_deps()
# gRPC enforces a specific version of Go toolchain which conflicts with our build.
# All the relevant parts of grpc_extra_deps() are imported in this WORKSPACE file
# explicitly, that is why we do not call grpc_extra_deps() here and call
# apple_rules_dependencies and apple_support_dependencies macros explicitly.
load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies")
apple_rules_dependencies()
load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies")
apple_support_dependencies()
# End of C++ section
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()
##############################################################################
# Go
##############################################################################
# rules_gapic also depends on rules_go, so it must come after our own dependency on rules_go.
# It must also come before gapic-generator-go so as to ensure that it does not bring in an old
# version of rules_gapic.
_rules_gapic_version = "0.29.4"
http_archive(
name = "rules_gapic",
strip_prefix = "rules_gapic-%s" % _rules_gapic_version,
urls = ["https://github.com/googleapis/rules_gapic/archive/v%s.tar.gz" % _rules_gapic_version],
)
# Gazelle dependency version should match gazelle dependency expected by gRPC
_bazel_gazelle_version = "0.24.0"
http_archive(
name = "bazel_gazelle",
sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v{0}/bazel-gazelle-v{0}.tar.gz".format(_bazel_gazelle_version),
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v{0}/bazel-gazelle-v{0}.tar.gz".format(_bazel_gazelle_version),
],
)
# This overrides the package name @go_googleapis to point at this package,
# @com_google_googleapis, which has the latest versions of all protos and is the
# source of truth for those protos. This prevents rules_go from loading its own,
# conflicting copy of googleapis under this package name, which would create
# package collisions during compilation.
local_repository(
name = "go_googleapis",
path = ".",
)
_gapic_generator_go_version = "0.39.3"
http_archive(
name = "com_googleapis_gapic_generator_go",
strip_prefix = "gapic-generator-go-%s" % _gapic_generator_go_version,
urls = ["https://github.com/googleapis/gapic-generator-go/archive/v%s.tar.gz" % _gapic_generator_go_version],
)
load("@com_googleapis_gapic_generator_go//:repositories.bzl", "com_googleapis_gapic_generator_go_repositories")
com_googleapis_gapic_generator_go_repositories()
# rules_go and gazelle dependencies are loaded after gapic-generator-go
# dependencies to ensure that they do not override any of the go_repository
# dependencies of gapic-generator-go.
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_register_toolchains(version = "1.18.6")
go_rules_dependencies()
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
gazelle_dependencies()
load("@rules_gapic//:repositories.bzl", "rules_gapic_repositories")
rules_gapic_repositories()
##############################################################################
# Java
##############################################################################
# Starting in protobuf 3.19, protobuf project started to provide
# PROTOBUF_MAVEN_ARTIFACTS variable so that Bazel users can resolve their
# dependencies through maven_install.
# https://github.com/protocolbuffers/protobuf/issues/9132
load("@rules_jvm_external//:defs.bzl", "maven_install")
maven_install(
artifacts = PROTOBUF_MAVEN_ARTIFACTS,
generate_compat_repositories = True,
repositories = [
"https://repo.maven.apache.org/maven2/",
],
)
_gapic_generator_java_version = "2.29.0"
maven_install(
artifacts = [
"com.google.api:gapic-generator-java:" + _gapic_generator_java_version,
],
#Update this False for local development
fail_on_missing_checksum = True,
repositories = [
"m2Local",
"https://repo.maven.apache.org/maven2/",
]
)
http_archive(
name = "gapic_generator_java",
strip_prefix = "sdk-platform-java-%s" % _gapic_generator_java_version,
urls = ["https://github.com/googleapis/sdk-platform-java/archive/v%s.zip" % _gapic_generator_java_version],
)
# gax-java is part of sdk-platform-java repository
http_archive(
name = "com_google_api_gax_java",
strip_prefix = "sdk-platform-java-%s/gax-java" % _gapic_generator_java_version,
urls = ["https://github.com/googleapis/sdk-platform-java/archive/v%s.zip" % _gapic_generator_java_version],
)
load("@com_google_api_gax_java//:repository_rules.bzl", "com_google_api_gax_java_properties")
com_google_api_gax_java_properties(
name = "com_google_api_gax_java_properties",
file = "@com_google_api_gax_java//:dependencies.properties",
)
load("@com_google_api_gax_java//:repositories.bzl", "com_google_api_gax_java_repositories")
com_google_api_gax_java_repositories()
load("@io_grpc_grpc_java//:repositories.bzl", "grpc_java_repositories")
grpc_java_repositories()
##############################################################################
# Python
##############################################################################
load("@rules_gapic//python:py_gapic_repositories.bzl", "py_gapic_repositories")
py_gapic_repositories()
_gapic_generator_python_version = "1.13.0"
http_archive(
name = "gapic_generator_python",
strip_prefix = "gapic-generator-python-%s" % _gapic_generator_python_version,
urls = ["https://github.com/googleapis/gapic-generator-python/archive/v%s.zip" % _gapic_generator_python_version],
)
load(
"@gapic_generator_python//:repositories.bzl",
"gapic_generator_python",
"gapic_generator_register_toolchains",
)
load("@rules_python//python:repositories.bzl", "py_repositories")
py_repositories()
load("@rules_python//python:pip.bzl", "pip_parse")
pip_parse(
name = "gapic_generator_python_pip_deps",
requirements_lock = "@gapic_generator_python//:requirements.txt",
)
load("@gapic_generator_python_pip_deps//:requirements.bzl", "install_deps")
install_deps()
gapic_generator_python()
gapic_generator_register_toolchains()
##############################################################################
# TypeScript
##############################################################################
_gapic_generator_typescript_version = "4.2.0"
_gapic_generator_typescript_sha256 = "bcf2dcdc112f1a8bf24f0ab3b36c10bbf9a7bab22d947ca9cfb7f613fa6992ab"
### TypeScript generator
http_archive(
name = "gapic_generator_typescript",
sha256 = _gapic_generator_typescript_sha256,
strip_prefix = "gapic-generator-typescript-%s" % _gapic_generator_typescript_version,
urls = ["https://github.com/googleapis/gapic-generator-typescript/archive/v%s.tar.gz" % _gapic_generator_typescript_version],
)
load("@gapic_generator_typescript//:repositories.bzl", "gapic_generator_typescript_repositories", "NODE_VERSION")
gapic_generator_typescript_repositories()
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies")
rules_ts_dependencies(
ts_version_from = "@gapic_generator_typescript//:package.json",
)
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
nodejs_register_toolchains(
name = "nodejs",
node_version = NODE_VERSION,
)
load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock", "pnpm_repository")
npm_translate_lock(
name = "npm",
pnpm_lock = "@gapic_generator_typescript//:pnpm-lock.yaml",
data = ["@gapic_generator_typescript//:package.json"],
)
load("@npm//:repositories.bzl", "npm_repositories")
npm_repositories()
pnpm_repository(name = "pnpm")
##############################################################################
# PHP
##############################################################################
# PHP micro-generator
_gapic_generator_php_version = "1.10.0"
http_archive(
name = "gapic_generator_php",
strip_prefix = "gapic-generator-php-%s" % _gapic_generator_php_version,
urls = ["https://github.com/googleapis/gapic-generator-php/archive/v%s.zip" % _gapic_generator_php_version],
)
load("@rules_gapic//php:php_gapic_repositories.bzl", "php_gapic_repositories")
php_gapic_repositories()
load("@gapic_generator_php//:repositories.bzl", "gapic_generator_php_repositories")
gapic_generator_php_repositories()
##############################################################################
# C#
##############################################################################
# Required to access the C#-specific common resources config.
_gax_dotnet_version = "Google.Api.Gax-3.3.0"
_gax_dotnet_sha256 = "c4d31345a226987e8551cb81afa685c9322d3f806077d9f02011676cf00c15d9"
http_archive(
name = "gax_dotnet",
build_file_content = "exports_files([\"Google.Api.Gax/ResourceNames/CommonResourcesConfig.json\"])",
sha256 = _gax_dotnet_sha256,
strip_prefix = "gax-dotnet-%s" % _gax_dotnet_version,
urls = ["https://github.com/googleapis/gax-dotnet/archive/refs/tags/%s.tar.gz" % _gax_dotnet_version],
)
_gapic_generator_csharp_version = "1.4.20"
_gapic_generator_csharp_sha256 = "44e44378a5ce42fafeb7de811845541baa3a696969f57384c602f5b9047419a0"
http_archive(
name = "gapic_generator_csharp",
sha256 = _gapic_generator_csharp_sha256,
strip_prefix = "gapic-generator-csharp-%s" % _gapic_generator_csharp_version,
urls = ["https://github.com/googleapis/gapic-generator-csharp/archive/refs/tags/v%s.tar.gz" % _gapic_generator_csharp_version],
)
load("@gapic_generator_csharp//:repositories.bzl", "gapic_generator_csharp_repositories")
gapic_generator_csharp_repositories()
##############################################################################
# Ruby
##############################################################################
_gapic_generator_ruby_version = "v0.26.0"
_gapic_generator_ruby_sha256 = "64f7e5fac2fc27433b8d3935189dcd3106cb0945263b5abb53a7e8307517ca08"
http_archive(
name = "gapic_generator_ruby",
sha256 = _gapic_generator_ruby_sha256,
strip_prefix = "gapic-generator-ruby-gapic-generator-%s" % _gapic_generator_ruby_version,
urls = ["https://github.com/googleapis/gapic-generator-ruby/archive/refs/tags/gapic-generator/%s.tar.gz" % _gapic_generator_ruby_version],
)
load("@gapic_generator_ruby//rules_ruby_gapic:repositories.bzl", "gapic_generator_ruby_repositories")
gapic_generator_ruby_repositories()
##############################################################################
# Discovery
##############################################################################
_disco_to_proto3_converter_version = "74c0ede1e6871c878de6c3cab3ef152280c6518f"
http_archive(
name = "com_google_disco_to_proto3_converter",
strip_prefix = "disco-to-proto3-converter-%s" % _disco_to_proto3_converter_version,
urls = ["https://github.com/googleapis/disco-to-proto3-converter/archive/%s.zip" % _disco_to_proto3_converter_version],
)
load("@com_google_disco_to_proto3_converter//:repository_rules.bzl", "com_google_disco_to_proto3_converter_properties")
com_google_disco_to_proto3_converter_properties(
name = "com_google_disco_to_proto3_converter_properties",
file = "@com_google_disco_to_proto3_converter//:pom.xml",
)
load("@com_google_disco_to_proto3_converter//:repositories.bzl", "com_google_disco_to_proto3_converter_repositories")
com_google_disco_to_proto3_converter_repositories()