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

Report features and version on build error #200

Merged
merged 1 commit into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/vcpkg/build.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/// <summary>
/// Settings from the triplet file which impact the build environment and post-build checks
Expand Down
13 changes: 10 additions & 3 deletions src/vcpkg/build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -1315,21 +1315,28 @@ 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"
" Vcpkg version: %s\n"
"\n"
"Additionally, attach any relevant sections from the log files above.",
vcpkg_update_cmd,
spec,
package,
Commands::Version::version());
}

Expand Down
2 changes: 1 addition & 1 deletion src/vcpkg/install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down