Removed duplicate dependencies of examples in the top level workspace (#407)
This PR adds `rust_workspace` which is meant to define transitive dependencies as well as cleans up some duplicate files that were in the root of the project but only used by examples.
## Updated documentation
Note the updated documentation in [docs/index.md](https://github.com/UebelAndre/rules_rust/blob/workspace-structure/docs/index.md)
## Added `bazel_skylib` to `rust_repositories`
It appears there are some uses of `bazel_skylib` within these rules but there aren't really any guarantees that that repository is available. This may be my fault with the changes made in #399 to [@io_bazel_rules_rust//rust/platform:platform.bzl](https://github.com/bazelbuild/rules_rust/blob/master/rust/platform/platform.bzl#L3) but I feel the `bazel_skylib` dependency should be conditionally added
## Added `rust_workspace`
I feel this is much nicer on the users's end as it gives them a single place to go to look at dependencies and is nicer on the repo because it means dependencies can more easily updated. I'm not the biggest fan of the name `rust_workspace` so if this was an acceptable concept, I'm happy to take suggestions on what the name should be called.
diff --git a/WORKSPACE b/WORKSPACE
index 3c23802..6c8045b 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -1,28 +1,5 @@
workspace(name = "io_bazel_rules_rust")
-load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
-load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
-
-http_archive(
- name = "bazel_skylib",
- sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
- urls = [
- "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
- "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
- ],
-)
-
-load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
-
-bazel_skylib_workspace()
-
-new_git_repository(
- name = "libc",
- build_file = "@io_bazel_rules_rust//:libc.BUILD",
- remote = "https://github.com/rust-lang/libc",
- tag = "0.2.20",
-)
-
load("@io_bazel_rules_rust//proto:repositories.bzl", "rust_proto_repositories")
rust_proto_repositories()
@@ -35,8 +12,14 @@
rust_wasm_bindgen_repositories()
+load("@io_bazel_rules_rust//:workspace.bzl", "rust_workspace")
+
+rust_workspace()
+
# --- end stardoc
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
http_archive(
name = "bazel_toolchains",
sha256 = "d8c2f20deb2f6143bac792d210db1a4872102d81529fe0ea3476c1696addd7ff",
@@ -55,10 +38,6 @@
name = "buildkite_config",
)
-load("@io_bazel_rules_rust//:workspace.bzl", "bazel_version")
-
-bazel_version(name = "bazel_version")
-
# Load all dependencies for examples
local_repository(