Skip to content

Commit

Permalink
Improve unresolved toolchains error
Browse files Browse the repository at this point in the history
Add link to general platforms docs in response to feedback
  • Loading branch information
cpsauer committed May 4, 2022
1 parent 348c85d commit e80defa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,10 @@ private static String getMessage(List<Label> missingToolchainTypes) {
List<String> labelStrings =
missingToolchainTypes.stream().map(Label::toString).collect(Collectors.toList());
return String.format(
"No matching toolchains found for types %s. "
+ "To debug, rerun with --toolchain_resolution_debug='%s'",
"No matching toolchains found for types %s."
+ "\nTo debug, rerun with --toolchain_resolution_debug='%s'"
+ "\nIf platforms or toolchains are a new concept to you, we'd encourage reading "
+ "https://bazel.build/concepts/platforms-intro.",
String.join(", ", labelStrings), String.join("|", labelStrings));
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/test/shell/integration/toolchain_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ use_toolchain(
EOF

bazel build "//${pkg}/demo:use" &> $TEST_log && fail "Build failure expected"
expect_log "While resolving toolchains for target //${pkg}/demo:use: No matching toolchains found for types //${pkg}/toolchain:test_toolchain. To debug, rerun with --toolchain_resolution_debug='//${pkg}/toolchain:test_toolchain'"
expect_log "While resolving toolchains for target //${pkg}/demo:use: No matching toolchains found for types //${pkg}/toolchain:test_toolchain.\nTo debug, rerun with --toolchain_resolution_debug='//${pkg}/toolchain:test_toolchain\nIf platforms or toolchains are a new concept to you, we'd encourage reading https://bazel.build/concepts/platforms-intro.'"
}

function test_multiple_toolchain_use_in_rule {
Expand Down Expand Up @@ -526,7 +526,7 @@ use_toolchains(
EOF

bazel build "//${pkg}/demo:use" &> $TEST_log && fail "Build failure expected"
expect_log "While resolving toolchains for target //${pkg}/demo:use: No matching toolchains found for types //${pkg}/toolchain:test_toolchain_2. To debug, rerun with --toolchain_resolution_debug='//${pkg}/toolchain:test_toolchain_2'"
expect_log "While resolving toolchains for target //${pkg}/demo:use: No matching toolchains found for types //${pkg}/toolchain:test_toolchain_2.\nTo debug, rerun with --toolchain_resolution_debug='//${pkg}/toolchain:test_toolchain_2\nIf platforms or toolchains are a new concept to you, we'd encourage reading https://bazel.build/concepts/platforms-intro.'"
}

function test_toolchain_use_in_rule_non_required_toolchain {
Expand Down Expand Up @@ -781,7 +781,7 @@ EOF
--host_platform="//${pkg}:platform1" \
--platforms="//${pkg}:platform1" \
"//${pkg}/demo:use" &> $TEST_log && fail "Build failure expected"
expect_log "While resolving toolchains for target //${pkg}/demo:use: No matching toolchains found for types //${pkg}/toolchain:test_toolchain. To debug, rerun with --toolchain_resolution_debug='//${pkg}/toolchain:test_toolchain'"
expect_log "While resolving toolchains for target //${pkg}/demo:use: No matching toolchains found for types //${pkg}/toolchain:test_toolchain.\nTo debug, rerun with --toolchain_resolution_debug='//${pkg}/toolchain:test_toolchain\nIf platforms or toolchains are a new concept to you, we'd encourage reading https://bazel.build/concepts/platforms-intro.'"
expect_not_log 'Using toolchain: rule message:'
}

Expand Down

0 comments on commit e80defa

Please sign in to comment.