-
Notifications
You must be signed in to change notification settings - Fork 327
/
workspace.bzl
396 lines (352 loc) · 14.2 KB
/
workspace.bzl
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
# Copyright (C) 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Defines macros to be called from a WORKSPACE file to setup the GAPID
# dependencies and toolchains.
load("@gapid//tools/build:cc_toolchain.bzl", "cc_configure")
load("@gapid//tools/build/rules:android.bzl", "android_native_app_glue", "ndk_vk_validation_layer")
load("@gapid//tools/build/rules:repository.bzl", "github_repository", "maybe_repository")
load("@gapid//tools/build/third_party:breakpad.bzl", "breakpad")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Defines the repositories for GAPID's dependencies, excluding the
# go dependencies, which require @io_bazel_rules_go to be setup.
# android - if false, the Android NDK/SDK are not initialized.
# mingw - if false, our cc toolchain, which uses MinGW on Windows is not initialized.
# locals - can be used to provide local path overrides for repos:
# {"foo": "/path/to/foo"} would cause @foo to be a local repo based on /path/to/foo.
def gapid_dependencies(android = True, mingw = True, locals = {}):
#####################################################
# Get repositories with workspace rules we need first
maybe_repository(
github_repository,
name = "io_bazel_rules_go",
locals = locals,
organization = "bazelbuild",
project = "rules_go",
commit = "6fc21c78143ff1d4ea98100e8fd7a928d45abd00", # 0.18.6
sha256 = "6356b0c591659b2da6f8149dfe7207a23d2cc41d3ed3932f0be3aa5dad7a4d2f",
)
maybe_repository(
github_repository,
name = "bazel_gazelle",
locals = locals,
organization = "bazelbuild",
project = "bazel-gazelle",
commit = "e443c54b396a236e0d3823f46c6a931e1c9939f2", # 0.17.0
sha256 = "ca6dcacc34c159784f01f557dbb0dc5d1772d3b28f1145b51f888ecb3694af1a",
)
maybe_repository(
github_repository,
name = "com_google_protobuf",
locals = locals,
organization = "google",
project = "protobuf",
commit = "815ff7e1fb2d417d5aebcbf5fc46e626b18dc834", # Head of 3.8.x branch
sha256 = "083646275522dc57e145f769c2daf39d469757bafcc5b7d09b119dfaf1b873b8",
repo_mapping = {"@zlib": "@net_zlib"},
)
maybe_repository(
github_repository,
name = "com_github_grpc_grpc",
locals = locals,
organization = "grpc",
project = "grpc",
# v1.20.1
commit = "7741e806a213cba63c96234f16d712a8aa101a49",
sha256 = "9ed7d944d8d07deac365c9edcda10ce8159c1436119e1b0792a1e830cb20606c",
# This patch works around a naming conflict in grpc which leads to
# compilation issues in recent gcc/glibc. This issue is fixed on recent
# grpc versions (since
# https://github.com/grpc/grpc/commit/de6258631a5e1c2fb2d50e57f84e38c09f45023d),
# but updating our grpc version leads to errors in compiling the abseil
# dependency of grpc
# (https://github.com/abseil/abseil-cpp/issues/326). We tried to pull
# abseil ourselves and patch it, but abseil also fails to compile with
# gcc on windows, so we choose to patch grpc directly. Once grpc has a
# version that builds fine on all our targets, we can update grpc and
# drop this patch.
patch_file = "@gapid//tools/build/third_party/com_github_grpc_grpc:com_github_grpc_grpc_fix.patch",
)
_grpc_deps(locals)
###########################################
# Now get all our other non-go dependencies
maybe_repository(
github_repository,
name = "com_google_googletest",
locals = locals,
organization = "google",
project = "googletest",
commit = "62dbaa2947f7d058ea7e16703faea69b1134b024",
sha256 = "c86258bf52616f5fa52a622ba58ce700eb2dd9f6ec15ff13ad2b2a579afb9c67",
)
maybe_repository(
github_repository,
name = "astc_encoder",
locals = locals,
organization = "ARM-software",
project = "astc-encoder",
commit = "b6bf6e7a523ddafdb8cfdc84b068d8fe70ffb45e",
build_file = "@gapid//tools/build/third_party:astc-encoder.BUILD",
sha256 = "7877eb08c61d8b258c5d4690e924090cb7f303e8be6d74e9a9a611d3177bb5ae",
)
maybe_repository(
breakpad,
name = "breakpad",
locals = locals,
commit = "a61afe7a3e865f1da7ff7185184fe23977c2adca",
build_file = "@gapid//tools/build/third_party/breakpad:breakpad.BUILD",
)
maybe_repository(
github_repository,
name = "cityhash",
locals = locals,
organization = "google",
project = "cityhash",
commit = "8af9b8c2b889d80c22d6bc26ba0df1afb79a30db",
build_file = "@gapid//tools/build/third_party:cityhash.BUILD",
sha256 = "3524f5ed43143974a29fddeeece29c8b6348f05db08dd180452da01a2837ddce",
)
maybe_repository(
github_repository,
name = "glslang",
locals = locals,
organization = "KhronosGroup",
project = "glslang",
commit = "97e35420a62e112de57a31b265e020662883ef8f",
build_file = "@gapid//tools/build/third_party:glslang.BUILD",
sha256 = "4d73467f35b8ac15cc06206cbd8be2802afc630bbfc4e9504b81e711457dde49",
)
maybe_repository(
github_repository,
name = "llvm",
locals = locals,
organization = "llvm-mirror",
project = "llvm",
commit = "e562960fe303c0ffab6f3458fcdb1544b56fd81e",
build_file = "@gapid//tools/build/third_party:llvm.BUILD",
sha256 = "3ef3d905849d547b6481b16d8e7b473a84efafbe90131e7bc90a0c6aae4cd8e6",
)
maybe_repository(
new_git_repository,
name = "stb",
locals = locals,
remote = "https://github.com/nothings/stb",
commit = "f67165c2bb2af3060ecae7d20d6f731173485ad0",
build_file = "@gapid//tools/build/third_party:stb.BUILD",
shallow_since = "1572280202 -0700",
)
maybe_repository(
new_git_repository,
name = "lss",
locals = locals,
remote = "https://chromium.googlesource.com/linux-syscall-support",
commit = "e6527b0cd469e3ff5764785dadcb39bf7d787154",
build_file = "@gapid//tools/build/third_party:lss.BUILD",
shallow_since = "1508355462 0000",
)
maybe_repository(
git_repository,
name = "perfetto",
locals = locals,
remote = "https://android.googlesource.com/platform/external/perfetto",
commit = "f447425f9f7f676bf22d3c5e4a78f30d43c92c95",
shallow_since = "1582916230 0000",
)
maybe_repository(
http_archive,
name = "sqlite",
locals = locals,
url = "https://storage.googleapis.com/perfetto/sqlite-amalgamation-3250300.zip",
sha256 = "2ad5379f3b665b60599492cc8a13ac480ea6d819f91b1ef32ed0e1ad152fafef",
strip_prefix = "sqlite-amalgamation-3250300",
build_file = "@perfetto//bazel:sqlite.BUILD",
)
maybe_repository(
http_archive,
name = "sqlite_src",
locals = locals,
url = "https://storage.googleapis.com/perfetto/sqlite-src-3250300.zip",
sha256 = "c7922bc840a799481050ee9a76e679462da131adba1814687f05aa5c93766421",
strip_prefix = "sqlite-src-3250300",
build_file = "@perfetto//bazel:sqlite.BUILD",
)
maybe_repository(
native.new_local_repository,
name = "perfetto_cfg",
locals = locals,
path = "tools/build/third_party/perfetto",
build_file = "@gapid//tools/build/third_party/perfetto:BUILD.bazel",
)
maybe_repository(
github_repository,
name = "spirv_headers",
locals = locals,
organization = "KhronosGroup",
project = "SPIRV-Headers",
commit = "9f6846f973a1ef53790e75b9190820ab1557434f",
build_file = "@gapid//tools/build/third_party:spirv-headers.BUILD",
sha256 = "1980cefd605c440241f5c948eb4446412166b6df1ad133bf74c47180939477d5",
)
maybe_repository(
github_repository,
name = "spirv_cross",
locals = locals,
organization = "KhronosGroup",
project = "SPIRV-Cross",
commit = "ed55e0ac6d797a338e7c19dad785237f0efc4d86",
build_file = "@gapid//tools/build/third_party:spirv-cross.BUILD",
sha256 = "a6decf21a137e63f5e9dc01b716c7a905c54eef23fe6a7910058fd253460cec0",
)
maybe_repository(
github_repository,
name = "spirv_tools",
locals = locals,
organization = "KhronosGroup",
project = "SPIRV-Tools",
commit = "8d8a71278bf9e83dd0fb30d5474386d30870b74d",
build_file = "@gapid//tools/build/third_party:spirv-tools.BUILD",
sha256 = "8b1dfe726ea9047ef679baf2d40dfbf090e70406512358d236e54a8234e71eae",
)
maybe_repository(
github_repository,
name = "spirv_reflect",
locals = locals,
organization = "chaoticbob",
project = "SPIRV-Reflect",
commit = "a861e587bdc924c49272873bbc1744928bc51aac",
build_file = "@gapid//tools/build/third_party:spirv-reflect.BUILD",
sha256 = "da636883f8d31fa5d1a8722374b92e76bc1f19ec7c125882c843079623f1c13a",
)
maybe_repository(
http_archive,
name = "vscode-languageclient",
locals = locals,
url = "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-2.6.3.tgz",
build_file = "@gapid//tools/build/third_party:vscode-languageclient.BUILD",
sha256 = "42ad6dc73bbf24a067d1e21038d35deab975cb207ac2d63b81c37a977d431d8f",
)
maybe_repository(
http_archive,
name = "vscode-jsonrpc",
locals = locals,
url = "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-2.4.0.tgz",
build_file = "@gapid//tools/build/third_party:vscode-jsonrpc.BUILD",
sha256= "bed9b2facb7d179f14c8a710db8e613be56bd88b2a75443143778813048b5c89",
)
maybe_repository(
http_archive,
name = "vscode-languageserver-types",
locals = locals,
url = "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-1.0.4.tgz",
build_file = "@gapid//tools/build/third_party:vscode-languageserver-types.BUILD",
sha256 = "0cd219ac388c41a70c3ff4f72d25bd54fa351bc0850196c25c6c3361e799ac79",
)
maybe_repository(
github_repository,
name = "vulkan-headers",
locals = locals,
organization = "KhronosGroup",
project = "Vulkan-Headers",
commit = "7264358702061d3ed819d62d3d6fd66ab1da33c3", # 1.2.132
build_file = "@gapid//tools/build/third_party:vulkan-headers.BUILD",
sha256 = "d44112f625cb2152fd7c8906a15e4e98abc8636d1ef85c2e17b3cb5c247586d3",
)
if android:
maybe_repository(
native.android_sdk_repository,
name = "androidsdk",
locals = locals,
api_level = 26, # This is the target API
)
maybe_repository(
native.android_ndk_repository,
name = "androidndk",
locals = locals,
api_level = 23, # This is the minimum API
)
maybe_repository(
android_native_app_glue,
name = "android_native_app_glue",
locals = locals,
)
maybe_repository(
ndk_vk_validation_layer,
name = "ndk_vk_validation_layer",
locals = locals,
)
# Use the LLVM libc Android toolchain.
native.bind(
name = "android/crosstool",
actual = "@androidndk//:toolchain-libcpp",
)
maybe_repository(
http_archive,
name = "libinterceptor",
locals = locals,
url = "https://github.com/google/gapid/releases/download/libinterceptor-v1.0/libinterceptor.zip",
build_file = "@gapid//tools/build/third_party:libinterceptor.BUILD",
sha256 = "307e0e3ec7451a244811b4edf21453d55d1e90a5f868a73dc42d4975ef74aec9",
)
if mingw:
cc_configure()
# Function to setup all the GRPC deps and bindings.
def _grpc_deps(locals):
maybe_repository(http_archive,
name = "boringssl",
locals = locals,
# on the master-with-bazel branch
url = "https://boringssl.googlesource.com/boringssl/ archive/afc30d43eef92979b05776ec0963c9cede5fb80f.tar.gz",
)
maybe_repository(github_repository,
name = "net_zlib", # name used by rules_go
locals = locals,
organization = "madler",
project = "zlib",
commit = "cacf7f1d4e3d44d871b605da3b647f07d718623f",
build_file = "@gapid//tools/build/third_party:zlib.BUILD",
sha256 = "1cce3828ec2ba80ff8a4cac0ab5aa03756026517154c4b450e617ede751d41bd",
)
maybe_repository(github_repository,
name = "com_github_nanopb_nanopb",
locals = locals,
organization = "nanopb",
project = "nanopb",
commit = "f8ac463766281625ad710900479130c7fcb4d63b",
build_file = "@com_github_grpc_grpc//third_party:nanopb.BUILD",
sha256 = "e7e635b26fa11246e8fd1c46df141d2f094a659b905ac61e957234018308f883",
)
native.bind(
name = "libssl",
actual = "@boringssl//:ssl",
)
native.bind(
name = "zlib",
actual = "@net_zlib//:z",
)
native.bind(
name = "nanopb",
actual = "@com_github_nanopb_nanopb//:nanopb",
)
native.bind(
name = "protobuf",
actual = "@com_google_protobuf//:protobuf",
)
native.bind(
name = "protobuf_clib",
actual = "@com_google_protobuf//:protoc_lib",
)
native.bind(
name = "protobuf_headers",
actual = "@com_google_protobuf//:protobuf_headers",
)