-
Notifications
You must be signed in to change notification settings - Fork 434
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganized sub-workspace dependencies (#398)
This pull request contains various cleanup/quality-of-life improvements for the repository by clearly grouping and defining dependencies for the docs and examples workspaces. Ultimately, the files that are created in here can be moved entirely into their neighboring WORKSPACE files once bazelbuild/bazel#1943 has been closed.
- Loading branch information
1 parent
b798f14
commit 7d9e890
Showing
14 changed files
with
509 additions
and
342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Docs | ||
docs/bazel-bin | ||
docs/bazel-docs | ||
docs/bazel-out | ||
docs/bazel-testlogs | ||
|
||
# Examples | ||
examples/bazel-bin | ||
examples/bazel-examples | ||
examples/bazel-out | ||
examples/bazel-testlogs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,9 @@ | ||
workspace(name = "io_bazel_rules_rust_docs") | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
local_repository( | ||
name = "io_bazel_rules_rust", | ||
path = "..", | ||
) | ||
load(":docs_repositories.bzl", "repositories") | ||
|
||
http_archive( | ||
name = "bazel_skylib", | ||
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", | ||
], | ||
sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c", | ||
) | ||
repositories() | ||
|
||
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") | ||
bazel_skylib_workspace() | ||
load(":docs_deps.bzl", "deps") | ||
|
||
http_archive( | ||
name = "io_bazel_stardoc", | ||
urls = [ | ||
"https://github.com/bazelbuild/stardoc/archive/1ef781ced3b1443dca3ed05dec1989eca1a4e1cd.zip", | ||
], | ||
sha256 = "5d7191bb0800434a9192d8ac80cba4909e96dbb087c5d51f168fedd7bde7b525", | ||
strip_prefix = "stardoc-1ef781ced3b1443dca3ed05dec1989eca1a4e1cd", | ||
) | ||
|
||
load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories") | ||
load("@io_bazel_rules_rust//proto:repositories.bzl", "rust_proto_repositories") | ||
load("@io_bazel_rules_rust//:workspace.bzl", "bazel_version") | ||
load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories") | ||
|
||
rust_repositories() | ||
rust_proto_repositories() | ||
bazel_version(name = "bazel_version") | ||
stardoc_repositories() | ||
|
||
# Rules proto does not declare a bzl_library, we stub it there for now. | ||
# TODO: Remove this hack if/when rules_proto adds a bzl_library. | ||
local_repository( | ||
name = "rules_proto", | ||
path = "rules_proto_stub", | ||
) | ||
deps() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"""Define dependencies for `rules_rust` docs""" | ||
|
||
load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories") | ||
load("@io_bazel_rules_rust//proto:repositories.bzl", "rust_proto_repositories") | ||
load("@io_bazel_rules_rust//:workspace.bzl", "bazel_version") | ||
load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories") | ||
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") | ||
|
||
def deps(is_top_level = False): | ||
"""Define dependencies for `rules_rust` docs | ||
Args: | ||
is_top_level (bool, optional): Indicates wheather or not this is being called | ||
from the root WORKSPACE file of `rules_rust`. Defaults to False. | ||
""" | ||
rust_repositories() | ||
rust_proto_repositories() | ||
bazel_version(name = "bazel_version") | ||
stardoc_repositories() | ||
|
||
# Rules proto does not declare a bzl_library, we stub it there for now. | ||
# TODO: Remove this hack if/when rules_proto adds a bzl_library. | ||
if is_top_level: | ||
maybe( | ||
native.local_repository, | ||
name = "rules_proto", | ||
path = "docs/rules_proto_stub", | ||
) | ||
else: | ||
maybe( | ||
native.local_repository, | ||
name = "rules_proto", | ||
path = "rules_proto_stub", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
"""Define repository dependencies for `rules_rust` docs""" | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") | ||
|
||
def repositories(is_top_level = False): | ||
"""Define repository dependencies for `rules_rust` docs | ||
Args: | ||
is_top_level (bool, optional): Indicates wheather or not this is being called | ||
from the root WORKSPACE file of `rules_rust`. Defaults to False. | ||
""" | ||
maybe( | ||
native.local_repository, | ||
name = "io_bazel_rules_rust", | ||
path = "..", | ||
) | ||
|
||
maybe( | ||
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", | ||
], | ||
) | ||
|
||
maybe( | ||
http_archive, | ||
name = "io_bazel_stardoc", | ||
urls = [ | ||
"https://github.com/bazelbuild/stardoc/archive/1ef781ced3b1443dca3ed05dec1989eca1a4e1cd.zip", | ||
], | ||
sha256 = "5d7191bb0800434a9192d8ac80cba4909e96dbb087c5d51f168fedd7bde7b525", | ||
strip_prefix = "stardoc-1ef781ced3b1443dca3ed05dec1989eca1a4e1cd", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
#!/bin/bash | ||
|
||
pushd ${0%/*} | ||
bazel build //... && cp bazel-bin/*.md . && chmod 0644 *.md && git add *.md && git commit -m "Regenerate documentation" | ||
# It's important to clean the workspace so we don't end up with unintended | ||
# docs artifacts in the new commit. | ||
bazel clean \ | ||
&& bazel build //... \ | ||
&& cp bazel-bin/*.md . \ | ||
&& chmod 0644 *.md \ | ||
&& git add *.md \ | ||
&& git commit -m "Regenerate documentation" | ||
popd | ||
|
Oops, something went wrong.