blob: 81389239a596e123e86b86a3b6813d485a549e0c [file] [log] [blame]
Tony Aiuto337e7172020-12-09 10:20:14 -08001# Copyright 2020 The Bazel Authors. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http:#www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14"""List the distribution dependencies we need to build Bazel."""
15
16DIST_DEPS = {
Tony Aiuto1c9e7ca2021-01-05 08:01:21 -080017 ########################################
18 #
19 # Runtime language dependencies
20 #
21 ########################################
Tony Aiutoe973aef2021-01-11 00:32:51 -080022 "platforms": {
John Cater2cff2ac2021-02-26 07:38:37 -080023 "archive": "platforms-0.0.4.tar.gz",
24 "sha256": "079945598e4b6cc075846f7fd6a9d0857c33a7afc0de868c2ccb96405225135d",
Tony Aiutoe973aef2021-01-11 00:32:51 -080025 "urls": [
John Cater2cff2ac2021-02-26 07:38:37 -080026 "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.4/platforms-0.0.4.tar.gz",
27 "https://github.com/bazelbuild/platforms/releases/download/0.0.4/platforms-0.0.4.tar.gz",
Tony Aiutoe973aef2021-01-11 00:32:51 -080028 ],
29 "used_in": [
30 "additional_distfiles",
31 "test_WORKSPACE_files",
32 ],
33 },
34 "bazel_toolchains": {
philwo83f623a2021-05-21 11:40:40 -070035 "archive": "bazel-toolchains-4.1.0.tar.gz",
36 "sha256": "179ec02f809e86abf56356d8898c8bd74069f1bd7c56044050c2cd3d79d0e024",
37 "strip_prefix": "bazel-toolchains-4.1.0",
Tony Aiutoe973aef2021-01-11 00:32:51 -080038 "urls": [
philwo83f623a2021-05-21 11:40:40 -070039 "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/releases/download/4.1.0/bazel-toolchains-4.1.0.tar.gz",
40 "https://github.com/bazelbuild/bazel-toolchains/releases/download/4.1.0/bazel-toolchains-4.1.0.tar.gz",
Tony Aiutoe973aef2021-01-11 00:32:51 -080041 ],
42 "used_in": [
43 "additional_distfiles",
44 ],
45 },
Tony Aiuto1c9e7ca2021-01-05 08:01:21 -080046 # Keep in sync with src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/cc_configure.WORKSPACE.
47 # Keep in sync with src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.
48 # Note: This is not in sync with src/test/java/com/google/devtools/build/lib/blackbox/framework/BlackBoxTestEnvironment.java.
49 # Perhaps it should be.
Tony Aiuto337e7172020-12-09 10:20:14 -080050 "rules_cc": {
51 "archive": "b1c40e1de81913a3c40e5948f78719c28152486d.zip",
52 "sha256": "d0c573b94a6ef20ef6ff20154a23d0efcb409fb0e1ff0979cec318dfe42f0cdd",
53 "strip_prefix": "rules_cc-b1c40e1de81913a3c40e5948f78719c28152486d",
54 "urls": [
55 "https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip",
56 "https://github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip",
57 ],
Tony Aiutoe973aef2021-01-11 00:32:51 -080058 "used_in": [
59 "additional_distfiles",
60 "test_WORKSPACE_files",
61 ],
Tony Aiuto337e7172020-12-09 10:20:14 -080062 },
Tony Aiutob15a8b42021-01-08 07:42:57 -080063 "rules_java": {
64 "archive": "7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip",
65 "sha256": "bc81f1ba47ef5cc68ad32225c3d0e70b8c6f6077663835438da8d5733f917598",
66 "strip_prefix": "rules_java-7cf3cefd652008d0a64a419c34c13bdca6c8f178",
67 "urls": [
68 "https://mirror.bazel.build/github.com/bazelbuild/rules_java/archive/7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip",
69 "https://github.com/bazelbuild/rules_java/archive/7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip",
70 ],
71 "used_in": [
72 "additional_distfiles",
73 "test_WORKSPACE_files",
74 ],
Tony Aiutob15a8b42021-01-08 07:42:57 -080075 },
Tony Aiuto320bc942021-01-14 07:43:21 -080076 # TODO(aiuto): Update src/test/java/com/google/devtools/build/lib/blackbox/framework/BlackBoxTestEnvironment.java to use
77 # this dynamically.
78 "rules_proto": {
79 "archive": "7e4afce6fe62dbff0a4a03450143146f9f2d7488.tar.gz",
80 "sha256": "8e7d59a5b12b233be5652e3d29f42fba01c7cbab09f6b3a8d0a57ed6d1e9a0da",
81 "strip_prefix": "rules_proto-7e4afce6fe62dbff0a4a03450143146f9f2d7488",
82 "urls": [
83 "https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/7e4afce6fe62dbff0a4a03450143146f9f2d7488.tar.gz",
84 "https://github.com/bazelbuild/rules_proto/archive/7e4afce6fe62dbff0a4a03450143146f9f2d7488.tar.gz",
85 ],
86 "used_in": [
87 "additional_distfiles",
88 "test_WORKSPACE_files",
89 ],
90 },
Tony Aiutoe973aef2021-01-11 00:32:51 -080091 #################################################
Tony Aiuto1c9e7ca2021-01-05 08:01:21 -080092 #
Tony Aiutoe973aef2021-01-11 00:32:51 -080093 # Dependencies which are part of the Bazel binary
Tony Aiuto1c9e7ca2021-01-05 08:01:21 -080094 #
Tony Aiutoe973aef2021-01-11 00:32:51 -080095 #################################################
96 "com_google_protobuf": {
97 "archive": "v3.13.0.tar.gz",
98 "sha256": "9b4ee22c250fe31b16f1a24d61467e40780a3fbb9b91c3b65be2a376ed913a1a",
99 "strip_prefix": "protobuf-3.13.0",
100 "urls": [
101 "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v3.13.0.tar.gz",
102 "https://github.com/protocolbuffers/protobuf/archive/v3.13.0.tar.gz",
103 ],
104 "patch_args": ["-p1"],
105 "patches": ["//third_party/protobuf:3.13.0.patch"],
106 "used_in": [
107 "additional_distfiles",
108 "test_WORKSPACE_files",
109 ],
110 },
Tony Aiuto320bc942021-01-14 07:43:21 -0800111 "protocolbuffers": {
112 "archive": "382d5afc60e05470c23e8de19b19fc5ad231e732.tar.gz",
113 "sha256": "7992217989f3156f8109931c1fc6db3434b7414957cb82371552377beaeb9d6c",
114 "urls": [
115 "https://mirror.bazel.build/github.com/protocolbuffers/upb/archive/382d5afc60e05470c23e8de19b19fc5ad231e732.tar.gz",
116 "https://github.com/protocolbuffers/upb/archive/382d5afc60e05470c23e8de19b19fc5ad231e732.tar.gz",
117 ],
118 "used_in": [
119 "additional_distfiles",
120 "test_WORKSPACE_files",
121 ],
122 },
Tony Aiutoe973aef2021-01-11 00:32:51 -0800123 "com_github_grpc_grpc": {
Lauri Peltonen2df3d392021-02-26 04:37:48 -0800124 "archive": "v1.33.1.tar.gz",
125 "sha256": "58eaee5c0f1bd0b92ebe1fa0606ec8f14798500620e7444726afcaf65041cb63",
126 "strip_prefix": "grpc-1.33.1",
Tony Aiutoe973aef2021-01-11 00:32:51 -0800127 "urls": [
Lauri Peltonen2df3d392021-02-26 04:37:48 -0800128 "https://mirror.bazel.build/github.com/grpc/grpc/archive/v1.33.1.tar.gz",
129 "https://github.com/grpc/grpc/archive/v1.33.1.tar.gz",
Tony Aiutoe973aef2021-01-11 00:32:51 -0800130 ],
131 "patch_args": ["-p1"],
132 "patches": [
Lauri Peltonen2df3d392021-02-26 04:37:48 -0800133 "//third_party/grpc:grpc_1.33.1.patch",
Tony Aiutoe973aef2021-01-11 00:32:51 -0800134 ],
135 "used_in": [
136 "additional_distfiles",
137 "test_WORKSPACE_files",
138 ],
139 },
140 "c-ares": {
141 "archive": "e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz",
142 "sha256": "e8c2751ddc70fed9dc6f999acd92e232d5846f009ee1674f8aee81f19b2b915a",
143 "urls": [
144 "https://mirror.bazel.build/github.com/c-ares/c-ares/archive/e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz",
145 "https://github.com/c-ares/c-ares/archive/e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz",
146 ],
147 "used_in": [
148 "additional_distfiles",
149 "test_WORKSPACE_files",
150 ],
151 },
152 "re2": {
153 "archive": "aecba11114cf1fac5497aeb844b6966106de3eb6.tar.gz",
154 "sha256": "9f385e146410a8150b6f4cb1a57eab7ec806ced48d427554b1e754877ff26c3e",
155 "urls": [
156 "https://mirror.bazel.build/github.com/google/re2/archive/aecba11114cf1fac5497aeb844b6966106de3eb6.tar.gz",
157 "https://github.com/google/re2/archive/aecba11114cf1fac5497aeb844b6966106de3eb6.tar.gz",
158 ],
159 "used_in": [
160 "additional_distfiles",
161 "test_WORKSPACE_files",
162 ],
163 },
164 "abseil-cpp": {
165 "archive": "df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz",
166 "sha256": "f368a8476f4e2e0eccf8a7318b98dafbe30b2600f4e3cf52636e5eb145aba06a",
167 "urls": [
168 "https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz",
169 "https://github.com/abseil/abseil-cpp/archive/df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz",
170 ],
171 "used_in": [
172 "additional_distfiles",
173 "test_WORKSPACE_files",
174 ],
175 },
176 ###################################################
177 #
178 # Build time dependencies for testing and packaging
179 #
180 ###################################################
Tony Aiuto2b7ec5c2021-01-11 07:50:26 -0800181 "bazel_skylib": {
182 "archive": "bazel-skylib-1.0.3.tar.gz",
183 "sha256": "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
184 "urls": [
185 "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
186 "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
187 ],
188 "used_in": [
189 "additional_distfiles",
190 "test_WORKSPACE_files",
191 ],
192 },
193 "io_bazel_skydoc": {
194 "archive": "1ef781ced3b1443dca3ed05dec1989eca1a4e1cd.tar.gz",
195 "sha256": "5a725b777976b77aa122b707d1b6f0f39b6020f66cd427bb111a585599c857b1",
196 "urls": [
197 "https://mirror.bazel.build/github.com/bazelbuild/stardoc/archive/1ef781ced3b1443dca3ed05dec1989eca1a4e1cd.tar.gz",
198 "https://github.com/bazelbuild/stardoc/archive/1ef781ced3b1443dca3ed05dec1989eca1a4e1cd.tar.gz",
199 ],
200 "used_in": [
201 "additional_distfiles",
202 ],
203 "strip_prefix": "stardoc-1ef781ced3b1443dca3ed05dec1989eca1a4e1cd",
204 },
Tony Aiuto337e7172020-12-09 10:20:14 -0800205 "rules_pkg": {
Tony Aiuto99079b32021-04-06 06:41:17 -0700206 "archive": "rules_pkg-0.4.0.tar.gz",
207 "sha256": "038f1caa773a7e35b3663865ffb003169c6a71dc995e39bf4815792f385d837d",
Tony Aiuto337e7172020-12-09 10:20:14 -0800208 "urls": [
Tony Aiuto99079b32021-04-06 06:41:17 -0700209 "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.4.0/rules_pkg-0.4.0.tar.gz",
210 "https://github.com/bazelbuild/rules_pkg/releases/download/0.4.0/rules_pkg-0.4.0.tar.gz",
Tony Aiuto337e7172020-12-09 10:20:14 -0800211 ],
Tony Aiutoe973aef2021-01-11 00:32:51 -0800212 "used_in": [
213 "additional_distfiles",
214 ],
Tony Aiuto337e7172020-12-09 10:20:14 -0800215 },
Tony Aiuto1c9e7ca2021-01-05 08:01:21 -0800216 # for Stardoc
217 "io_bazel_rules_sass": {
218 "archive": "1.25.0.zip",
219 "sha256": "c78be58f5e0a29a04686b628cf54faaee0094322ae0ac99da5a8a8afca59a647",
220 "strip_prefix": "rules_sass-1.25.0",
221 "urls": [
222 "https://mirror.bazel.build/github.com/bazelbuild/rules_sass/archive/1.25.0.zip",
223 "https://github.com/bazelbuild/rules_sass/archive/1.25.0.zip",
224 ],
Tony Aiutoe973aef2021-01-11 00:32:51 -0800225 "used_in": [
226 "additional_distfiles",
227 ],
Tony Aiuto1c9e7ca2021-01-05 08:01:21 -0800228 },
229 # for Stardoc
230 "build_bazel_rules_nodejs": {
231 "archive": "rules_nodejs-2.2.2.tar.gz",
232 "sha256": "f2194102720e662dbf193546585d705e645314319554c6ce7e47d8b59f459e9c",
233 "urls": [
234 "https://mirror.bazel.build/github.com/bazelbuild/rules_nodejs/releases/download/2.2.2/rules_nodejs-2.2.2.tar.gz",
235 "https://github.com/bazelbuild/rules_nodejs/releases/download/2.2.2/rules_nodejs-2.2.2.tar.gz",
236 ],
Tony Aiutoe973aef2021-01-11 00:32:51 -0800237 "used_in": [
238 "additional_distfiles",
239 ],
Tony Aiuto1c9e7ca2021-01-05 08:01:21 -0800240 },
mennyf431b0c2021-01-13 09:18:29 -0800241 "desugar_jdk_libs": {
Menny Even Danan29cfb0b2021-03-31 15:21:30 -0700242 # Commit 5847d6a06302136d95a14b4cbd4b55a9c9f1436e of 2021-03-10
243 "archive": "5847d6a06302136d95a14b4cbd4b55a9c9f1436e.zip",
244 "sha256": "299452e6f4a4981b2e6d22357f7332713382a63e4c137f5fd6b89579f6d610cb",
245 "strip_prefix": "desugar_jdk_libs-5847d6a06302136d95a14b4cbd4b55a9c9f1436e",
mennyf431b0c2021-01-13 09:18:29 -0800246 "urls": [
Menny Even Danan29cfb0b2021-03-31 15:21:30 -0700247 "https://mirror.bazel.build/github.com/google/desugar_jdk_libs/archive/5847d6a06302136d95a14b4cbd4b55a9c9f1436e.zip",
248 "https://github.com/google/desugar_jdk_libs/archive/5847d6a06302136d95a14b4cbd4b55a9c9f1436e.zip",
mennyf431b0c2021-01-13 09:18:29 -0800249 ],
250 "used_in": [
251 "additional_distfiles",
252 ],
253 },
aiutobbeb1da2021-01-15 06:50:56 -0800254 "remote_coverage_tools": {
255 "archive": "coverage_output_generator-v2.5.zip",
256 "sha256": "cd14f1cb4559e4723e63b7e7b06d09fcc3bd7ba58d03f354cdff1439bd936a7d",
257 "urls": [
258 "https://mirror.bazel.build/bazel_coverage_output_generator/releases/coverage_output_generator-v2.5.zip",
259 ],
260 "used_in": [
261 "additional_distfiles",
262 "test_WORKSPACE_files",
263 ],
264 },
Tony Aiuto6a3d5f12021-01-12 13:38:32 -0800265 "remote_java_tools": {
John Cater2cff2ac2021-02-26 07:38:37 -0800266 "aliases": [
267 "remote_java_tools_test",
268 "remote_java_tools_for_testing",
269 ],
Ivo List8564a012021-04-14 07:45:21 -0700270 "archive": "java_tools-v11.3.zip",
271 "sha256": "52b66d8df456f2ce057d8e435904789463df8414af8110aa13af68ce32d8c4cc",
Tony Aiuto6a3d5f12021-01-12 13:38:32 -0800272 "urls": [
Ivo List8564a012021-04-14 07:45:21 -0700273 "https://mirror.bazel.build/bazel_java_tools/releases/java/v11.3/java_tools-v11.3.zip",
274 "https://github.com/bazelbuild/java_tools/releases/download/java_v11.3/java_tools-v11.3.zip",
Tony Aiuto6a3d5f12021-01-12 13:38:32 -0800275 ],
276 "used_in": [
277 "additional_distfiles",
278 "test_WORKSPACE_files",
279 ],
280 },
281 "remote_java_tools_linux": {
John Cater2cff2ac2021-02-26 07:38:37 -0800282 "aliases": [
283 "remote_java_tools_test_linux",
284 "remote_java_tools_linux_for_testing",
285 ],
Ivo List8564a012021-04-14 07:45:21 -0700286 "archive": "java_tools_linux-v11.3.zip",
287 "sha256": "014fe7305bb0cf2430ca7fc61a2939d4a547d10a1ad47ce909c16235f8f49f46",
Tony Aiuto6a3d5f12021-01-12 13:38:32 -0800288 "urls": [
Ivo List8564a012021-04-14 07:45:21 -0700289 "https://mirror.bazel.build/bazel_java_tools/releases/java/v11.3/java_tools_linux-v11.3.zip",
290 "https://github.com/bazelbuild/java_tools/releases/download/java_v11.3/java_tools_linux-v11.3.zip",
Tony Aiuto6a3d5f12021-01-12 13:38:32 -0800291 ],
292 "used_in": [
293 "additional_distfiles",
294 "test_WORKSPACE_files",
295 ],
296 },
297 "remote_java_tools_windows": {
John Cater2cff2ac2021-02-26 07:38:37 -0800298 "aliases": [
299 "remote_java_tools_test_windows",
300 "remote_java_tools_windows_for_testing",
301 ],
Ivo List8564a012021-04-14 07:45:21 -0700302 "archive": "java_tools_windows-v11.3.zip",
303 "sha256": "ebb885cc75bfb72ab509de68883ed31638ba2c1a22181636e75c9c731f73fee3",
Tony Aiuto6a3d5f12021-01-12 13:38:32 -0800304 "urls": [
Ivo List8564a012021-04-14 07:45:21 -0700305 "https://mirror.bazel.build/bazel_java_tools/releases/java/v11.3/java_tools_windows-v11.3.zip",
306 "https://github.com/bazelbuild/java_tools/releases/download/java_v11.3/java_tools_windows-v11.3.zip",
Tony Aiuto6a3d5f12021-01-12 13:38:32 -0800307 ],
308 "used_in": [
309 "additional_distfiles",
310 "test_WORKSPACE_files",
311 ],
312 },
313 "remote_java_tools_darwin": {
John Cater2cff2ac2021-02-26 07:38:37 -0800314 "aliases": [
315 "remote_java_tools_test_darwin",
316 "remote_java_tools_darwin_for_testing",
317 ],
Ivo List8564a012021-04-14 07:45:21 -0700318 "archive": "java_tools_darwin-v11.3.zip",
319 "sha256": "d09141a35e2c7950f6b7ea344ebd67868146fd2d1ee2b7509cdc36a42786cca4",
Tony Aiuto6a3d5f12021-01-12 13:38:32 -0800320 "urls": [
Ivo List8564a012021-04-14 07:45:21 -0700321 "https://mirror.bazel.build/bazel_java_tools/releases/java/v11.3/java_tools_darwin-v11.3.zip",
322 "https://github.com/bazelbuild/java_tools/releases/download/java_v11.3/java_tools_darwin-v11.3.zip",
Tony Aiuto6a3d5f12021-01-12 13:38:32 -0800323 ],
324 "used_in": [
325 "additional_distfiles",
326 "test_WORKSPACE_files",
327 ],
328 },
Tony Aiuto337e7172020-12-09 10:20:14 -0800329}
Tony Aiuto3b2d3102021-01-07 03:40:14 -0800330
Tony Aiuto6a3d5f12021-01-12 13:38:32 -0800331# Add aliased names
332DEPS_BY_NAME = {}
333
334def _create_index():
335 for repo_name in DIST_DEPS:
336 repo = DIST_DEPS[repo_name]
337 DEPS_BY_NAME[repo_name] = repo
338 aliases = repo.get("aliases")
339 if aliases:
340 for alias in aliases:
341 DEPS_BY_NAME[alias] = repo
342
343_create_index()
344
Tony Aiuto3b2d3102021-01-07 03:40:14 -0800345def _gen_workspace_stanza_impl(ctx):
346 if ctx.attr.template and (ctx.attr.preamble or ctx.attr.postamble):
347 fail("Can not use template with either preamble or postamble")
348
Tony Aiutob15a8b42021-01-08 07:42:57 -0800349 if ctx.attr.use_maybe:
350 repo_clause = """
Tony Aiuto3b2d3102021-01-07 03:40:14 -0800351maybe(
352 http_archive,
Tony Aiuto6a3d5f12021-01-12 13:38:32 -0800353 name = "{repo}",
Tony Aiuto3b2d3102021-01-07 03:40:14 -0800354 sha256 = "{sha256}",
355 strip_prefix = {strip_prefix},
356 urls = {urls},
357)
358"""
Tony Aiutob15a8b42021-01-08 07:42:57 -0800359 else:
360 repo_clause = """
361http_archive(
362 name = "{repo}",
363 sha256 = "{sha256}",
364 strip_prefix = {strip_prefix},
365 urls = {urls},
366)
367"""
368
Tony Aiuto3b2d3102021-01-07 03:40:14 -0800369 repo_stanzas = {}
370 for repo in ctx.attr.repos:
Tony Aiuto6a3d5f12021-01-12 13:38:32 -0800371 info = DEPS_BY_NAME[repo]
Tony Aiuto3b2d3102021-01-07 03:40:14 -0800372 strip_prefix = info.get("strip_prefix")
373 if strip_prefix:
374 strip_prefix = "\"%s\"" % strip_prefix
375 else:
376 strip_prefix = "None"
377
378 repo_stanzas["{%s}" % repo] = repo_clause.format(
379 repo = repo,
380 archive = info["archive"],
381 sha256 = str(info["sha256"]),
382 strip_prefix = strip_prefix,
383 urls = info["urls"],
384 )
385
386 if ctx.attr.template:
387 ctx.actions.expand_template(
388 output = ctx.outputs.out,
389 template = ctx.file.template,
390 substitutions = repo_stanzas,
391 )
392 else:
393 content = "\n".join([p.strip() for p in ctx.attr.preamble.strip().split("\n")])
394 content += "\n"
395 content += "".join(repo_stanzas.values())
396 content += "\n"
397 content += "\n".join([p.strip() for p in ctx.attr.postamble.strip().split("\n")])
398 content += "\n"
399 ctx.actions.write(ctx.outputs.out, content)
400
401 return [DefaultInfo(files = depset([ctx.outputs.out]))]
402
403gen_workspace_stanza = rule(
Tony Aiuto3b2d3102021-01-07 03:40:14 -0800404 attrs = {
405 "repos": attr.string_list(doc = "Set of repos to inlcude"),
406 "out": attr.output(mandatory = True),
407 "preamble": attr.string(doc = "Preamble."),
408 "postamble": attr.string(doc = "setup rules to follow repos."),
409 "template": attr.label(
410 doc = "Template WORKSPACE file. May not be used with preable or postamble." +
411 "Repo stanzas can be include with the syntax '{repo name}'.",
412 allow_single_file = True,
413 mandatory = False,
414 ),
Tony Aiutob15a8b42021-01-08 07:42:57 -0800415 "use_maybe": attr.bool(doc = "Use maybe() invocation instead of http_archive"),
Tony Aiuto3b2d3102021-01-07 03:40:14 -0800416 },
John Cater2cff2ac2021-02-26 07:38:37 -0800417 doc = "Use specifications from DIST_DEPS to generate WORKSPACE http_archive stanzas or to" +
418 "drop them into a template.",
419 implementation = _gen_workspace_stanza_impl,
Tony Aiuto3b2d3102021-01-07 03:40:14 -0800420)