blob: 8b273b644e936e96743e51c612645de030f4680c [file] [log] [blame]
Kevin Lubick4d413042021-10-20 16:20:42 -04001workspace(name = "skia")
Mike Kleinc1cc1d82020-09-11 11:11:33 -05002
Kevin Lubick6f4fd972023-08-29 10:44:24 -04003load("//bazel:deps.bzl", "bazel_deps", "c_plus_plus_deps")
Kevin Lubick705ba5c2023-10-13 11:50:23 -04004
Kevin Lubick6f4fd972023-08-29 10:44:24 -04005bazel_deps()
6
Kevin Lubick9b7db632022-04-01 08:29:11 -04007load("//toolchain:download_toolchains.bzl", "download_toolchains_for_skia")
8
Leandro Lovisoloa498ebc2023-04-03 23:05:54 +00009download_toolchains_for_skia("clang_linux_amd64", "clang_mac", "ndk_linux_amd64")
Kevin Lubick9b7db632022-04-01 08:29:11 -040010
Kevin Lubick1f8c31b2021-11-08 15:26:09 -050011load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
Chris Mumford16475d72023-07-19 05:37:13 -070012load("//bazel:gcs_mirror.bzl", "gcs_mirror_url")
Kevin Lubick4d413042021-10-20 16:20:42 -040013
Kevin Lubick1f8c31b2021-11-08 15:26:09 -050014# See https://github.com/emscripten-core/emsdk/tree/85d27a4a2a60d591613a305b14ae438c2bb3ce11/bazel#setup-instructions
15http_archive(
16 name = "emsdk",
Kevin Lubick36490052023-08-10 09:47:34 -040017 sha256 = "cb8cded78f6953283429d724556e89211e51ac4d871fcf38e0b32405ee248e91",
18 strip_prefix = "emsdk-3.1.44/bazel",
Kevin Lubickb6492f52023-08-10 12:43:07 -040019 urls = gcs_mirror_url(
20 sha256 = "cb8cded78f6953283429d724556e89211e51ac4d871fcf38e0b32405ee248e91",
21 url = "https://github.com/emscripten-core/emsdk/archive/refs/tags/3.1.44.tar.gz",
22 ),
Kevin Lubick1f8c31b2021-11-08 15:26:09 -050023)
24
25load("@emsdk//:deps.bzl", emsdk_deps = "deps")
26
Kevin Lubick36490052023-08-10 09:47:34 -040027# One of the deps here is build_bazel_rules_nodejs, currently version 5.8.0
Kevin Lubicka2d39582022-02-23 09:02:11 -050028# If we try to install it ourselves after this, it won't work.
Kevin Lubick1f8c31b2021-11-08 15:26:09 -050029emsdk_deps()
30
31load("@emsdk//:emscripten_deps.bzl", emsdk_emscripten_deps = "emscripten_deps")
32
Kevin Lubick36490052023-08-10 09:47:34 -040033emsdk_emscripten_deps(emscripten_version = "3.1.44")
Kevin Lubick1f8c31b2021-11-08 15:26:09 -050034
Kevin Lubickfed97e82022-03-25 14:59:33 -040035load("@bazel_toolchains//repositories:repositories.bzl", bazel_toolchains_repositories = "repositories")
36
37bazel_toolchains_repositories()
38
Kevin Lubick705ba5c2023-10-13 11:50:23 -040039http_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
Kevin Lubick54bd4422022-03-25 12:36:17 -040052#######################################################################################
53# Python
54#######################################################################################
55
56# https://github.com/bazelbuild/rules_python
Kevin Lubick888d4ef2021-11-16 14:09:44 -050057http_archive(
58 name = "rules_python",
Kevin Lubicka74ebc92022-06-30 11:28:23 -040059 sha256 = "5fa3c738d33acca3b97622a13a741129f67ef43f5fdfcec63b29374cc0574c29",
60 strip_prefix = "rules_python-0.9.0",
Kevin Lubickb6492f52023-08-10 12:43:07 -040061 urls = gcs_mirror_url(
62 sha256 = "5fa3c738d33acca3b97622a13a741129f67ef43f5fdfcec63b29374cc0574c29",
63 url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.9.0.tar.gz",
64 ),
Kevin Lubick888d4ef2021-11-16 14:09:44 -050065)
Kevin Lubickcc9d0cd2021-11-23 14:58:20 -050066
Kevin Lubick54bd4422022-03-25 12:36:17 -040067# 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
Kevin Lubickcc9d0cd2021-11-23 14:58:20 -050085#######################################################################################
Jorge Betancourt1b22e2d2023-02-16 15:31:45 -050086# Maven
87#######################################################################################
88
89# https://github.com/bazelbuild/rules_jvm_external
90http_archive(
91 name = "rules_jvm_external",
Jorge Betancourt1b22e2d2023-02-16 15:31:45 -050092 sha256 = "cd1a77b7b02e8e008439ca76fd34f5b07aecb8c752961f9640dea15e9e5ba1ca",
Kevin Lubickdbe4dd92023-04-04 14:28:13 -040093 strip_prefix = "rules_jvm_external-4.2",
Kevin Lubickb6492f52023-08-10 12:43:07 -040094 urls = gcs_mirror_url(
95 sha256 = "cd1a77b7b02e8e008439ca76fd34f5b07aecb8c752961f9640dea15e9e5ba1ca",
96 url = "https://github.com/bazelbuild/rules_jvm_external/archive/4.2.zip",
97 ),
Jorge Betancourt1b22e2d2023-02-16 15:31:45 -050098)
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#######################################################################################
Kevin Lubickcc9d0cd2021-11-23 14:58:20 -0500124# Gazelle
125#######################################################################################
Leandro Lovisolo48f959a2023-12-19 03:16:30 +0000126
Kevin Lubickcc9d0cd2021-11-23 14:58:20 -0500127http_archive(
128 name = "io_bazel_rules_go",
Leandro Lovisolo48f959a2023-12-19 03:16:30 +0000129 sha256 = "91585017debb61982f7054c9688857a2ad1fd823fc3f9cb05048b0025c47d023",
Kevin Lubickcc9d0cd2021-11-23 14:58:20 -0500130 urls = [
Leandro Lovisolo48f959a2023-12-19 03:16:30 +0000131 "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",
Kevin Lubickcc9d0cd2021-11-23 14:58:20 -0500133 ],
134)
135
136http_archive(
137 name = "bazel_gazelle",
Leandro Lovisolo48f959a2023-12-19 03:16:30 +0000138 sha256 = "d3fa66a39028e97d76f9e2db8f1b0c11c099e8e01bf363a923074784e451f809",
Kevin Lubickcc9d0cd2021-11-23 14:58:20 -0500139 urls = [
Leandro Lovisolo48f959a2023-12-19 03:16:30 +0000140 "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",
Kevin Lubickcc9d0cd2021-11-23 14:58:20 -0500142 ],
143)
144
Kevin Lubickcc9d0cd2021-11-23 14:58:20 -0500145load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
Leandro Lovisolo48f959a2023-12-19 03:16:30 +0000146load("@io_bazel_rules_go//go:deps.bzl", "go_download_sdk", "go_register_toolchains", "go_rules_dependencies")
Kevin Lubickcc9d0cd2021-11-23 14:58:20 -0500147load("//:go_repositories.bzl", "go_repositories")
148
149# gazelle:repository_macro go_repositories.bzl%go_repositories
150go_repositories()
151
152go_rules_dependencies()
153
Kevin Lubicka4cb7f22022-11-14 15:28:35 -0500154# For our Linux RBE pool
155go_download_sdk(
156 name = "go_sdk_linux_amd64",
157 goarch = "amd64",
158 goos = "linux",
Leandro Lovisolo48f959a2023-12-19 03:16:30 +0000159 version = "1.21.4",
Kevin Lubicka4cb7f22022-11-14 15:28:35 -0500160)
Kevin Lubickcc9d0cd2021-11-23 14:58:20 -0500161
Kevin Lubicka4cb7f22022-11-14 15:28:35 -0500162# For the host machine
163go_download_sdk(
164 name = "go_sdk",
Leandro Lovisolo48f959a2023-12-19 03:16:30 +0000165 version = "1.21.4",
Kevin Lubicka4cb7f22022-11-14 15:28:35 -0500166)
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)
Kevin Lubicka2d39582022-02-23 09:02:11 -0500176
Leandro Lovisolo48f959a2023-12-19 03:16:30 +0000177##########################
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.
Kevin Lubick5fb37db2022-03-03 10:42:57 -0500190http_archive(
191 name = "com_google_protobuf",
Leandro Lovisolo43328432023-02-14 19:57:58 +0000192 sha256 = "b8ab9bbdf0c6968cf20060794bc61e231fae82aaf69d6e3577c154181991f576",
193 strip_prefix = "protobuf-3.18.1",
Kevin Lubickb6492f52023-08-10 12:43:07 -0400194 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 ),
Kevin Lubick5fb37db2022-03-03 10:42:57 -0500198)
199
Leandro Lovisolo48f959a2023-12-19 03:16:30 +0000200# 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)
Kevin Lubick5fb37db2022-03-03 10:42:57 -0500214
Leandro Lovisolo48f959a2023-12-19 03:16:30 +0000215http_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)
Kevin Lubick5fb37db2022-03-03 10:42:57 -0500272
Kevin Lubicka2d39582022-02-23 09:02:11 -0500273###################################################
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",
Kevin Lubickb6492f52023-08-10 12:43:07 -0400294 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 ),
Kevin Lubicka2d39582022-02-23 09:02:11 -0500298)
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)
Kevin Lubick14abec42022-03-21 13:06:32 -0400307
Kevin Lubickdbe4dd92023-04-04 14:28:13 -0400308###################################################
309# Rust rules and dependencies. #
310###################################################
311
312http_archive(
313 name = "rules_rust",
Arman Uguray1ceb74e2024-02-20 15:11:48 -0800314 integrity = "sha256-GuRaQT0LlDOYcyDfKtQQ22oV+vtsiM8P0b87qsvoJts=",
Kevin Lubickb6492f52023-08-10 12:43:07 -0400315 urls = gcs_mirror_url(
Arman Uguray1ceb74e2024-02-20 15:11:48 -0800316 sha256 = "1ae45a413d0b9433987320df2ad410db6a15fafb6c88cf0fd1bf3baacbe826db",
317 url = "https://github.com/bazelbuild/rules_rust/releases/download/0.39.0/rules_rust-v0.39.0.tar.gz",
Kevin Lubickb6492f52023-08-10 12:43:07 -0400318 ),
Kevin Lubick23f1dcb2023-03-23 10:34:20 -0400319)
320
Kevin Lubickdbe4dd92023-04-04 14:28:13 -0400321load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")
322
Arman Uguray1ceb74e2024-02-20 15:11:48 -0800323# https://github.com/bazelbuild/rules_rust/blob/5c715ec50602e2ba6ca2ebfdd870662a6e6d1eda/rust/repositories.bzl#L48
Kevin Lubickdbe4dd92023-04-04 14:28:13 -0400324rules_rust_dependencies()
325
326rust_register_toolchains(
327 edition = "2021",
Kevin Lubickb6492f52023-08-10 12:43:07 -0400328 extra_target_triples = ["aarch64-apple-darwin"],
Kevin Lubickdbe4dd92023-04-04 14:28:13 -0400329 versions = [
Arman Uguray1ceb74e2024-02-20 15:11:48 -0800330 # 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",
Kevin Lubickdbe4dd92023-04-04 14:28:13 -0400333 ],
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",
Kevin Lubickb6492f52023-08-10 12:43:07 -0400351 urls = gcs_mirror_url(
Chris Mumforda0d0ff22023-08-16 10:36:33 -0700352 ext = ".tar.gz",
Kevin Lubickb6492f52023-08-10 12:43:07 -0400353 sha256 = "b20c2a31fb5a2e2aeebced19e35d78a974301171391b39e36d5ebb00bea2aa93",
354 url = "https://crates.io/api/v1/crates/cxxbridge-cmd/1.0.94/download",
Kevin Lubickb6492f52023-08-10 12:43:07 -0400355 ),
Kevin Lubickdbe4dd92023-04-04 14:28:13 -0400356)
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",
Kevin Lubickb6492f52023-08-10 12:43:07 -0400381 urls = gcs_mirror_url(
Chris Mumforda0d0ff22023-08-16 10:36:33 -0700382 ext = ".tar.gz",
Kevin Lubickb6492f52023-08-10 12:43:07 -0400383 sha256 = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93",
384 url = "https://crates.io/api/v1/crates/cxx/1.0.94/download",
Kevin Lubickb6492f52023-08-10 12:43:07 -0400385 ),
Kevin Lubickdbe4dd92023-04-04 14:28:13 -0400386)
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
Dominik Röttsches97113b72023-04-06 17:38:14 +0300400# 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
Julia Lavrovaabef1592023-10-02 15:18:19 +0000415# 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
Arman Ugurayccbee172023-05-16 12:23:22 -0700430# 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
Kevin Lubickdbe4dd92023-04-04 14:28:13 -0400451###############################################################
452
Jorge Betancourt1b22e2d2023-02-16 15:31:45 -0500453# 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
Kevin Lubickdbe4dd92023-04-04 14:28:13 -0400461# 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
Kevin Lubick42639b12022-10-28 10:44:21 -0400467# 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
Julia Lavrovaabef1592023-10-02 15:18:19 +0000487# @icu4x - //bazel/external/icu4x:BUILD.bazel
Kevin Lubick4c491702023-04-24 09:08:06 -0400488# @imgui - //bazel/external/imgui:BUILD.bazel
Kevin Lubick42639b12022-10-28 10:44:21 -0400489# @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
Arman Ugurayccbee172023-05-16 12:23:22 -0700499# @vello - //bazel/external/vello:BUILD.bazel
Kevin Lubick42639b12022-10-28 10:44:21 -0400500# @vulkan_headers - //bazel/external/vulkan_headers:BUILD.bazel
501# @vulkan_tools - //bazel/external/vulkan_tools:BUILD.bazel
skia-autoroll60d07562023-09-25 15:33:38 +0000502# @vulkan_utility_libraries - //bazel/external/vulkan_utility_libraries:BUILD.bazel
Kevin Lubick42639b12022-10-28 10:44:21 -0400503# @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
Kevin Lubick6f4fd972023-08-29 10:44:24 -0400507c_plus_plus_deps()
Kevin Lubick1b1e64c2022-07-18 13:30:16 -0400508
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.
Kevin Lubick42639b12022-10-28 10:44:21 -0400513# https://bazel.build/reference/be/workspace#new_local_repository
Kevin Lubick1b1e64c2022-07-18 13:30:16 -0400514local_repository(
515 name = "freetype_config",
516 path = "bazel/external/freetype/config",
517)
518
Kevin Lubick0a5bcd12022-07-18 08:35:33 -0400519local_repository(
520 name = "harfbuzz_config",
521 path = "bazel/external/harfbuzz/config",
522)
523
Kevin Lubick87c0fe12022-07-18 08:12:59 -0400524local_repository(
525 name = "icu_utils",
526 path = "bazel/external/icu/utils",
527)
Kevin Lubickf5619ce2022-11-11 09:29:04 -0500528
Kevin Lubick4a4cfed2022-11-28 13:28:47 -0500529local_repository(
530 name = "expat_config",
531 path = "bazel/external/expat/config",
532)
533
Kevin Lubickf5619ce2022-11-11 09:29:04 -0500534load("//bazel:cipd_install.bzl", "cipd_install")
535
536cipd_install(
Leandro Lovisoloda6b7452023-08-21 18:09:59 +0000537 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(
Kevin Lubickf5619ce2022-11-11 09:29:04 -0500569 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)
Chris Mumford16475d72023-07-19 05:37:13 -0700609
Leandro Lovisolo1fbe5212023-08-08 21:16:44 +0000610cipd_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)
Chris Mumford16475d72023-07-19 05:37:13 -0700618
619##################################
620# Docker rules and dependencies. #
621##################################
622
623http_archive(
624 name = "io_bazel_rules_docker",
625 sha256 = "27d53c1d646fc9537a70427ad7b034734d08a9c38924cc6357cc973fed300820",
626 strip_prefix = "rules_docker-0.24.0",
627 urls = gcs_mirror_url(
628 sha256 = "27d53c1d646fc9537a70427ad7b034734d08a9c38924cc6357cc973fed300820",
629 url = "https://github.com/bazelbuild/rules_docker/releases/download/v0.24.0/rules_docker-v0.24.0.tar.gz",
630 ),
631)
632
633load(
634 "@io_bazel_rules_docker//repositories:repositories.bzl",
635 container_repositories = "repositories",
636)
637
638container_repositories()
639
640# This is required by the toolchain_container rule.
641load(
642 "@io_bazel_rules_docker//repositories:go_repositories.bzl",
643 container_go_deps = "go_deps",
644)
645
646container_go_deps()
647
648load(
649 "@io_bazel_rules_docker//container:container.bzl",
650 "container_pull",
651)
Chris Mumford224675a2023-07-20 08:09:56 -0700652
653# Pulls the gcr.io/skia-public/debugger-app-base container.
654container_pull(
655 name = "debugger-app-base",
skia-autoroll87304562024-02-12 19:15:46 +0000656 digest = "sha256:be5714074b1a82c629339778a83c9b1c39714caae1ed189303547b1bcff7322c",
Chris Mumford224675a2023-07-20 08:09:56 -0700657 registry = "gcr.io",
658 repository = "skia-public/debugger-app-base",
659)
Chris Mumford58397bf2023-08-14 11:56:45 -0700660
661# Pulls the gcr.io/skia-public/jsfiddle-base container.
662container_pull(
663 name = "jsfiddle-base",
skia-autorolla7fad5a2024-02-12 19:14:37 +0000664 digest = "sha256:0ccdb32ff1ca8ea3ac25a29f4efaed8d65cf25bb717fed89e0c72b1f752328bd",
Chris Mumford58397bf2023-08-14 11:56:45 -0700665 registry = "gcr.io",
666 repository = "skia-public/jsfiddle-base",
667)
Chris Mumforda0d0ff22023-08-16 10:36:33 -0700668
669# Pulls the gcr.io/skia-public/shaders-base container.
670container_pull(
671 name = "shaders-base",
skia-autoroll2afb4ad2024-02-12 19:14:37 +0000672 digest = "sha256:b04a5aef564be1f5ad0a62af3acee228d86117a802ec695f039771565d6183b9",
Chris Mumforda0d0ff22023-08-16 10:36:33 -0700673 registry = "gcr.io",
674 repository = "skia-public/shaders-base",
675)
Chris Mumford40442132023-08-21 11:28:43 -0700676
677# Pulls the gcr.io/skia-public/skottie-base container.
678container_pull(
679 name = "skottie-base",
skia-autoroll2d5cf672024-02-14 14:57:12 +0000680 digest = "sha256:99a18601ac2447a50a215f5cb65fc08ced5ebbde14db0d22524b05275e244796",
Chris Mumford40442132023-08-21 11:28:43 -0700681 registry = "gcr.io",
682 repository = "skia-public/skottie-base",
683)