Skip to content

Support for "runs-before" executable rule dependencies #24468

Open
@ouillie

Description

@ouillie

Description of the feature request:

Bazel executable and test rules should be able to express dependencies on other executable rules that should always run before the given exe/test rule. This could probably be implemented as an extension to DefaultInfo that allows specifying "runs-before" executable dependencies for executable and test rules. This should only be available to executable and test rules, not build rules.

Which category does this issue belong to?

Rules API

What underlying problem are you trying to solve with this feature?

Bazel hates side effects. Fair enough. But bazel also supports side effects with bazel run for executable rules. There are use-cases where the side effects of one executable rule are important for the execution of another executable rule. I have a motivating case where the system I'm testing insists on pulling an image from an OCI container registry. AFAIK bazel cannot realistically support container registry artifacts as build outputs, so I'm stuck with manually running the side-effectful oci_push to create the necessary conditions for the test to run. It's error-prone and makes Bazel IDE integrations much less usable.

Which operating system are you running Bazel on?

Linux / x86_64

What is the output of bazel info release?

release 7.3.1

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

I haven't meaningfully explored the implementation yet. Just gathering feedback for now.

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4This is either out of scope or we don't have bandwidth to review a PR. (No assignee)team-Rules-APIAPI for writing rules/aspects: providers, runfiles, actions, artifactstype: feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Support for "runs-before" executable rule dependencies · Issue #24468 · bazelbuild/bazel