Skip to content

Commit

Permalink
Start surfacing docs in rustdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
blakehatch committed Apr 8, 2024
1 parent 6c4fb7e commit ed4366e
Show file tree
Hide file tree
Showing 6 changed files with 334 additions and 1 deletion.
12 changes: 12 additions & 0 deletions deployment-examples/kubernetes/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
filegroup(
name = "kubernetes",
srcs = [
"README.md",
"cas.json",
"cas.yaml",
"scheduler.json",
"scheduler.yaml",
"worker.json",
],
visibility = ["//visibility:public"],
)
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
src = pkgs.lib.cleanSourceWith {
src = craneLib.path ./.;
filter = path: type:
(builtins.match "^.+/data/SekienAkashita\\.jpg" path != null)
(builtins.match "^.+/(data/SekienAkashita\\.jpg|deployment-examples/kubernetes/(README\\.md|cas\\.json|cas\\.yaml|scheduler\\.json|scheduler\\.yaml|worker\\.json)|README\\.md|examples/README\\.md)" path != null)
|| (craneLib.filterCargoSources path type);
};

Expand Down
5 changes: 5 additions & 0 deletions nativelink-config/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ rust_library(
"src/serde_utils.rs",
"src/stores.rs",
],
compile_data = [
"README.md",
"examples/README.md",
"//deployment-examples/kubernetes",
],
visibility = ["//visibility:public"],
deps = [
"@crates//:serde",
Expand Down
3 changes: 3 additions & 0 deletions nativelink-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ edition = "2021"
[dependencies]
serde = { version = "1.0.197", features = ["derive"] }
shellexpand = "3.1.0"

[package.metadata.docs.rs]
readme = "./README.md"
69 changes: 69 additions & 0 deletions nativelink-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,75 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![doc = include_str!("../README.md")]
#![doc = "\n\n"] // Add some spacing between the two README files
#![doc = "
<details>
<summary>Example Configuration Breakdown</summary>
"]
#![doc = include_str!("../examples/README.md")]
#![doc = "</details>"]
#![doc = "
<details>
<summary>Example Kubernetes Configuraton Breakdown</summary>
"]
#![doc = "
<details>
<summary>CAS JSON Config</summary>
"]
#![doc = "\n"]
#![doc = "```json"]
#![doc = include_str!("../../deployment-examples/kubernetes/cas.json")]
#![doc = "```"]
#![doc = "\n"]
#![doc = "</details>"]
#![doc = "
<details>
<summary>Scheduler JSON Config</summary>
"]
#![doc = "\n"]
#![doc = "```json"]
#![doc = include_str!("../../deployment-examples/kubernetes/scheduler.json")]
#![doc = "```"]
#![doc = "\n"]
#![doc = "</details>"]
#![doc = "
<details>
<summary>Scheduler YAML</summary>
"]
#![doc = "\n"]
#![doc = "```yaml"]
#![doc = "# Test"]
#![doc = include_str!("../../deployment-examples/kubernetes/scheduler.yaml")]
#![doc = "```"]
#![doc = "\n"]
#![doc = "</details>"]
#![doc = "
<details>
<summary>Worker JSON</summary>
"]
#![doc = "\n"]
#![doc = "```yaml"]
#![doc = "# Test"]
#![doc = include_str!("../../deployment-examples/kubernetes/worker.json")]
#![doc = "```"]
#![doc = "\n"]
#![doc = "</details>"]
#![doc = "
<details>
<summary>CAS YAML</summary>
"]
#![doc = "\n"]
#![doc = "```yaml"]
#![doc = include_str!("../../deployment-examples/kubernetes/cas.yaml")]
#![doc = "```"]
#![doc = "\n"]
#![doc = "</details>"]
#![doc = include_str!("../../deployment-examples/kubernetes/README.md")]
#![doc = "</details>"]
#![doc = "\n\n"] // Add some spacing between the two README files
#![doc = "</details>"]

pub mod cas_server;
pub mod schedulers;
mod serde_utils;
Expand Down
Loading

0 comments on commit ed4366e

Please sign in to comment.