Skip to content

Manual toolchain propagation in query mode #419

Description

@Ahajha

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions