Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert --toolchain_resolution_debug to take a regex of toolchain typ… #13207

Closed
wants to merge 4 commits into from

Conversation

katre
Copy link
Member

@katre katre commented Mar 11, 2021

…es to debug

Work towards #12110.
Fixes #7713.

RELNOTES: The flag --toolchain_resolution_debug now takes a regex argument, which is used to check which toolchain types should have debug info printed. You may use .* as an argument to keep the current behavior of debugging every toolchain type.

@katre katre requested a review from gregestren March 11, 2021 20:19
@google-cla google-cla bot added the cla: yes label Mar 11, 2021
* types.
*/
public boolean debugToolchainResolution(Collection<Label> toolchainTypes) {
if (toolchainTypes.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is empty, is there any actual information to debug? i..e what gets printed when this returns true and the input is empty?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even targets with no toolchains will have an execution platform selected (and this is used in some tests).

Ideally we could instead do --toolchain_resolution_debug=//some/configured:target, but that would require ConfiguredTargetFunction to make the check and pass a debug flag, thus complicating the ToolchainContextKey even more.

public boolean debugToolchainResolution(Collection<Label> toolchainTypes) {
if (toolchainTypes.isEmpty()) {
// Check an empty string, in case the filter is .*
return this.toolchainResolutionDebugRegexFilter.test("");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does plain old --toolchain_resolution_debug still work? (as an alias for .*)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the argument is required (and if it is skipped an error will be printed). I couldn't figure out a way to distinguish between no flag being passed, and a base --toolchain_resolution_debug with no argument in order to keep the current behavior unchanged.

@bazel-io bazel-io closed this in fbf9f9d Mar 12, 2021
@katre katre deleted the improve-toolchain-debugging branch March 12, 2021 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Minimize output of --toolchain_resolution_debug
2 participants