diff --git a/README.md b/README.md index 1fd1faaaa..4fddda316 100644 --- a/README.md +++ b/README.md @@ -232,9 +232,6 @@ on the host machine. To do so, simply add the following to the WORKSPACE file in your project: ```python -# Note: The `cargo_raze` repository expects `rules_foreign_cc` and `rules_rust` to -# have already been specified in the WORKSPACE per the Usage section of the README. - load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index a95bd4e90..7cb073df7 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -1,24 +1,5 @@ workspace(name = "cargo_raze") -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "rules_rust", - sha256 = "accb5a89cbe63d55dcdae85938e56ff3aa56f21eb847ed826a28a83db8500ae6", - strip_prefix = "rules_rust-9aa49569b2b0dacecc51c05cee52708b7255bd98", - urls = [ - # Main branch as of 2021-02-19 - "https://github.com/bazelbuild/rules_rust/archive/9aa49569b2b0dacecc51c05cee52708b7255bd98.tar.gz", - ], -) - -load("@rules_rust//rust:repositories.bzl", "rust_repositories") - -rust_repositories( - edition = "2018", - version = "1.49.0", -) - load("//:repositories.bzl", "cargo_raze_repositories") cargo_raze_repositories() diff --git a/repositories.bzl b/repositories.bzl index 4d85b5007..082dd0aca 100644 --- a/repositories.bzl +++ b/repositories.bzl @@ -14,6 +14,15 @@ load("//third_party/zlib:zlib_repositories.bzl", "zlib_repositories") def cargo_raze_repositories(): """Creates repository definitions for all cargo-raze third party dependencies""" + maybe( + http_archive, + name = "rules_rust", + sha256 = "accb5a89cbe63d55dcdae85938e56ff3aa56f21eb847ed826a28a83db8500ae6", + strip_prefix = "rules_rust-9aa49569b2b0dacecc51c05cee52708b7255bd98", + # Main branch as of 2021-02-19 + url = "https://github.com/bazelbuild/rules_rust/archive/9aa49569b2b0dacecc51c05cee52708b7255bd98.tar.gz", + ) + maybe( http_archive, name = "rules_foreign_cc", diff --git a/transitive_deps.bzl b/transitive_deps.bzl index 60cf54092..db6d5a6c0 100644 --- a/transitive_deps.bzl +++ b/transitive_deps.bzl @@ -1,7 +1,9 @@ """A module defining the transitive dependencies of cargo-raze""" load("@rules_foreign_cc//:workspace_definitions.bzl", "rules_foreign_cc_dependencies") +load("@rules_rust//rust:repositories.bzl", "rust_repositories") def cargo_raze_transitive_deps(): """Loads all dependnecies from repositories required for cargo-raze""" rules_foreign_cc_dependencies() + rust_repositories()