bazelboringssl

Can I use `bazel cquery` to determine which `config_setting` rules are being activated?


I have a dependent library that appears to be choosing the wrong config_setting.

In order to debug this further, I have tried using the config function from the cquery docs, but it returns all the potential config_settings.

Specifically, I tried running the following: bazel cquery "config(deps(@openssl//:crypto), target)" --noimplicit_deps --bazelrc=build-scripts/windows/windows.bazelrc

It returned:

@openssl//:crypto (aa65f203efeb0a68bcf0a0d51b3259145cb8e2c6bf209950206fe2bfb21381b5)
@local_config_cc//:cc-compiler-k8 (aa65f203efeb0a68bcf0a0d51b3259145cb8e2c6bf209950206fe2bfb21381b5)
@local_config_cc//:local (aa65f203efeb0a68bcf0a0d51b3259145cb8e2c6bf209950206fe2bfb21381b5)
@openssl//:windows_x86_64 (aa65f203efeb0a68bcf0a0d51b3259145cb8e2c6bf209950206fe2bfb21381b5)
@bazel_tools//tools/cpp:toolchain_type (aa65f203efeb0a68bcf0a0d51b3259145cb8e2c6bf209950206fe2bfb21381b5)
@openssl//:mac_x86_64 (aa65f203efeb0a68bcf0a0d51b3259145cb8e2c6bf209950206fe2bfb21381b5)
@openssl//:linux_ppc64le (aa65f203efeb0a68bcf0a0d51b3259145cb8e2c6bf209950206fe2bfb21381b5)
@openssl//:android (aa65f203efeb0a68bcf0a0d51b3259145cb8e2c6bf209950206fe2bfb21381b5)

What is the best way to determine how Bazel is selecting a config_setting? Is it cquery?

I expected my above command to not return any build rules related to the mac, linux, and android config settings. Just the windows.


Solution

  • I found that the best solution for my needs was to do run cquery on my target of interest and then examine the configured build files (output=build in the cquery) to see which values were getting chosen by the select statements.

    It would still be nice to have the option of seeing some sort of "config setting resolution" process in the logs. But this gets the job done for now.