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
20 changes: 18 additions & 2 deletions bazel/rules/rules_score/private/dependable_element.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,12 @@ def _dependable_element_index_impl(ctx):
output_files.append(arch_json)
output_files.extend(validation_output_files)

unit_validation_output_files = []
for unit_target in all_units.values():
unit_validation_output_files.append(
_symlink_validation_log(ctx, unit_target[UnitInfo].validation_log),
)

# =========================================================================
# Safety Certification Validation: certified scope and integrity level checks
# =========================================================================
Expand Down Expand Up @@ -1396,7 +1402,7 @@ def _dependable_element_index_impl(ctx):
chain_forwarded_lobster = chain_forwarded_lobster_depset,
),
own_assumptions_of_use_info,
OutputGroupInfo(debug = depset(validation_output_files)),
OutputGroupInfo(debug = depset(validation_output_files + unit_validation_output_files)),
]

def _dependable_element_index_attrs():
Expand Down Expand Up @@ -1569,12 +1575,22 @@ def _dependable_element_impl(ctx):
if lobster_info.lobster_html_report:
lobster_default_files.append(lobster_info.lobster_html_report)

# Force this element's own units' design-vs-implementation validation to
# run whenever "<name>" itself is built/tested — kept out of the index's
# sphinx_module srcs (see _dependable_element_index_impl) so that
# downstream modules merely consuming "<name>_doc" via `deps` for HTML
# merging don't also re-trigger it under their own build configuration.
unit_validation_files = index_dep[OutputGroupInfo].debug.to_list()

return [
# DefaultInfo: lobster report file(s) + Sphinx HTML docs so that
# ``bazel build <name>`` produces exactly the final user-facing outputs.
DefaultInfo(
executable = test_executable,
files = depset(lobster_default_files, transitive = [sphinx_dep[DefaultInfo].files]),
files = depset(
lobster_default_files + unit_validation_files,
transitive = [sphinx_dep[DefaultInfo].files],
),
runfiles = runfiles,
),
# Sphinx docs providers: forwarded from sphinx_module so callers can use
Expand Down
1 change: 1 addition & 0 deletions bazel/rules/rules_score/private/unit.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def _unit_impl(ctx):
implementation = depset(ctx.attr.implementation),
tests = tests_depset,
dependent_labels = depset(transitive = collected_dependent_labels),
validation_log = validation_log,
),
SphinxSourcesInfo(
srcs = all_files,
Expand Down
1 change: 1 addition & 0 deletions bazel/rules/rules_score/providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ UnitInfo = provider(
"implementation": "Depset of implementation targets (cc_library, rust_library, etc.).",
"tests": "Depset of test targets (cc_test, rust_test, etc.).",
"dependent_labels": "Depset of Labels that this unit's implementation depends on transitively (used for certification scope validation).",
"validation_log": "Struct with file and name fields describing the UnitValidate (design-vs-implementation) log entry produced by this unit target.",
},
)

Expand Down
Loading