blob: 39478618eb9db24e6b499ff504d77ed8d2afaf85 [file] [log] [blame]
workspace(name = "skia")
load("//toolchain:download_toolchains.bzl", "download_toolchains_for_skia")
download_toolchains_for_skia("clang_linux_amd64", "clang_mac")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# See https://github.com/emscripten-core/emsdk/tree/85d27a4a2a60d591613a305b14ae438c2bb3ce11/bazel#setup-instructions
http_archive(
name = "emsdk",
sha256 = "74c7c54b3544555ec38d1e9dcc7e90b9f49ed0e04f2cc3fd44663c598af24124",
strip_prefix = "emsdk-3.1.15/bazel",
urls = [
"https://github.com/emscripten-core/emsdk/archive/refs/tags/3.1.15.tar.gz",
"https://storage.googleapis.com/skia-world-readable/bazel/74c7c54b3544555ec38d1e9dcc7e90b9f49ed0e04f2cc3fd44663c598af24124.tar.gz",
],
)
load("@emsdk//:deps.bzl", emsdk_deps = "deps")
# One of the deps here is build_bazel_rules_nodejs, currently version 4.4.1
# If we try to install it ourselves after this, it won't work.
emsdk_deps()
load("@emsdk//:emscripten_deps.bzl", emsdk_emscripten_deps = "emscripten_deps")
emsdk_emscripten_deps(emscripten_version = "3.1.9")
http_archive(
name = "bazel_skylib",
sha256 = "c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
],
)
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()
http_archive(
name = "bazel_toolchains",
sha256 = "e52789d4e89c3e2dc0e3446a9684626a626b6bec3fde787d70bae37c6ebcc47f",
strip_prefix = "bazel-toolchains-5.1.1",
urls = [
"https://github.com/bazelbuild/bazel-toolchains/archive/refs/tags/v5.1.1.tar.gz",
"https://storage.googleapis.com/skia-world-readable/bazel/e52789d4e89c3e2dc0e3446a9684626a626b6bec3fde787d70bae37c6ebcc47f.tar.gz",
],
)
load("@bazel_toolchains//repositories:repositories.bzl", bazel_toolchains_repositories = "repositories")
bazel_toolchains_repositories()
#######################################################################################
# Python
#######################################################################################
# https://github.com/bazelbuild/rules_python
http_archive(
name = "rules_python",
sha256 = "5fa3c738d33acca3b97622a13a741129f67ef43f5fdfcec63b29374cc0574c29",
strip_prefix = "rules_python-0.9.0",
urls = [
"https://github.com/bazelbuild/rules_python/archive/refs/tags/0.9.0.tar.gz",
"https://storage.googleapis.com/skia-world-readable/bazel/5fa3c738d33acca3b97622a13a741129f67ef43f5fdfcec63b29374cc0574c29.tar.gz",
],
)
# This sets up a hermetic python3, rather than depending on what is installed.
load("@rules_python//python:repositories.bzl", "python_register_toolchains")
python_register_toolchains(
name = "python3_9",
# https://github.com/bazelbuild/rules_python/blob/main/python/versions.bzl
python_version = "3.9",
)
load("@python3_9//:defs.bzl", "interpreter")
load("@rules_python//python:pip.bzl", "pip_install")
pip_install(
name = "py_deps",
python_interpreter_target = interpreter,
requirements = "//:requirements.txt",
)
#######################################################################################
# Gazelle
#######################################################################################
http_archive(
name = "io_bazel_rules_go",
sha256 = "099a9fb96a376ccbbb7d291ed4ecbdfd42f6bc822ab77ae6f1b5cb9e914e94fa",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip",
],
)
http_archive(
name = "bazel_gazelle",
sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_download_sdk", "go_register_toolchains", "go_rules_dependencies")
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
load("//:go_repositories.bzl", "go_repositories")
# gazelle:repository_macro go_repositories.bzl%go_repositories
go_repositories()
go_rules_dependencies()
# For our Linux RBE pool
go_download_sdk(
name = "go_sdk_linux_amd64",
goarch = "amd64",
goos = "linux",
version = "1.18",
)
# For the host machine
go_download_sdk(
name = "go_sdk",
version = "1.18",
)
# Do not specify a version here or it will be an error (because we
# specified the version above when downloading SDKs)
go_register_toolchains()
gazelle_dependencies(
go_repository_default_config = "//:WORKSPACE.bazel",
go_sdk = "go_sdk",
)
# Because the skia infra repo has a dependency on google.golang.org/grpc (aka
# @org_golang_google_grpc), we need to have this library available to build protos.
# https://github.com/bazelbuild/rules_go#protobuf-and-grpc
http_archive(
name = "com_google_protobuf",
sha256 = "d0f5f605d0d656007ce6c8b5a82df3037e1d8fe8b121ed42e536f569dec16113",
strip_prefix = "protobuf-3.14.0",
urls = [
"https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v3.14.0.tar.gz",
"https://github.com/protocolbuffers/protobuf/archive/v3.14.0.tar.gz",
],
)
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()
###################################################
# JavaScript / TypeScript rules and dependencies. #
###################################################
# The npm_install rule runs anytime the package.json or package-lock.json file changes. It also
# extracts any Bazel rules distributed in an npm package.
load("@build_bazel_rules_nodejs//:index.bzl", "npm_install")
# Manages the node_modules directory.
npm_install(
name = "npm",
package_json = "//:package.json",
package_lock_json = "//:package-lock.json",
)
# io_bazel_rules_webtesting allows us to download browsers in a hermetic, repeatable way. This
# currently includes Chromium and Firefox. Note that the version on this does not necessarily
# match the version below of the browsers-X.Y.Z below that is available.
http_archive(
name = "io_bazel_rules_webtesting",
sha256 = "e9abb7658b6a129740c0b3ef6f5a2370864e102a5ba5ffca2cea565829ed825a",
urls = [
"https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.5/rules_webtesting.tar.gz",
"https://storage.googleapis.com/skia-world-readable/bazel/e9abb7658b6a129740c0b3ef6f5a2370864e102a5ba5ffca2cea565829ed825a.tar.gz",
],
)
# https://github.com/bazelbuild/rules_webtesting/blob/e9cf17123068b1123c68219edf9b274bf057b9cc/web/versioned/browsers-0.3.3.bzl
load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.3.bzl", "browser_repositories")
browser_repositories(
chromium = True,
firefox = True,
)
load("//bazel:deps.bzl", "git_repos_from_deps")
# This are two lists of Bazel repository names, which is brought in by the following macro.
# It is here for easier grepping, i.e. someone trying to find where a label like @brotli//:brotlidec
# was defined. If a dep has its own BUILD rules, then one will need to go to its git repository
# to find the BUILD or BUILD.bazel file with the rule. If a dep does not have Bazel support, then
# that means someone on the Skia team wrote a BUILD.bazel file and put it in
# //bazel/external/<dep_name> and one can go find it there.
#
#### START GENERATED LIST OF THIRD_PARTY DEPS
# @abseil_cpp - https://skia.googlesource.com/external/github.com/abseil/abseil-cpp.git
# @brotli - https://skia.googlesource.com/external/github.com/google/brotli.git
# @highway - https://chromium.googlesource.com/external/github.com/google/highway.git
# @spirv_headers - https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git
# @spirv_tools - https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git
#
# @dawn - //bazel/external/dawn:BUILD.bazel
# @dng_sdk - //bazel/external/dng_sdk:BUILD.bazel
# @expat - //bazel/external/expat:BUILD.bazel
# @freetype - //bazel/external/freetype:BUILD.bazel
# @harfbuzz - //bazel/external/harfbuzz:BUILD.bazel
# @icu - //bazel/external/icu:BUILD.bazel
# @libavif - //bazel/external/libavif:BUILD.bazel
# @libgav1 - //bazel/external/libgav1:BUILD.bazel
# @libjpeg_turbo - //bazel/external/libjpeg_turbo:BUILD.bazel
# @libjxl - //bazel/external/libjxl:BUILD.bazel
# @libpng - //bazel/external/libpng:BUILD.bazel
# @libwebp - //bazel/external/libwebp:BUILD.bazel
# @libyuv - //bazel/external/libyuv:BUILD.bazel
# @perfetto - //bazel/external/perfetto:BUILD.bazel
# @piex - //bazel/external/piex:BUILD.bazel
# @spirv_cross - //bazel/external/spirv_cross:BUILD.bazel
# @vulkan_headers - //bazel/external/vulkan_headers:BUILD.bazel
# @vulkan_tools - //bazel/external/vulkan_tools:BUILD.bazel
# @vulkanmemoryallocator - //bazel/external/vulkanmemoryallocator:BUILD.bazel
# @wuffs - //bazel/external/wuffs:BUILD.bazel
# @zlib_skia - //bazel/external/zlib_skia:BUILD.bazel
#### END GENERATED LIST OF THIRD_PARTY DEPS
git_repos_from_deps()
# In order to copy the Freetype configurations into the checked out Freetype folder,
# it is easiest to treat them as a third-party dependency from the perspective of Freetype.
# To do that, we put them in their own Bazel workspace and then have our injected BUILD.bazel
# for Freetype reference this workspace.
# https://bazel.build/reference/be/workspace#new_local_repository
local_repository(
name = "freetype_config",
path = "bazel/external/freetype/config",
)
local_repository(
name = "harfbuzz_config",
path = "bazel/external/harfbuzz/config",
)
local_repository(
name = "icu_utils",
path = "bazel/external/icu/utils",
)
load("//bazel:cipd_install.bzl", "cipd_install")
cipd_install(
name = "gn_linux_amd64",
build_file_content = """
exports_files(
["gn"],
visibility = ["//visibility:public"]
)
""",
cipd_package = "gn/gn/linux-amd64",
# From https://chrome-infra-packages.appspot.com/p/gn/gn/linux-amd64/+/git_revision:1c4151ff5c1d6fbf7fa800b8d4bb34d3abc03a41
sha256 = "7195291488d08f3a10e85b85d8c4816e077015f1c5f196f770003a97aa42caf8",
tag = "git_revision:1c4151ff5c1d6fbf7fa800b8d4bb34d3abc03a41",
)
cipd_install(
name = "gn_mac_arm64",
build_file_content = """
exports_files(
["gn"],
visibility = ["//visibility:public"]
)
""",
cipd_package = "gn/gn/mac-arm64",
# From https://chrome-infra-packages.appspot.com/p/gn/gn/mac-arm64/+/git_revision:1c4151ff5c1d6fbf7fa800b8d4bb34d3abc03a41
sha256 = "1123907ac3317530e9dd537d50cd83fd83e852aacc07d286f45753c8fc5287ed",
tag = "git_revision:1c4151ff5c1d6fbf7fa800b8d4bb34d3abc03a41",
)
cipd_install(
name = "gn_mac_amd64",
build_file_content = """
exports_files(
["gn"],
visibility = ["//visibility:public"]
)
""",
cipd_package = "gn/gn/mac-amd64",
# From https://chrome-infra-packages.appspot.com/p/gn/gn/mac-amd64/+/git_revision:1c4151ff5c1d6fbf7fa800b8d4bb34d3abc03a41
sha256 = "ed96f7d2f49b83b016e4bdbed432e4734a5a133accb025d7c07685e01489ba93",
tag = "git_revision:1c4151ff5c1d6fbf7fa800b8d4bb34d3abc03a41",
)