Tinder / Tinder/bazel-diff

Manual toolchain propagation in `query` mode

Open
#419 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
524
Forks
90
Avg merge
17h 33m
Merged PRs (30d)
28

Description

Bazel-diff in query mode doesn't see toolchain changes, but this is a Bazel limitation so we can't do this automatically.

In our codebase, we have a compiler that feeds into a toolchain. In order to detect changes to this, we have this workaround that we apply in a post-processing step (among other things):

    # Hack: We need to use `bazel cquery` to detect toolchain changes
    # (see https://github.com/Tinder/bazel-diff/issues/101),
    # but if we used cquery we would have to run this on _every_ platform.
    # The only case this notably affects for us is that if Mojo changes,
    # all Mojo targets should change. So special case this.
    if grep --quiet //KGEN/tools/mojo "$output_file.raw"; then
        echo "- Mojo changed, manually adding Mojo targets"
        ./bazelw query 'rdeps(//..., kind("mojo_*", //...))' >> "$output_file.mojo_targets"
        cat "$output_file.mojo_targets" >> "$output_file.raw"
    fi

And then we have to re-do a lot of processing (like excluding manual targets, etc). It would be interesting if we could support this natively. Generally, this would be a way of adding edges that query can't find.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing query-mode result processing and the post-processing path represented by $output_file, including the bazelw query workaround for Mojo targets. Define how manually supplied edges should enter the query results and how existing exclusion and processing steps should handle them; done means toolchain-related changes can be represented natively without this workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.