From 79694da795a0330a16900ffc899e163713481b77 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Mon, 27 Sep 2021 09:29:33 +0200 Subject: [PATCH] Report features and version on build error --- include/vcpkg/build.h | 2 +- src/vcpkg/build.cpp | 13 ++++++++++--- src/vcpkg/install.cpp | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/vcpkg/build.h b/include/vcpkg/build.h index b91bee5940..d5a1d388f7 100644 --- a/include/vcpkg/build.h +++ b/include/vcpkg/build.h @@ -205,7 +205,7 @@ namespace vcpkg::Build const std::string& to_string(const BuildResult build_result); std::string create_error_message(const BuildResult build_result, const PackageSpec& spec); - std::string create_user_troubleshooting_message(const PackageSpec& spec); + std::string create_user_troubleshooting_message(const Dependencies::InstallPlanAction& action); /// /// Settings from the triplet file which impact the build environment and post-build checks diff --git a/src/vcpkg/build.cpp b/src/vcpkg/build.cpp index 510473a670..75f21afdd2 100644 --- a/src/vcpkg/build.cpp +++ b/src/vcpkg/build.cpp @@ -163,7 +163,7 @@ namespace vcpkg::Build if (result.code != BuildResult::SUCCEEDED) { print2(Color::error, Build::create_error_message(result.code, spec), '\n'); - print2(Build::create_user_troubleshooting_message(spec), '\n'); + print2(Build::create_user_troubleshooting_message(*action), '\n'); return 1; } @@ -1315,13 +1315,20 @@ namespace vcpkg::Build return Strings::format("Error: Building package %s failed with: %s", spec, Build::to_string(build_result)); } - std::string create_user_troubleshooting_message(const PackageSpec& spec) + std::string create_user_troubleshooting_message(const InstallPlanAction& action) { #if defined(_WIN32) auto vcpkg_update_cmd = ".\\vcpkg"; #else auto vcpkg_update_cmd = "./vcpkg"; #endif + + std::string package = action.displayname(); + if (auto scfl = action.source_control_file_location.get()) + { + Strings::append(package, " -> ", scfl->to_versiont()); + } + return Strings::format("Please ensure you're using the latest portfiles with `%s update`, then\n" "submit an issue at https://github.com/Microsoft/vcpkg/issues including:\n" " Package: %s\n" @@ -1329,7 +1336,7 @@ namespace vcpkg::Build "\n" "Additionally, attach any relevant sections from the log files above.", vcpkg_update_cmd, - spec, + package, Commands::Version::version()); } diff --git a/src/vcpkg/install.cpp b/src/vcpkg/install.cpp index b47141037d..1bd4ee9284 100644 --- a/src/vcpkg/install.cpp +++ b/src/vcpkg/install.cpp @@ -495,7 +495,7 @@ namespace vcpkg::Install perform_install_plan_action(args, paths, action, status_db, binary_cache, build_logs_recorder); if (result.code != BuildResult::SUCCEEDED && keep_going == KeepGoing::NO) { - print2(Build::create_user_troubleshooting_message(action.spec), '\n'); + print2(Build::create_user_troubleshooting_message(action), '\n'); Checks::exit_fail(VCPKG_LINE_INFO); }