简体   繁体   English

我可以使用 `bazel cquery` 来确定正在激活哪些 `config_setting` 规则吗?

[英]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 .我有一个依赖库,它似乎选择了错误的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.为了进一步调试,我尝试使用cquery文档中的config函数,但它返回所有潜在的 config_settings。

Specifically, I tried running the following: bazel cquery "config(deps(@openssl//:crypto), target)" --noimplicit_deps --bazelrc=build-scripts/windows/windows.bazelrc具体来说,我尝试运行以下命令: 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 ?确定 Bazel 如何选择config_setting的最佳方法是什么? Is it cquery?是cquery吗?

I expected my above command to not return any build rules related to the mac, linux, and android config settings.我希望我的上述命令不会返回任何与 mac、linux 和 android 配置设置相关的构建规则。 Just the windows.只是窗户。

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.我发现满足我需求的最佳解决方案是在我感兴趣的目标上运行 cquery,然后检查配置的构建文件(cquery 中的output=build )以查看select语句选择了哪些值。

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.但这暂时完成了工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM