• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1workspace(name = "skia")
2
3load("//bazel:deps.bzl", "bazel_deps", "c_plus_plus_deps")
4
5bazel_deps()
6
7load("//toolchain:download_toolchains.bzl", "download_toolchains_for_skia")
8
9download_toolchains_for_skia("clang_linux_amd64", "clang_mac", "ndk_linux_amd64")
10
11load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
12load("//bazel:gcs_mirror.bzl", "gcs_mirror_url")
13
14# See https://github.com/emscripten-core/emsdk/tree/85d27a4a2a60d591613a305b14ae438c2bb3ce11/bazel#setup-instructions
15http_archive(
16    name = "emsdk",
17    sha256 = "cb8cded78f6953283429d724556e89211e51ac4d871fcf38e0b32405ee248e91",
18    strip_prefix = "emsdk-3.1.44/bazel",
19    urls = gcs_mirror_url(
20        sha256 = "cb8cded78f6953283429d724556e89211e51ac4d871fcf38e0b32405ee248e91",
21        url = "https://github.com/emscripten-core/emsdk/archive/refs/tags/3.1.44.tar.gz",
22    ),
23)
24
25load("@emsdk//:deps.bzl", emsdk_deps = "deps")
26
27# One of the deps here is build_bazel_rules_nodejs, currently version 5.8.0
28# If we try to install it ourselves after this, it won't work.
29emsdk_deps()
30
31load("@emsdk//:emscripten_deps.bzl", emsdk_emscripten_deps = "emscripten_deps")
32
33emsdk_emscripten_deps(emscripten_version = "3.1.44")
34
35load("@bazel_toolchains//repositories:repositories.bzl", bazel_toolchains_repositories = "repositories")
36
37bazel_toolchains_repositories()
38
39http_archive(
40    name = "rules_pkg",
41    sha256 = "8f9ee2dc10c1ae514ee599a8b42ed99fa262b757058f65ad3c384289ff70c4b8",
42    urls = gcs_mirror_url(
43        sha256 = "8f9ee2dc10c1ae514ee599a8b42ed99fa262b757058f65ad3c384289ff70c4b8",
44        url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.9.1/rules_pkg-0.9.1.tar.gz",
45    ),
46)
47
48load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
49
50rules_pkg_dependencies()
51
52#######################################################################################
53# Python
54#######################################################################################
55
56# https://github.com/bazelbuild/rules_python
57http_archive(
58    name = "rules_python",
59    sha256 = "5fa3c738d33acca3b97622a13a741129f67ef43f5fdfcec63b29374cc0574c29",
60    strip_prefix = "rules_python-0.9.0",
61    urls = gcs_mirror_url(
62        sha256 = "5fa3c738d33acca3b97622a13a741129f67ef43f5fdfcec63b29374cc0574c29",
63        url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.9.0.tar.gz",
64    ),
65)
66
67# This sets up a hermetic python3, rather than depending on what is installed.
68load("@rules_python//python:repositories.bzl", "python_register_toolchains")
69
70python_register_toolchains(
71    name = "python3_9",
72    # https://github.com/bazelbuild/rules_python/blob/main/python/versions.bzl
73    python_version = "3.9",
74)
75
76load("@python3_9//:defs.bzl", "interpreter")
77load("@rules_python//python:pip.bzl", "pip_install")
78
79pip_install(
80    name = "py_deps",
81    python_interpreter_target = interpreter,
82    requirements = "//:requirements.txt",
83)
84
85#######################################################################################
86# Maven
87#######################################################################################
88
89# https://github.com/bazelbuild/rules_jvm_external
90http_archive(
91    name = "rules_jvm_external",
92    sha256 = "cd1a77b7b02e8e008439ca76fd34f5b07aecb8c752961f9640dea15e9e5ba1ca",
93    strip_prefix = "rules_jvm_external-4.2",
94    urls = gcs_mirror_url(
95        sha256 = "cd1a77b7b02e8e008439ca76fd34f5b07aecb8c752961f9640dea15e9e5ba1ca",
96        url = "https://github.com/bazelbuild/rules_jvm_external/archive/4.2.zip",
97    ),
98)
99
100load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")
101
102rules_jvm_external_deps()
103
104load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup")
105
106rules_jvm_external_setup()
107
108load("@rules_jvm_external//:defs.bzl", "maven_install")
109
110maven_install(
111    artifacts = [
112        # The version released after this one (1.6.0-rc1) did not resolve unknown symbol errors when
113        # building.
114        # https://b.corp.google.com/issues/269331711
115        "androidx.annotation:annotation:1.5.0",
116    ],
117    repositories = [
118        "https://maven.google.com",
119        "https://repo1.maven.org/maven2",
120    ],
121)
122
123#######################################################################################
124# Gazelle
125#######################################################################################
126
127http_archive(
128    name = "io_bazel_rules_go",
129    sha256 = "91585017debb61982f7054c9688857a2ad1fd823fc3f9cb05048b0025c47d023",
130    urls = [
131        "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip",
132        "https://github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip",
133    ],
134)
135
136http_archive(
137    name = "bazel_gazelle",
138    sha256 = "d3fa66a39028e97d76f9e2db8f1b0c11c099e8e01bf363a923074784e451f809",
139    urls = [
140        "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.33.0/bazel-gazelle-v0.33.0.tar.gz",
141        "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.33.0/bazel-gazelle-v0.33.0.tar.gz",
142    ],
143)
144
145load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
146load("@io_bazel_rules_go//go:deps.bzl", "go_download_sdk", "go_register_toolchains", "go_rules_dependencies")
147load("//:go_repositories.bzl", "go_repositories")
148
149# gazelle:repository_macro go_repositories.bzl%go_repositories
150go_repositories()
151
152go_rules_dependencies()
153
154# For our Linux RBE pool
155go_download_sdk(
156    name = "go_sdk_linux_amd64",
157    goarch = "amd64",
158    goos = "linux",
159    version = "1.21.4",
160)
161
162# For the host machine
163go_download_sdk(
164    name = "go_sdk",
165    version = "1.21.4",
166)
167
168# Do not specify a version here or it will be an error (because we
169# specified the version above when downloading SDKs)
170go_register_toolchains()
171
172gazelle_dependencies(
173    go_repository_default_config = "//:WORKSPACE.bazel",
174    go_sdk = "go_sdk",
175)
176
177##########################
178# Other Go dependencies. #
179##########################
180
181load("//bazel:go_googleapis_compatibility_hack.bzl", "go_googleapis_compatibility_hack")
182
183# Compatibility hack to make the github.com/bazelbuild/remote-apis Go module work with rules_go
184# v0.41.0 or newer. See the go_googleapis() rule's docstring for details.
185go_googleapis_compatibility_hack(
186    name = "go_googleapis",
187)
188
189# Needed by @com_github_bazelbuild_remote_apis.
190http_archive(
191    name = "com_google_protobuf",
192    sha256 = "b8ab9bbdf0c6968cf20060794bc61e231fae82aaf69d6e3577c154181991f576",
193    strip_prefix = "protobuf-3.18.1",
194    urls = gcs_mirror_url(
195        sha256 = "b8ab9bbdf0c6968cf20060794bc61e231fae82aaf69d6e3577c154181991f576",
196        url = "https://github.com/protocolbuffers/protobuf/releases/download/v3.18.1/protobuf-all-3.18.1.tar.gz",
197    ),
198)
199
200# Originally, we pulled protobuf dependencies as follows:
201#
202#     load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
203#     protobuf_deps()
204#
205# The protobuf_deps() macro brings in a bunch of dependencies, but by copying the macro body here
206# and removing dependencies one by one, "rules_proto" was identified as the only dependency that is
207# required to build this repository.
208http_archive(
209    name = "rules_proto",
210    sha256 = "a4382f78723af788f0bc19fd4c8411f44ffe0a72723670a34692ffad56ada3ac",
211    strip_prefix = "rules_proto-f7a30f6f80006b591fa7c437fe5a951eb10bcbcf",
212    urls = ["https://github.com/bazelbuild/rules_proto/archive/f7a30f6f80006b591fa7c437fe5a951eb10bcbcf.zip"],
213)
214
215http_archive(
216    name = "com_google_googleapis",
217    sha256 = "38701e513aff81c89f0f727e925bf04ac4883913d03a60cdebb2c2a5f10beb40",
218    strip_prefix = "googleapis-86fa44cc5ee2136e87c312f153113d4dd8e9c4de",
219    urls = [
220        "https://github.com/googleapis/googleapis/archive/86fa44cc5ee2136e87c312f153113d4dd8e9c4de.tar.gz",
221    ],
222)
223
224# Needed by @com_github_bazelbuild_remote_apis for the googleapis protos.
225http_archive(
226    name = "googleapis",
227    build_file = "BUILD.googleapis",
228    sha256 = "7b6ea252f0b8fb5cd722f45feb83e115b689909bbb6a393a873b6cbad4ceae1d",
229    strip_prefix = "googleapis-143084a2624b6591ee1f9d23e7f5241856642f4d",
230    urls = gcs_mirror_url(
231        sha256 = "7b6ea252f0b8fb5cd722f45feb83e115b689909bbb6a393a873b6cbad4ceae1d",
232        # b/267219467
233        url = "https://github.com/googleapis/googleapis/archive/143084a2624b6591ee1f9d23e7f5241856642f4d.zip",
234    ),
235)
236
237load("@com_google_googleapis//:repository_rules.bzl", googleapis_imports_switched_rules_by_language = "switched_rules_by_language")
238
239googleapis_imports_switched_rules_by_language(
240    name = "com_google_googleapis_imports",
241    go = True,
242    grpc = True,
243)
244
245# Needed by @com_github_bazelbuild_remote_apis for gRPC.
246http_archive(
247    name = "com_github_grpc_grpc",
248    sha256 = "b391a327429279f6f29b9ae7e5317cd80d5e9d49cc100e6d682221af73d984a6",
249    strip_prefix = "grpc-93e8830070e9afcbaa992c75817009ee3f4b63a0",  # v1.24.3 with fixes
250    urls = gcs_mirror_url(
251        sha256 = "b391a327429279f6f29b9ae7e5317cd80d5e9d49cc100e6d682221af73d984a6",
252        # Fix after https://github.com/grpc/grpc/issues/32259 is resolved
253        url = "https://github.com/grpc/grpc/archive/93e8830070e9afcbaa992c75817009ee3f4b63a0.zip",
254    ),
255)
256
257# Originally, we pulled gRPC dependencies as follows:
258#
259#     load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
260#     grpc_deps()
261#
262# The grpc_deps() macro brings in a bunch of dependencies, but by copying the macro body here
263# and removing dependencies one by one, "zlib" was identified as the only dependency that is
264# required to build this repository.
265http_archive(
266    name = "zlib",
267    build_file = "@com_github_grpc_grpc//third_party:zlib.BUILD",
268    sha256 = "6d4d6640ca3121620995ee255945161821218752b551a1a180f4215f7d124d45",
269    strip_prefix = "zlib-cacf7f1d4e3d44d871b605da3b647f07d718623f",
270    url = "https://github.com/madler/zlib/archive/cacf7f1d4e3d44d871b605da3b647f07d718623f.tar.gz",
271)
272
273###################################################
274# JavaScript / TypeScript rules and dependencies. #
275###################################################
276
277# The npm_install rule runs anytime the package.json or package-lock.json file changes. It also
278# extracts any Bazel rules distributed in an npm package.
279load("@build_bazel_rules_nodejs//:index.bzl", "npm_install")
280
281# Manages the node_modules directory.
282npm_install(
283    name = "npm",
284    package_json = "//:package.json",
285    package_lock_json = "//:package-lock.json",
286)
287
288# io_bazel_rules_webtesting allows us to download browsers in a hermetic, repeatable way. This
289# currently includes Chromium and Firefox. Note that the version on this does not necessarily
290# match the version below of the browsers-X.Y.Z below that is available.
291http_archive(
292    name = "io_bazel_rules_webtesting",
293    sha256 = "e9abb7658b6a129740c0b3ef6f5a2370864e102a5ba5ffca2cea565829ed825a",
294    urls = gcs_mirror_url(
295        sha256 = "e9abb7658b6a129740c0b3ef6f5a2370864e102a5ba5ffca2cea565829ed825a",
296        url = "https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.5/rules_webtesting.tar.gz",
297    ),
298)
299
300# https://github.com/bazelbuild/rules_webtesting/blob/e9cf17123068b1123c68219edf9b274bf057b9cc/web/versioned/browsers-0.3.3.bzl
301load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.3.bzl", "browser_repositories")
302
303browser_repositories(
304    chromium = True,
305    firefox = True,
306)
307
308###################################################
309# Rust rules and dependencies.                    #
310###################################################
311
312http_archive(
313    name = "rules_rust",
314    integrity = "sha256-GuRaQT0LlDOYcyDfKtQQ22oV+vtsiM8P0b87qsvoJts=",
315    urls = gcs_mirror_url(
316        sha256 = "1ae45a413d0b9433987320df2ad410db6a15fafb6c88cf0fd1bf3baacbe826db",
317        url = "https://github.com/bazelbuild/rules_rust/releases/download/0.39.0/rules_rust-v0.39.0.tar.gz",
318    ),
319)
320
321load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")
322
323# https://github.com/bazelbuild/rules_rust/blob/5c715ec50602e2ba6ca2ebfdd870662a6e6d1eda/rust/repositories.bzl#L48
324rules_rust_dependencies()
325
326rust_register_toolchains(
327    edition = "2021",
328    extra_target_triples = ["aarch64-apple-darwin"],
329    versions = [
330        # supported versions from https://github.com/bazelbuild/rules_rust/blob/5c715ec50602e2ba6ca2ebfdd870662a6e6d1eda/util/fetch_shas_VERSIONS.txt
331        # The rust rules validate a toolchain by sha256 hash, as listed in https://github.com/bazelbuild/rules_rust/blob/5c715ec50602e2ba6ca2ebfdd870662a6e6d1eda/rust/known_shas.bzl
332        "1.76.0",
333    ],
334)
335
336# https://bazelbuild.github.io/rules_rust/crate_universe.html
337load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
338
339crate_universe_dependencies()
340
341# cxxbridge-cmd is a binary only Rust crate, so we follow these instructions for it
342# http://bazelbuild.github.io/rules_rust/crate_universe.html#binary-dependencies
343# If we need to update this, replace the Cargo.lock files with empty (existing) files and then
344# CARGO_BAZEL_REPIN=1 bazel sync --only=crate_index
345http_archive(
346    name = "cxxbridge_cmd",
347    build_file = "//bazel/external/cxxbridge_cmd:BUILD.bazel.skia",
348    sha256 = "b20c2a31fb5a2e2aeebced19e35d78a974301171391b39e36d5ebb00bea2aa93",
349    strip_prefix = "cxxbridge-cmd-1.0.94",
350    type = "tar.gz",
351    urls = gcs_mirror_url(
352        ext = ".tar.gz",
353        sha256 = "b20c2a31fb5a2e2aeebced19e35d78a974301171391b39e36d5ebb00bea2aa93",
354        url = "https://crates.io/api/v1/crates/cxxbridge-cmd/1.0.94/download",
355    ),
356)
357
358load("@rules_rust//crate_universe:defs.bzl", "crates_repository")
359
360# This finds all the dependencies needed to build cxxbridge_cmd...
361crates_repository(
362    name = "cxxbridge_cmd_deps",
363    cargo_lockfile = "//bazel/external/cxxbridge_cmd:Cargo.lock",
364    manifests = ["@cxxbridge_cmd//:Cargo.toml"],
365)
366
367load("@cxxbridge_cmd_deps//:defs.bzl", cxxbridge_cmd_deps = "crate_repositories")
368
369# ... and adds them to the workspace.
370cxxbridge_cmd_deps()
371
372# The cxx crate needs a custom BUILD.bazel file because the one that would be autogenerated
373# by http://bazelbuild.github.io/rules_rust/crate_universe.html#direct-packages does not work.
374# Thus, we download it ourselves, as if it were a binary-only package.
375http_archive(
376    name = "cxx",
377    build_file = "//bazel/external/cxx:BUILD.bazel.skia",
378    sha256 = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93",
379    strip_prefix = "cxx-1.0.94",
380    type = "tar.gz",
381    urls = gcs_mirror_url(
382        ext = ".tar.gz",
383        sha256 = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93",
384        url = "https://crates.io/api/v1/crates/cxx/1.0.94/download",
385    ),
386)
387
388# This finds all the dependencies needed to build cxx...
389crates_repository(
390    name = "cxx_deps",
391    cargo_lockfile = "//bazel/external/cxx:Cargo.lock",
392    manifests = ["@cxx//:Cargo.toml"],
393)
394
395load("@cxx_deps//:defs.bzl", cxx_deps = "crate_repositories")
396
397# ... and adds them to the workspace.
398cxx_deps()
399
400# The fontations repository consists of multiple crates. We download those
401# listed in the external/fontations/Cargo.* files.
402# Add this entry to have a root repository from which the individual
403# fontations crates can be fetched.
404# This allows them to be used as deps in other bazel targets.
405crates_repository(
406    name = "fontations",
407    cargo_lockfile = "//bazel/external/fontations:Cargo.lock",
408    manifests = ["//bazel/external/fontations:Cargo.toml"],
409)
410
411load("@fontations//:defs.bzl", fontations_crates = "crate_repositories")
412
413fontations_crates()
414
415# The icu4x repository consists of multiple crates. We download those
416# listed in the external/icu4x/Cargo.* files.
417# Add this entry to have a root repository from which the individual
418# icu4x crates can be fetched.
419# This allows them to be used as deps in other bazel targets.
420crates_repository(
421    name = "icu4x_deps",
422    cargo_lockfile = "//bazel/external/icu4x:Cargo.lock",
423    manifests = ["//bazel/external/icu4x:Cargo.toml"],
424)
425
426load("@icu4x_deps//:defs.bzl", icu4x_deps = "crate_repositories")
427
428icu4x_deps()
429
430# Skia uses crates from the vello repository that are under development and have not been published
431# to crates.io. Normally we could fetch them directly from the git mirror in the Cargo.lock file as
432# Bazel supports compiling them without any custom build rules. However, since Bazel's repository
433# rules don't play well with the vello_shader crate's build script, we compile the vello
434# crates from source using the rules defined in bazel/external/vello/BUILD.bazel and the
435# new_git_repository rule.
436#
437# vello_deps contains the dependencies of the two crates we build out of the vello repo (namely
438# vello_shaders and vello_encoding).
439#
440# See comments in bazel/external/vello/BUILD.bazel for more information.
441crates_repository(
442    name = "vello_deps",
443    cargo_lockfile = "//bazel/external/vello:Cargo.lock",
444    manifests = ["//bazel/external/vello:Cargo.toml"],
445)
446
447load("@vello_deps//:defs.bzl", vello_deps = "crate_repositories")
448
449vello_deps()
450
451###############################################################
452
453# Bazel will look for env variables ANDROID_HOME and ANDROID_NDK_HOME.
454# This is NOT hermetic as it requires the user to handle downloading the SDK  and accepting the
455# license independently.
456android_sdk_repository(name = "androidsdk")
457# TODO: skbug.com/14128
458# Uncomment the following after setting ANDROID_NDK_HOME to build for Android:
459# android_ndk_repository(name = "androidndk")
460
461# Clients must specify their own version of skia_user_config to overwrite SkUserConfig.h
462local_repository(
463    name = "skia_user_config",
464    path = "include/config",
465)
466
467# This are two lists of Bazel repository names, which is brought in by the following macro.
468# It is here for easier grepping, i.e. someone trying to find where a label like @brotli//:brotlidec
469# was defined. If a dep has its own BUILD rules, then one will need to go to its git repository
470# to find the BUILD or BUILD.bazel file with the rule. If a dep does not have Bazel support, then
471# that means someone on the Skia team wrote a BUILD.bazel file and put it in
472# //bazel/external/<dep_name> and one can go find it there.
473#
474#### START GENERATED LIST OF THIRD_PARTY DEPS
475# @abseil_cpp - https://skia.googlesource.com/external/github.com/abseil/abseil-cpp.git
476# @brotli - https://skia.googlesource.com/external/github.com/google/brotli.git
477# @highway - https://chromium.googlesource.com/external/github.com/google/highway.git
478# @spirv_headers - https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git
479# @spirv_tools - https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git
480#
481# @dawn - //bazel/external/dawn:BUILD.bazel
482# @dng_sdk - //bazel/external/dng_sdk:BUILD.bazel
483# @expat - //bazel/external/expat:BUILD.bazel
484# @freetype - //bazel/external/freetype:BUILD.bazel
485# @harfbuzz - //bazel/external/harfbuzz:BUILD.bazel
486# @icu - //bazel/external/icu:BUILD.bazel
487# @icu4x - //bazel/external/icu4x:BUILD.bazel
488# @imgui - //bazel/external/imgui:BUILD.bazel
489# @libavif - //bazel/external/libavif:BUILD.bazel
490# @libgav1 - //bazel/external/libgav1:BUILD.bazel
491# @libjpeg_turbo - //bazel/external/libjpeg_turbo:BUILD.bazel
492# @libjxl - //bazel/external/libjxl:BUILD.bazel
493# @libpng - //bazel/external/libpng:BUILD.bazel
494# @libwebp - //bazel/external/libwebp:BUILD.bazel
495# @libyuv - //bazel/external/libyuv:BUILD.bazel
496# @perfetto - //bazel/external/perfetto:BUILD.bazel
497# @piex - //bazel/external/piex:BUILD.bazel
498# @spirv_cross - //bazel/external/spirv_cross:BUILD.bazel
499# @vello - //bazel/external/vello:BUILD.bazel
500# @vulkan_headers - //bazel/external/vulkan_headers:BUILD.bazel
501# @vulkan_tools - //bazel/external/vulkan_tools:BUILD.bazel
502# @vulkan_utility_libraries - //bazel/external/vulkan_utility_libraries:BUILD.bazel
503# @vulkanmemoryallocator - //bazel/external/vulkanmemoryallocator:BUILD.bazel
504# @wuffs - //bazel/external/wuffs:BUILD.bazel
505# @zlib_skia - //bazel/external/zlib_skia:BUILD.bazel
506#### END GENERATED LIST OF THIRD_PARTY DEPS
507c_plus_plus_deps()
508
509# In order to copy the Freetype configurations into the checked out Freetype folder,
510# it is easiest to treat them as a third-party dependency from the perspective of Freetype.
511# To do that, we put them in their own Bazel workspace and then have our injected BUILD.bazel
512# for Freetype reference this workspace.
513# https://bazel.build/reference/be/workspace#new_local_repository
514local_repository(
515    name = "freetype_config",
516    path = "bazel/external/freetype/config",
517)
518
519local_repository(
520    name = "harfbuzz_config",
521    path = "bazel/external/harfbuzz/config",
522)
523
524local_repository(
525    name = "icu_utils",
526    path = "bazel/external/icu/utils",
527)
528
529local_repository(
530    name = "expat_config",
531    path = "bazel/external/expat/config",
532)
533
534load("//bazel:cipd_install.bzl", "cipd_install")
535
536cipd_install(
537    name = "git_linux_amd64",
538    build_file_content = """
539filegroup(
540  name = "all_files",
541  # The exclude pattern prevents files with spaces in their names from tripping up Bazel.
542  srcs = glob(include=["**/*"], exclude=["**/* *"]),
543  visibility = ["//visibility:public"],
544)
545""",
546    cipd_package = "infra/3pp/tools/git/linux-amd64",
547    # Based on
548    # https://skia.googlesource.com/buildbot/+/f1d21dc58818cd6aba0a7822e59d37636aefe936/WORKSPACE#391.
549    #
550    # Note that the below "git config" commands do not affect the user's Git configuration. These
551    # settings are only visible to Bazel targets that depend on @git_linux_amd64//:all_files via
552    # the "data" attribute. The result of these commands can be examined as follows:
553    #
554    #     $ cat $(bazel info output_base)/external/git_linux_amd64/etc/gitconfig
555    #     [user]
556    #             name = Bazel Test User
557    #             email = bazel-test-user@example.com
558    postinstall_cmds_posix = [
559        "mkdir etc",
560        "bin/git config --system user.name \"Bazel Test User\"",
561        "bin/git config --system user.email \"bazel-test-user@example.com\"",
562    ],
563    # From https://chrome-infra-packages.appspot.com/p/infra/3pp/tools/git/linux-amd64/+/version:2.29.2.chromium.6
564    sha256 = "36cb96051827d6a3f6f59c5461996fe9490d997bcd2b351687d87dcd4a9b40fa",
565    tag = "version:2.29.2.chromium.6",
566)
567
568cipd_install(
569    name = "gn_linux_amd64",
570    build_file_content = """
571exports_files(
572    ["gn"],
573    visibility = ["//visibility:public"]
574)
575""",
576    cipd_package = "gn/gn/linux-amd64",
577    # From https://chrome-infra-packages.appspot.com/p/gn/gn/linux-amd64/+/git_revision:1c4151ff5c1d6fbf7fa800b8d4bb34d3abc03a41
578    sha256 = "7195291488d08f3a10e85b85d8c4816e077015f1c5f196f770003a97aa42caf8",
579    tag = "git_revision:1c4151ff5c1d6fbf7fa800b8d4bb34d3abc03a41",
580)
581
582cipd_install(
583    name = "gn_mac_arm64",
584    build_file_content = """
585exports_files(
586    ["gn"],
587    visibility = ["//visibility:public"]
588)
589""",
590    cipd_package = "gn/gn/mac-arm64",
591    # From https://chrome-infra-packages.appspot.com/p/gn/gn/mac-arm64/+/git_revision:1c4151ff5c1d6fbf7fa800b8d4bb34d3abc03a41
592    sha256 = "1123907ac3317530e9dd537d50cd83fd83e852aacc07d286f45753c8fc5287ed",
593    tag = "git_revision:1c4151ff5c1d6fbf7fa800b8d4bb34d3abc03a41",
594)
595
596cipd_install(
597    name = "gn_mac_amd64",
598    build_file_content = """
599exports_files(
600    ["gn"],
601    visibility = ["//visibility:public"]
602)
603""",
604    cipd_package = "gn/gn/mac-amd64",
605    # From https://chrome-infra-packages.appspot.com/p/gn/gn/mac-amd64/+/git_revision:1c4151ff5c1d6fbf7fa800b8d4bb34d3abc03a41
606    sha256 = "ed96f7d2f49b83b016e4bdbed432e4734a5a133accb025d7c07685e01489ba93",
607    tag = "git_revision:1c4151ff5c1d6fbf7fa800b8d4bb34d3abc03a41",
608)
609
610cipd_install(
611    name = "skimage",
612    build_file = "//bazel/external/skimage:BUILD.bazel",
613    cipd_package = "skia/bots/skimage",
614    # From https://chrome-infra-packages.appspot.com/p/skia/bots/skimage/+/sRladEfUAXeYIBD3Pt3ke0Fd08vtYVLrg4IASKk5F6YC
615    sha256 = "b1195a7447d40177982010f73edde47b415dd3cbed6152eb83820048a93917a6",
616    tag = "version:47",
617)
618
619http_file(
620    name = "buildifier_linux_x64",
621    downloaded_file_path = "buildifier",
622    executable = True,
623    sha256 = "be63db12899f48600bad94051123b1fd7b5251e7661b9168582ce52396132e92",
624    urls = gcs_mirror_url(
625        ext = "",
626        sha256 = "be63db12899f48600bad94051123b1fd7b5251e7661b9168582ce52396132e92",
627        url = "https://github.com/bazelbuild/buildtools/releases/download/v6.4.0/buildifier-linux-amd64",
628    ),
629)
630
631http_file(
632    name = "buildifier_macos_arm64",
633    downloaded_file_path = "buildifier",
634    executable = True,
635    sha256 = "fa07ba0d20165917ca4cc7609f9b19a8a4392898148b7babdf6bb2a7dd963f05",
636    urls = gcs_mirror_url(
637        ext = "",
638        sha256 = "fa07ba0d20165917ca4cc7609f9b19a8a4392898148b7babdf6bb2a7dd963f05",
639        url = "https://github.com/bazelbuild/buildtools/releases/download/v6.4.0/buildifier-darwin-arm64",
640    ),
641)
642
643http_file(
644    name = "buildifier_macos_x64",
645    downloaded_file_path = "buildifier",
646    executable = True,
647    sha256 = "eeb47b2de27f60efe549348b183fac24eae80f1479e8b06cac0799c486df5bed",
648    urls = gcs_mirror_url(
649        ext = "",
650        sha256 = "eeb47b2de27f60efe549348b183fac24eae80f1479e8b06cac0799c486df5bed",
651        url = "https://github.com/bazelbuild/buildtools/releases/download/v6.4.0/buildifier-darwin-amd64",
652    ),
653)
654
655##################################
656# Docker rules and dependencies. #
657##################################
658
659http_archive(
660    name = "io_bazel_rules_docker",
661    sha256 = "27d53c1d646fc9537a70427ad7b034734d08a9c38924cc6357cc973fed300820",
662    strip_prefix = "rules_docker-0.24.0",
663    urls = gcs_mirror_url(
664        sha256 = "27d53c1d646fc9537a70427ad7b034734d08a9c38924cc6357cc973fed300820",
665        url = "https://github.com/bazelbuild/rules_docker/releases/download/v0.24.0/rules_docker-v0.24.0.tar.gz",
666    ),
667)
668
669load(
670    "@io_bazel_rules_docker//repositories:repositories.bzl",
671    container_repositories = "repositories",
672)
673
674container_repositories()
675
676# This is required by the toolchain_container rule.
677load(
678    "@io_bazel_rules_docker//repositories:go_repositories.bzl",
679    container_go_deps = "go_deps",
680)
681
682container_go_deps()
683
684load(
685    "@io_bazel_rules_docker//container:container.bzl",
686    "container_pull",
687)
688
689# Pulls the gcr.io/skia-public/debugger-app-base container.
690container_pull(
691    name = "debugger-app-base",
692    digest = "sha256:cf5bc2e4a408ae68ab199d65b1d7550be8ed1aaa57f97340598fc2df4e110ad6",
693    registry = "gcr.io",
694    repository = "skia-public/debugger-app-base",
695)
696
697# Pulls the gcr.io/skia-public/jsfiddle-base container.
698container_pull(
699    name = "jsfiddle-base",
700    digest = "sha256:dbe6ed71568e0034ce3d6dce9f6dc264c2e81b219559ecb2351d3a6ff87eed7f",
701    registry = "gcr.io",
702    repository = "skia-public/jsfiddle-base",
703)
704
705# Pulls the gcr.io/skia-public/shaders-base container.
706container_pull(
707    name = "shaders-base",
708    digest = "sha256:6abcfbb93857acaaf8c27dd52392b6fff9e7218201abeed640321f7f8d64dc2e",
709    registry = "gcr.io",
710    repository = "skia-public/shaders-base",
711)
712
713# Pulls the gcr.io/skia-public/skottie-base container.
714container_pull(
715    name = "skottie-base",
716    digest = "sha256:b9f194451019e88ceabaafe4a687ec475b5d6e87c4433b40bf15b613a07d24be",
717    registry = "gcr.io",
718    repository = "skia-public/skottie-base",
719)
720