repositories.bzl 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # Copyright Materialize, Inc. and contributors. 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 in the LICENSE file at the
  6. # root of this repository, or online at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. """
  16. Defines third party Rust dependencies (generally binaries) that cannot be
  17. included via crates_repository.
  18. """
  19. load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
  20. load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
  21. load("@rules_rust//crate_universe:defs.bzl", "crate", "crates_repository")
  22. def rust_repositories():
  23. """Download third-party Rust repositories and their dependencies."""
  24. CXX_VERSION = "1.0.153"
  25. CXXBRIDGE_CMD_INTEGRITY = "sha256-fLxBkzdnlV0EwqkBUYBgKbk99f2LaCuiKpZ0MzR0gKk="
  26. maybe(
  27. http_archive,
  28. name = "cxxbridge-cmd",
  29. build_file = Label("//misc/bazel/rust_deps:cxxbridge-cmd/include.BUILD.bazel"),
  30. integrity = CXXBRIDGE_CMD_INTEGRITY,
  31. strip_prefix = "cxxbridge-cmd-{0}".format(CXX_VERSION),
  32. type = "tar.gz",
  33. urls = ["https://crates.io/api/v1/crates/cxxbridge-cmd/{0}/download".format(CXX_VERSION)],
  34. )
  35. crates_repository(
  36. name = "cxxbridge",
  37. cargo_lockfile = "@cxxbridge-cmd//:Cargo.lock",
  38. lockfile = "//misc/bazel/rust_deps:cxxbridge-cmd/Cargo.cxxbridge-cmd.lock",
  39. manifests = ["@cxxbridge-cmd//:Cargo.toml"],
  40. # Restricting the number of platforms we support _greatly_ reduces the
  41. # amount of time it takes to "Splice Cargo Workspace".
  42. supported_platform_triples = [
  43. "aarch64-unknown-linux-gnu",
  44. "x86_64-unknown-linux-gnu",
  45. "aarch64-apple-darwin",
  46. "x86_64-apple-darwin",
  47. "wasm32-unknown-unknown",
  48. ],
  49. generator_sha256s = {
  50. "aarch64-apple-darwin": "c38c9c0efc11fcf9c32b9e0f4f4849df7c823f207c7f5ba5f6ab1e0e2167693d",
  51. "aarch64-unknown-linux-gnu": "5bdc9a10ec5f17f5140a81ce7cb0c0ce6e82d4d862d3ce3a301ea23f72f20630",
  52. "x86_64-unknown-linux-gnu": "abcd8212d64ea4c0f5e856af663c05ebeb2800a02c251f6eb62061f4e8ca1735",
  53. },
  54. generator_urls = {
  55. "aarch64-apple-darwin": "https://github.com/MaterializeInc/rules_rust/releases/download/mz-0.59.3/cargo-bazel-aarch64-apple-darwin",
  56. "aarch64-unknown-linux-gnu": "https://github.com/MaterializeInc/rules_rust/releases/download/mz-0.59.3/cargo-bazel-aarch64-unknown-linux-gnu",
  57. "x86_64-unknown-linux-gnu": "https://github.com/MaterializeInc/rules_rust/releases/download/mz-0.59.3/cargo-bazel-x86_64-unknown-linux-gnu",
  58. },
  59. isolated = False,
  60. # Only used if developing rules_rust.
  61. # generator = "@cargo_bazel_bootstrap//:cargo-bazel",
  62. )