Skip to content

Relevant arguments are lost by the bazel aquery ... portion of compile command generation #170

Open
@btalb

Description

@btalb

I've had a setup evolve so that it is now using a bazelrc in a custom location (i.e. bazel --bazelrc=/path/to/.bazelrc ... is now how all of my commands are run).

The bazel aquery ... portion of the compile command generation is a raw call that doesn't receive any of the arguments forwarded to it. Some simple examples:

  • build --action_env=BAZEL_CXXOPTS="-std=c++20" works when in a bazelrc in the default location, but not when in a custom location
  • --registry args also go missing

It leaves me in a situation where my project builds perfectly fine, but I can't generate commands because the logic is in a non-standard bazelrc location or passed via the bazel run ... command itself.

I've:

  • confirmed manually forcing those arguments in as a patch to refresh.template.py works, but that is to brittle to meet what I need
  • looked for something dirty like recovering the arguments from the process tree, but the process holding the args isn't still around when the Python script runs
  • tried messing around with the refresh_compile_commands function, but don't know enough about Bazel yet to know if it's even possible to access / forward these types of args

Any ideas?

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