Brian Silverman | cc09f18 | 2022-03-09 15:40:20 -0800 | [diff] [blame^] | 1 | workspace(name = "examples") |
| 2 | |
| 3 | # Users of `rules_rust` will commonly be unable to load it |
| 4 | # using a `local_repository`. Instead, to setup the rules, |
| 5 | # please see https://bazelbuild.github.io/rules_rust/#setup |
| 6 | local_repository( |
| 7 | name = "rules_rust", |
| 8 | path = "..", |
| 9 | ) |
| 10 | |
| 11 | load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains") |
| 12 | |
| 13 | rules_rust_dependencies() |
| 14 | |
| 15 | rust_register_toolchains(include_rustc_srcs = True) |
| 16 | |
| 17 | load("@rules_rust//bindgen:repositories.bzl", "rust_bindgen_repositories") |
| 18 | |
| 19 | rust_bindgen_repositories() |
| 20 | |
| 21 | load("@rules_rust//proto:repositories.bzl", "rust_proto_repositories") |
| 22 | |
| 23 | rust_proto_repositories() |
| 24 | |
| 25 | load("@rules_rust//proto:transitive_repositories.bzl", "rust_proto_transitive_repositories") |
| 26 | |
| 27 | rust_proto_transitive_repositories() |
| 28 | |
| 29 | load("@rules_rust//wasm_bindgen:repositories.bzl", "rust_wasm_bindgen_repositories") |
| 30 | |
| 31 | rust_wasm_bindgen_repositories() |
| 32 | |
| 33 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") |
| 34 | |
| 35 | ############################################################################### |
| 36 | # Workspace examples |
| 37 | ############################################################################### |
| 38 | |
| 39 | # buildifier: disable=same-origin-load |
| 40 | load("@rules_rust//rust:repositories.bzl", "rust_repository_set") |
| 41 | |
| 42 | # `rust_repository_set` is the core repository rule for downloading and defining |
| 43 | # a rust_toolchain. Should there be a need for a customized toolchain, this macro can |
| 44 | # be used to define and register one. |
| 45 | rust_repository_set( |
| 46 | name = "fake_toolchain_for_test_of_sha256", |
| 47 | edition = "2018", |
| 48 | exec_triple = "x86_64-unknown-linux-gnu", |
| 49 | extra_target_triples = [], |
| 50 | rustfmt_version = "1.4.12", |
| 51 | sha256s = { |
| 52 | "rust-1.46.0-x86_64-unknown-linux-gnu": "e3b98bc3440fe92817881933f9564389eccb396f5f431f33d48b979fa2fbdcf5", |
| 53 | "rust-std-1.46.0-x86_64-unknown-linux-gnu": "ac04aef80423f612c0079829b504902de27a6997214eb58ab0765d02f7ec1dbc", |
| 54 | "rustfmt-1.4.12-x86_64-unknown-linux-gnu": "1894e76913303d66bf40885a601462844eec15fca9e76a6d13c390d7000d64b0", |
| 55 | }, |
| 56 | version = "1.46.0", |
| 57 | ) |
| 58 | |
| 59 | ############################################################################### |
| 60 | # Examples dependencies |
| 61 | ############################################################################### |
| 62 | |
| 63 | load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories") |
| 64 | |
| 65 | node_repositories() |
| 66 | |
| 67 | http_archive( |
| 68 | name = "rules_foreign_cc", |
| 69 | sha256 = "69023642d5781c68911beda769f91fcbc8ca48711db935a75da7f6536b65047f", |
| 70 | strip_prefix = "rules_foreign_cc-0.6.0", |
| 71 | url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.6.0.tar.gz", |
| 72 | ) |
| 73 | |
| 74 | load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies") |
| 75 | |
| 76 | rules_foreign_cc_dependencies() |
| 77 | |
| 78 | load("//sys:sys_deps.bzl", "sys_deps") |
| 79 | |
| 80 | sys_deps() |
| 81 | |
| 82 | local_repository( |
| 83 | name = "rules_rust_example_cargo_manifest_dir", |
| 84 | path = "cargo_manifest_dir/external_crate", |
| 85 | ) |
| 86 | |
| 87 | _LIBC_BUILD_FILE_CONTENT = """\ |
| 88 | load("@rules_rust//rust:defs.bzl", "rust_library") |
| 89 | |
| 90 | rust_library( |
| 91 | name = "libc", |
| 92 | srcs = glob(["src/**/*.rs"]), |
| 93 | edition = "2015", |
| 94 | visibility = ["//visibility:public"], |
| 95 | ) |
| 96 | """ |
| 97 | |
| 98 | http_archive( |
| 99 | name = "libc", |
| 100 | build_file_content = _LIBC_BUILD_FILE_CONTENT, |
| 101 | sha256 = "1ac4c2ac6ed5a8fb9020c166bc63316205f1dc78d4b964ad31f4f21eb73f0c6d", |
| 102 | strip_prefix = "libc-0.2.20", |
| 103 | urls = [ |
| 104 | "https://mirror.bazel.build/github.com/rust-lang/libc/archive/0.2.20.zip", |
| 105 | "https://github.com/rust-lang/libc/archive/0.2.20.zip", |
| 106 | ], |
| 107 | ) |
| 108 | |
| 109 | ############################################################################### |
| 110 | |
| 111 | http_archive( |
| 112 | name = "bazel_toolchains", |
| 113 | sha256 = "179ec02f809e86abf56356d8898c8bd74069f1bd7c56044050c2cd3d79d0e024", |
| 114 | strip_prefix = "bazel-toolchains-4.1.0", |
| 115 | urls = [ |
| 116 | "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/releases/download/4.1.0/bazel-toolchains-4.1.0.tar.gz", |
| 117 | "https://github.com/bazelbuild/bazel-toolchains/releases/download/4.1.0/bazel-toolchains-4.1.0.tar.gz", |
| 118 | ], |
| 119 | ) |
| 120 | |
| 121 | load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig") |
| 122 | |
| 123 | # Creates a default toolchain config for RBE. |
| 124 | # Use this as is if you are using the rbe_ubuntu16_04 container, |
| 125 | # otherwise refer to RBE docs. |
| 126 | rbe_autoconfig(name = "buildkite_config") |