Skip to content

Expose bundle-local Needs inventories as JSON file artifacts #898

Closed

Description

@AlexanderLanin

Problem

When external_needs names a public docs() or docs_bundle target, the macro resolves it to the private .__internal__.needs_local target. The Sphinx action declares that target as a directory artifact at _build/needs, while the runtime code finds the inventory by appending _build/needs/needs.json to the target's runfiles path.

This works, but the private target represents a whole Sphinx output directory even though external loading and duplicate-ID preflight consume only needs.json. The runtime also depends on the internal Sphinx output layout.

Desired outcome

Expose the bundle-local inventory through a private Bazel target whose artifact is the needs.json file, and have external_needs resolve public bundle labels to that file artifact. Keep the public external_needs API unchanged.

Update the runtime path resolution and duplicate-ID preflight to consume the file artifact directly. Preserve any directory output still needed by the Sphinx builder or existing targets such as :needs_json and :metrics_json; choose the smallest Bazel-native implementation that provides the direct file target.

Related work

#806 covers resolving inventory artifacts when documentation targets are renamed. This issue focuses on the bundle-local inventory artifact itself being a directory rather than a JSON file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions