From 4bf88808e84876fa7296e1161c864d994a27c257 Mon Sep 17 00:00:00 2001 From: Alex Humesky Date: Tue, 13 Oct 2015 15:33:20 +0000 Subject: Makes the error message for invalid or duplicate crosstool toolchains more legible by putting each flag combination on its own line. E.g. from this: ERROR: No toolchain found for --cpu='foo' --compiler='bar' --glibc='baz'. Valid toolchains are: [ --cpu='armeabi-v7a' --compiler='compiler' --glibc='armeabi-v7a', --cpu='armeabi-v7a' --compiler='compiler' --glibc='armeabi-v7a', --cpu='local' --compiler='compiler' --glibc='local', --cpu='darwin' --compiler='compiler' --glibc='macosx', --cpu='freebsd' --compiler='compiler' --glibc='local', --cpu='k8' --compiler='windows_mingw' --glibc='local', --cpu='k8' --compiler='windows_msys64_mingw64' --glibc='local', --cpu='k8' --compiler='windows_clang' --glibc='local',]. to this: ERROR: No toolchain found for --cpu='foo' --compiler='bar' --glibc='baz'. Valid toolchains are: [ --cpu='armeabi-v7a' --compiler='compiler' --glibc='armeabi-v7a', --cpu='armeabi-v7a' --compiler='compiler' --glibc='armeabi-v7a', --cpu='local' --compiler='compiler' --glibc='local', --cpu='darwin' --compiler='compiler' --glibc='macosx', --cpu='freebsd' --compiler='compiler' --glibc='local', --cpu='k8' --compiler='windows_mingw' --glibc='local', --cpu='k8' --compiler='windows_msys64_mingw64' --glibc='local', --cpu='k8' --compiler='windows_clang' --glibc='local', ]. (notice there is a duplicate toolchain) -- MOS_MIGRATED_REVID=105313547 --- .../build/lib/rules/cpp/CrosstoolConfigurationLoader.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoader.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoader.java index febbdacc77..6a42fce772 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoader.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoader.java @@ -347,20 +347,18 @@ public class CrosstoolConfigurationLoader { + "corresponding to '" + selectedIdentifier + "' found for cpu '" + config.getCpu() + "'"); } - private static String describeToolchainFlags(CrosstoolConfig.CToolchain toolchain) { - return CrosstoolConfigurationIdentifier.fromToolchain(toolchain).describeFlags(); - } - /** * Appends a series of toolchain descriptions (as the blaze command line flags * that would specify that toolchain) to 'message'. */ private static void describeToolchainList(StringBuilder message, Collection toolchains) { - message.append("["); + message.append("[\n"); for (CrosstoolConfig.CToolchain toolchain : toolchains) { - message.append(describeToolchainFlags(toolchain)); - message.append(","); + message.append(" "); + message.append( + CrosstoolConfigurationIdentifier.fromToolchain(toolchain).describeFlags().trim()); + message.append(",\n"); } message.append("]"); } -- cgit v1.2.3