anki/repos.bzl
2022-01-15 14:22:21 +10:00

156 lines
4.6 KiB
Python

"""
Dependencies required to build Anki.
"""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
def register_repos():
"Register required dependency repos."
# bazel
##########
maybe(
http_archive,
name = "bazel_skylib",
sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
],
)
# rust
########
# native.local_repository(
# name = "rules_rust",
# path = "../rules_rust",
# )
maybe(
http_archive,
name = "rules_rust",
strip_prefix = "rules_rust-f9ff78318f83281993c9d66a4b0cf4d72c883633",
urls = [
"https://github.com/bazelbuild/rules_rust/archive/f9ff78318f83281993c9d66a4b0cf4d72c883633.zip",
],
sha256 = "43eef0733934c3a1ddfe159874fc3b259121e69df091af2a8a372f62e2f73e1f",
)
# maybe(
# http_archive,
# name = "rules_rust",
# strip_prefix = "rules_rust-anki-2021-12-20",
# urls = [
# "https://github.com/ankitects/rules_rust/archive/refs/tags/anki-2021-12-20.zip",
# ],
# sha256 = "c9300cb1d1eddc5b85d5ced35f4c332b08afc7a439d2b75e696d3282b80677af",
# )
# python
##########
# native.local_repository(
# name = "rules_python",
# path = "../rules_python",
# )
maybe(
http_archive,
name = "rules_python",
sha256 = "954aa89b491be4a083304a2cb838019c8b8c3720a7abb9c4cb81ac7a24230cea",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_python/releases/download/0.4.0/rules_python-0.4.0.tar.gz",
"https://github.com/bazelbuild/rules_python/releases/download/0.4.0/rules_python-0.4.0.tar.gz",
],
)
# javascript
##############
# maybe(
# http_archive,
# name = "build_bazel_rules_nodejs",
# urls = [
# "file:///c:/anki/release.tar.gz",
# "file:///Users/dae/Work/code/dtop/release.tar.gz",
# ],
# )
# when updating, remember to update pinned versions in package.json
maybe(
http_archive,
name = "build_bazel_rules_nodejs",
sha256 = "3635797a96c7bfcd0d265dacd722a07335e64d6ded9834af8d3f1b7ba5a25bba",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.3.0/rules_nodejs-4.3.0.tar.gz"],
)
# sass
############
# native.local_repository(
# name = "io_bazel_rules_sass",
# path = "../rules_sass",
# )
maybe(
http_archive,
name = "io_bazel_rules_sass",
strip_prefix = "rules_sass-d0cda2205a6e9706ded30f7dd7d30c82b1301fbe",
urls = [
"https://github.com/bazelbuild/rules_sass/archive/d0cda2205a6e9706ded30f7dd7d30c82b1301fbe.zip",
],
sha256 = "640ad20f878a6656968e35f35343359446db91a773224ddf52ae110f1e48bb20",
)
# translations
################
core_i18n_repo = "anki-core-i18n"
core_i18n_commit = "620997d3b9cd7ca52e344259bd2a97c2776e7e6e"
core_i18n_zip_csum = "bda170148fc2344f54b5c1047f4ab93b109cf56318b8ce35945f7558217adc30"
qtftl_i18n_repo = "anki-desktop-ftl"
qtftl_i18n_commit = "ced2d4e9079efef6728e8600112492f3f74abb2b"
qtftl_i18n_zip_csum = "90ded4ccb101ecceff0de6b4244d639624db1be7290a1a7e9d7e57fd1e1257f2"
i18n_build_content = """
filegroup(
name = "files",
srcs = glob(["**/*.ftl"]),
visibility = ["//visibility:public"],
)
exports_files(["l10n.toml"])
"""
maybe(
http_archive,
name = "rslib_ftl",
build_file_content = i18n_build_content,
strip_prefix = core_i18n_repo + "-" + core_i18n_commit,
urls = [
"https://github.com/ankitects/{}/archive/{}.zip".format(
core_i18n_repo,
core_i18n_commit,
),
],
sha256 = core_i18n_zip_csum,
)
maybe(
http_archive,
name = "extra_ftl",
build_file_content = i18n_build_content,
strip_prefix = qtftl_i18n_repo + "-" + qtftl_i18n_commit,
urls = [
"https://github.com/ankitects/{}/archive/{}.zip".format(
qtftl_i18n_repo,
qtftl_i18n_commit,
),
],
sha256 = qtftl_i18n_zip_csum,
)