Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,10 @@ def docs(
name = "metrics_json",
srcs = [":needs_json"],
outs = ["metrics.json"],
cmd = "cp $(location :needs_json)/metrics.json $@",
# Copy metrics.json out of the directory produced by :needs_json.
# $(execpath ...) expands to that input directory's path for this build
# action, and $@ is the path of the metrics.json output created here.
cmd = "cp $(execpath :needs_json)/metrics.json $@",
visibility = ["//visibility:public"],
tags = ["manual"],
)
Expand All @@ -722,7 +725,10 @@ def docs(
name = "needs_json_file",
srcs = [":needs_json"],
outs = ["needs.json"],
cmd = "cp $(location :needs_json)/needs.json $@",
# Copy needs.json out of the directory produced by :needs_json.
# $(execpath ...) gives this build action the input directory's path;
# $@ is the path of the needs.json output created here.
cmd = "cp $(execpath :needs_json)/needs.json $@",
visibility = ["//visibility:public"],
tags = ["manual"],
)
Expand Down
5 changes: 4 additions & 1 deletion src/extensions/score_metamodel/docs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ genrule(
"generated/index.rst",
"generated/metamodel_classes.mmd",
],
cmd = "$(location :generate_metamodel_rst_bin) --rst-output $(location generated/index.rst) --mmd-output $(location generated/metamodel_classes.mmd) $(location //src/extensions/score_metamodel:metamodel_yaml)",
# Run the generator on the YAML input and tell it where to write the RST
# and Mermaid files. Bazel expands each $(execpath ...) to the named tool
# or file's path in this build action, so the command can find them.
cmd = "$(execpath :generate_metamodel_rst_bin) --rst-output $(execpath generated/index.rst) --mmd-output $(execpath generated/metamodel_classes.mmd) $(execpath //src/extensions/score_metamodel:metamodel_yaml)",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wonder if the last one should be also @score_docs_as_code or if this doesn't matter here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems to work 😆

tools = [":generate_metamodel_rst_bin"],
visibility = ["//visibility:private"],
)
Expand Down
7 changes: 5 additions & 2 deletions src/tests/docs_bzl/scenarios/data_files_runfiles/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,17 @@ genrule(
# The RST and Mermaid file are both declared sources, but only the RST
# should be registered as a Sphinx document. The Mermaid file is a
# companion asset that must remain readable next to the original RST.
cmd = """cat > $(location generated/index.rst) <<'EOF'
# The shell writes the text below, up to each EOF marker, into the
# generated RST and Mermaid files. $(execpath ...) expands to each declared
# output's path in this build action, so the files land where Bazel expects.
cmd = """cat > $(execpath generated/index.rst) <<'EOF'
Generated Data Page
===================

.. mermaid:: generated_data.mmd
:name: generated-data-diagram
EOF
cat > $(location generated/generated_data.mmd) <<'EOF'
cat > $(execpath generated/generated_data.mmd) <<'EOF'
classDiagram
class GeneratedData
EOF""",
Expand Down