forked from dabrahams/bazel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
distdir_deps.bzl
408 lines (397 loc) · 16.7 KB
/
distdir_deps.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
397
398
399
400
401
402
403
404
405
406
407
408
# Copyright 2020 The Bazel Authors. All rights reserved.
#
# 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.
"""List the distribution dependencies we need to build Bazel."""
DIST_DEPS = {
########################################
#
# Runtime language dependencies
#
########################################
"platforms": {
"archive": "platforms-0.0.3.tar.gz",
"sha256": "460caee0fa583b908c622913334ec3c1b842572b9c23cf0d3da0c2543a1a157d",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.3/platforms-0.0.3.tar.gz",
"https://github.com/bazelbuild/platforms/releases/download/0.0.3/platforms-0.0.3.tar.gz",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
},
"bazel_toolchains": {
"archive": "b9bc541aae7bd8e09c6954e2e9da3f7ffe4f77f0.tar.gz",
"sha256": "0fe656c3503ee318ba21e3147186b0959ddb8514e4826174e5c178cd1968bdb9",
"strip_prefix": "bazel-toolchains-b9bc541aae7bd8e09c6954e2e9da3f7ffe4f77f0",
"urls": [
#TODO(ilist): mirror and update to 4.0.0 version once it is released
"https://github.com/bazelbuild/bazel-toolchains/archive/b9bc541aae7bd8e09c6954e2e9da3f7ffe4f77f0.tar.gz",
],
"used_in": [
"additional_distfiles",
],
},
# Keep in sync with src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/cc_configure.WORKSPACE.
# Keep in sync with src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.
# Note: This is not in sync with src/test/java/com/google/devtools/build/lib/blackbox/framework/BlackBoxTestEnvironment.java.
# Perhaps it should be.
"rules_cc": {
"archive": "b1c40e1de81913a3c40e5948f78719c28152486d.zip",
"sha256": "d0c573b94a6ef20ef6ff20154a23d0efcb409fb0e1ff0979cec318dfe42f0cdd",
"strip_prefix": "rules_cc-b1c40e1de81913a3c40e5948f78719c28152486d",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip",
"https://github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
},
"rules_java": {
"archive": "7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip",
"sha256": "bc81f1ba47ef5cc68ad32225c3d0e70b8c6f6077663835438da8d5733f917598",
"strip_prefix": "rules_java-7cf3cefd652008d0a64a419c34c13bdca6c8f178",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/rules_java/archive/7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip",
"https://github.com/bazelbuild/rules_java/archive/7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
},
# TODO(aiuto): Update src/test/java/com/google/devtools/build/lib/blackbox/framework/BlackBoxTestEnvironment.java to use
# this dynamically.
"rules_proto": {
"archive": "7e4afce6fe62dbff0a4a03450143146f9f2d7488.tar.gz",
"sha256": "8e7d59a5b12b233be5652e3d29f42fba01c7cbab09f6b3a8d0a57ed6d1e9a0da",
"strip_prefix": "rules_proto-7e4afce6fe62dbff0a4a03450143146f9f2d7488",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/7e4afce6fe62dbff0a4a03450143146f9f2d7488.tar.gz",
"https://github.com/bazelbuild/rules_proto/archive/7e4afce6fe62dbff0a4a03450143146f9f2d7488.tar.gz",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
},
#################################################
#
# Dependencies which are part of the Bazel binary
#
#################################################
"com_google_protobuf": {
"archive": "v3.13.0.tar.gz",
"sha256": "9b4ee22c250fe31b16f1a24d61467e40780a3fbb9b91c3b65be2a376ed913a1a",
"strip_prefix": "protobuf-3.13.0",
"urls": [
"https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v3.13.0.tar.gz",
"https://github.com/protocolbuffers/protobuf/archive/v3.13.0.tar.gz",
],
"patch_args": ["-p1"],
"patches": ["//third_party/protobuf:3.13.0.patch"],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
},
"protocolbuffers": {
"archive": "382d5afc60e05470c23e8de19b19fc5ad231e732.tar.gz",
"sha256": "7992217989f3156f8109931c1fc6db3434b7414957cb82371552377beaeb9d6c",
"urls": [
"https://mirror.bazel.build/github.com/protocolbuffers/upb/archive/382d5afc60e05470c23e8de19b19fc5ad231e732.tar.gz",
"https://github.com/protocolbuffers/upb/archive/382d5afc60e05470c23e8de19b19fc5ad231e732.tar.gz",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
},
"com_github_grpc_grpc": {
"archive": "v1.32.0.tar.gz",
"sha256": "f880ebeb2ccf0e47721526c10dd97469200e40b5f101a0d9774eb69efa0bd07a",
"strip_prefix": "grpc-1.32.0",
"urls": [
"https://mirror.bazel.build/github.com/grpc/grpc/archive/v1.32.0.tar.gz",
"https://github.com/grpc/grpc/archive/v1.32.0.tar.gz",
],
"patch_args": ["-p1"],
"patches": [
"//third_party/grpc:grpc_1.32.0.patch",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
},
"c-ares": {
"archive": "e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz",
"sha256": "e8c2751ddc70fed9dc6f999acd92e232d5846f009ee1674f8aee81f19b2b915a",
"urls": [
"https://mirror.bazel.build/github.com/c-ares/c-ares/archive/e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz",
"https://github.com/c-ares/c-ares/archive/e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
},
"re2": {
"archive": "aecba11114cf1fac5497aeb844b6966106de3eb6.tar.gz",
"sha256": "9f385e146410a8150b6f4cb1a57eab7ec806ced48d427554b1e754877ff26c3e",
"urls": [
"https://mirror.bazel.build/github.com/google/re2/archive/aecba11114cf1fac5497aeb844b6966106de3eb6.tar.gz",
"https://github.com/google/re2/archive/aecba11114cf1fac5497aeb844b6966106de3eb6.tar.gz",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
},
"abseil-cpp": {
"archive": "df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz",
"sha256": "f368a8476f4e2e0eccf8a7318b98dafbe30b2600f4e3cf52636e5eb145aba06a",
"urls": [
"https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz",
"https://github.com/abseil/abseil-cpp/archive/df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
},
###################################################
#
# Build time dependencies for testing and packaging
#
###################################################
"bazel_skylib": {
"archive": "bazel-skylib-1.0.3.tar.gz",
"sha256": "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
},
"io_bazel_skydoc": {
"archive": "1ef781ced3b1443dca3ed05dec1989eca1a4e1cd.tar.gz",
"sha256": "5a725b777976b77aa122b707d1b6f0f39b6020f66cd427bb111a585599c857b1",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/stardoc/archive/1ef781ced3b1443dca3ed05dec1989eca1a4e1cd.tar.gz",
"https://github.com/bazelbuild/stardoc/archive/1ef781ced3b1443dca3ed05dec1989eca1a4e1cd.tar.gz",
],
"used_in": [
"additional_distfiles",
],
"strip_prefix": "stardoc-1ef781ced3b1443dca3ed05dec1989eca1a4e1cd",
},
"rules_pkg": {
"archive": "rules_pkg-0.2.4.tar.gz",
"sha256": "4ba8f4ab0ff85f2484287ab06c0d871dcb31cc54d439457d28fd4ae14b18450a",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz",
"https://github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz",
],
"used_in": [
"additional_distfiles",
],
},
# for Stardoc
"io_bazel_rules_sass": {
"archive": "1.25.0.zip",
"sha256": "c78be58f5e0a29a04686b628cf54faaee0094322ae0ac99da5a8a8afca59a647",
"strip_prefix": "rules_sass-1.25.0",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/rules_sass/archive/1.25.0.zip",
"https://github.com/bazelbuild/rules_sass/archive/1.25.0.zip",
],
"used_in": [
"additional_distfiles",
],
},
# for Stardoc
"build_bazel_rules_nodejs": {
"archive": "rules_nodejs-2.2.2.tar.gz",
"sha256": "f2194102720e662dbf193546585d705e645314319554c6ce7e47d8b59f459e9c",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/rules_nodejs/releases/download/2.2.2/rules_nodejs-2.2.2.tar.gz",
"https://github.com/bazelbuild/rules_nodejs/releases/download/2.2.2/rules_nodejs-2.2.2.tar.gz",
],
"used_in": [
"additional_distfiles",
],
},
"desugar_jdk_libs": {
# Commit b102111a91ee5910e680bc9e32146da3e081055e of 2020-08-01
"archive": "b102111a91ee5910e680bc9e32146da3e081055e.zip",
"sha256": "2a043b861779ad382a75a6e3705c00a8168d433db07d09a883ae85912aa5009e",
"strip_prefix": "desugar_jdk_libs-b102111a91ee5910e680bc9e32146da3e081055e",
"urls": [
"https://mirror.bazel.build/github.com/google/desugar_jdk_libs/archive/b102111a91ee5910e680bc9e32146da3e081055e.zip",
"https://github.com/google/desugar_jdk_libs/archive/b102111a91ee5910e680bc9e32146da3e081055e.zip",
],
"used_in": [
"additional_distfiles",
],
},
"remote_coverage_tools": {
"archive": "coverage_output_generator-v2.5.zip",
"sha256": "cd14f1cb4559e4723e63b7e7b06d09fcc3bd7ba58d03f354cdff1439bd936a7d",
"urls": [
"https://mirror.bazel.build/bazel_coverage_output_generator/releases/coverage_output_generator-v2.5.zip",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
},
"remote_java_tools": {
"aliases": ["remote_java_tools_test", "remote_java_tools_for_testing"],
"archive": "java_tools-v11.1.zip",
"sha256": "12cffbb7c87622a6bd6e9231e81ecb9efdb118afbdd6e047ef06eeb3d72a7dc3",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/releases/java/v11.1/java_tools-v11.1.zip",
"https://github.com/bazelbuild/java_tools/releases/download/java_v11.1/java_tools-v11.1.zip",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
},
"remote_java_tools_linux": {
"aliases": ["remote_java_tools_test_linux", "remote_java_tools_linux_for_testing"],
"archive": "java_tools_linux-v11.1.zip",
"sha256": "a0dea21d348c8be94d06fde5a6c18d7691aa659cd56c3f1f932f0a28ae943a23",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/releases/java/v11.1/java_tools_linux-v11.1.zip",
"https://github.com/bazelbuild/java_tools/releases/download/java_v11.1/java_tools_linux-v11.1.zip",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
},
"remote_java_tools_windows": {
"aliases": ["remote_java_tools_test_windows", "remote_java_tools_windows_for_testing"],
"archive": "java_tools_windows-v11.1.zip",
"sha256": "ac4d22ce9b10a1d5e46cbae0beb63221d96043d1f3543a729482005481e3e51a",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/releases/java/v11.1/java_tools_windows-v11.1.zip",
"https://github.com/bazelbuild/java_tools/releases/download/java_v11.1/java_tools_windows-v11.1.zip",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
},
"remote_java_tools_darwin": {
"aliases": ["remote_java_tools_test_darwin", "remote_java_tools_darwin_for_testing"],
"archive": "java_tools_darwin-v11.1.zip",
"sha256": "72a2f34806e7f83b111601495c3bd401b96ea1794daa259608481fd4f6a60629",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/releases/java/v11.1/java_tools_darwin-v11.1.zip",
"https://github.com/bazelbuild/java_tools/releases/download/java_v11.1/java_tools_darwin-v11.1.zip",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
},
}
# Add aliased names
DEPS_BY_NAME = {}
def _create_index():
for repo_name in DIST_DEPS:
repo = DIST_DEPS[repo_name]
DEPS_BY_NAME[repo_name] = repo
aliases = repo.get("aliases")
if aliases:
for alias in aliases:
DEPS_BY_NAME[alias] = repo
_create_index()
def _gen_workspace_stanza_impl(ctx):
if ctx.attr.template and (ctx.attr.preamble or ctx.attr.postamble):
fail("Can not use template with either preamble or postamble")
if ctx.attr.use_maybe:
repo_clause = """
maybe(
http_archive,
name = "{repo}",
sha256 = "{sha256}",
strip_prefix = {strip_prefix},
urls = {urls},
)
"""
else:
repo_clause = """
http_archive(
name = "{repo}",
sha256 = "{sha256}",
strip_prefix = {strip_prefix},
urls = {urls},
)
"""
repo_stanzas = {}
for repo in ctx.attr.repos:
info = DEPS_BY_NAME[repo]
strip_prefix = info.get("strip_prefix")
if strip_prefix:
strip_prefix = "\"%s\"" % strip_prefix
else:
strip_prefix = "None"
repo_stanzas["{%s}" % repo] = repo_clause.format(
repo = repo,
archive = info["archive"],
sha256 = str(info["sha256"]),
strip_prefix = strip_prefix,
urls = info["urls"],
)
if ctx.attr.template:
ctx.actions.expand_template(
output = ctx.outputs.out,
template = ctx.file.template,
substitutions = repo_stanzas,
)
else:
content = "\n".join([p.strip() for p in ctx.attr.preamble.strip().split("\n")])
content += "\n"
content += "".join(repo_stanzas.values())
content += "\n"
content += "\n".join([p.strip() for p in ctx.attr.postamble.strip().split("\n")])
content += "\n"
ctx.actions.write(ctx.outputs.out, content)
return [DefaultInfo(files = depset([ctx.outputs.out]))]
gen_workspace_stanza = rule(
implementation = _gen_workspace_stanza_impl,
doc = "Use specifications from DIST_DEPS to generate WORKSPACE http_archive stanzas or to" +
"drop them into a template.",
attrs = {
"repos": attr.string_list(doc = "Set of repos to inlcude"),
"out": attr.output(mandatory = True),
"preamble": attr.string(doc = "Preamble."),
"postamble": attr.string(doc = "setup rules to follow repos."),
"template": attr.label(
doc = "Template WORKSPACE file. May not be used with preable or postamble." +
"Repo stanzas can be include with the syntax '{repo name}'.",
allow_single_file = True,
mandatory = False,
),
"use_maybe": attr.bool(doc = "Use maybe() invocation instead of http_archive"),
},
)