mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-28 19:25:27 +08:00
color -> Color
This commit is contained in:
parent
898edccbdc
commit
e401799aca
@ -23,7 +23,7 @@ namespace vcpkg::System
|
||||
|
||||
std::wstring create_powershell_script_cmd(const fs::path& script_path, const CWStringView args = L"");
|
||||
|
||||
enum class color
|
||||
enum class Color
|
||||
{
|
||||
success = 10,
|
||||
error = 12,
|
||||
@ -32,8 +32,8 @@ namespace vcpkg::System
|
||||
|
||||
void print(const CStringView message);
|
||||
void println(const CStringView message);
|
||||
void print(const color c, const CStringView message);
|
||||
void println(const color c, const CStringView message);
|
||||
void print(const Color c, const CStringView message);
|
||||
void println(const Color c, const CStringView message);
|
||||
|
||||
template <class Arg1, class...Args>
|
||||
void print(const char* messageTemplate, const Arg1& messageArg1, const Args&... messageArgs)
|
||||
@ -42,7 +42,7 @@ namespace vcpkg::System
|
||||
}
|
||||
|
||||
template <class Arg1, class...Args>
|
||||
void print(const color c, const char* messageTemplate, const Arg1& messageArg1, const Args&... messageArgs)
|
||||
void print(const Color c, const char* messageTemplate, const Arg1& messageArg1, const Args&... messageArgs)
|
||||
{
|
||||
return print(c, Strings::format(messageTemplate, messageArg1, messageArgs...));
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace vcpkg::System
|
||||
}
|
||||
|
||||
template <class Arg1, class...Args>
|
||||
void println(const color c, const char* messageTemplate, const Arg1& messageArg1, const Args&... messageArgs)
|
||||
void println(const Color c, const char* messageTemplate, const Arg1& messageArg1, const Args&... messageArgs)
|
||||
{
|
||||
return println(c, Strings::format(messageTemplate, messageArg1, messageArgs...));
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ namespace vcpkg::PostBuildLint
|
||||
const fs::path include_dir = package_dir / "include";
|
||||
if (!fs::exists(include_dir) || fs::is_empty(include_dir))
|
||||
{
|
||||
System::println(System::color::warning, "The folder /include is empty. This indicates the library was not correctly installed.");
|
||||
System::println(System::Color::warning, "The folder /include is empty. This indicates the library was not correctly installed.");
|
||||
return lint_status::ERROR_DETECTED;
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ namespace vcpkg::PostBuildLint
|
||||
|
||||
if (!files_found.empty())
|
||||
{
|
||||
System::println(System::color::warning, "Include files should not be duplicated into the /debug/include directory. If this cannot be disabled in the project cmake, use\n"
|
||||
System::println(System::Color::warning, "Include files should not be duplicated into the /debug/include directory. If this cannot be disabled in the project cmake, use\n"
|
||||
" file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)"
|
||||
);
|
||||
return lint_status::ERROR_DETECTED;
|
||||
@ -108,7 +108,7 @@ namespace vcpkg::PostBuildLint
|
||||
|
||||
if (fs::exists(debug_share) && !fs::is_empty(debug_share))
|
||||
{
|
||||
System::println(System::color::warning, "/debug/share should not exist. Please reorganize any important files, then use\n"
|
||||
System::println(System::Color::warning, "/debug/share should not exist. Please reorganize any important files, then use\n"
|
||||
" file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)");
|
||||
return lint_status::ERROR_DETECTED;
|
||||
}
|
||||
@ -121,7 +121,7 @@ namespace vcpkg::PostBuildLint
|
||||
const fs::path lib_cmake = package_dir / "lib" / "cmake";
|
||||
if (fs::exists(lib_cmake))
|
||||
{
|
||||
System::println(System::color::warning, "The /lib/cmake folder should be moved to /share/%s/cmake.", spec.name());
|
||||
System::println(System::Color::warning, "The /lib/cmake folder should be moved to /share/%s/cmake.", spec.name());
|
||||
return lint_status::ERROR_DETECTED;
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ namespace vcpkg::PostBuildLint
|
||||
|
||||
if (!misplaced_cmake_files.empty())
|
||||
{
|
||||
System::println(System::color::warning, "The following cmake files were found outside /share/%s. Please place cmake files in /share/%s.", spec.name(), spec.name());
|
||||
System::println(System::Color::warning, "The following cmake files were found outside /share/%s. Please place cmake files in /share/%s.", spec.name(), spec.name());
|
||||
Files::print_paths(misplaced_cmake_files);
|
||||
return lint_status::ERROR_DETECTED;
|
||||
}
|
||||
@ -151,7 +151,7 @@ namespace vcpkg::PostBuildLint
|
||||
const fs::path lib_cmake_debug = package_dir / "debug" / "lib" / "cmake";
|
||||
if (fs::exists(lib_cmake_debug))
|
||||
{
|
||||
System::println(System::color::warning, "The /debug/lib/cmake folder should be moved to just /debug/cmake");
|
||||
System::println(System::Color::warning, "The /debug/lib/cmake folder should be moved to just /debug/cmake");
|
||||
return lint_status::ERROR_DETECTED;
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ namespace vcpkg::PostBuildLint
|
||||
|
||||
if (!dlls.empty())
|
||||
{
|
||||
System::println(System::color::warning, "\nThe following dlls were found in /lib and /debug/lib. Please move them to /bin or /debug/bin, respectively.");
|
||||
System::println(System::Color::warning, "\nThe following dlls were found in /lib and /debug/lib. Please move them to /bin or /debug/bin, respectively.");
|
||||
Files::print_paths(dlls);
|
||||
return lint_status::ERROR_DETECTED;
|
||||
}
|
||||
@ -201,7 +201,7 @@ namespace vcpkg::PostBuildLint
|
||||
}
|
||||
}
|
||||
|
||||
System::println(System::color::warning, "The software license must be available at ${CURRENT_PACKAGES_DIR}/share/%s/copyright .", spec.name());
|
||||
System::println(System::Color::warning, "The software license must be available at ${CURRENT_PACKAGES_DIR}/share/%s/copyright .", spec.name());
|
||||
if (potential_copyright_files.size() == 1) // if there is only one candidate, provide the cmake lines needed to place it in the proper location
|
||||
{
|
||||
const fs::path found_file = potential_copyright_files[0];
|
||||
@ -214,7 +214,7 @@ namespace vcpkg::PostBuildLint
|
||||
|
||||
if (potential_copyright_files.size() > 1)
|
||||
{
|
||||
System::println(System::color::warning, "The following files are potential copyright files:");
|
||||
System::println(System::Color::warning, "The following files are potential copyright files:");
|
||||
Files::print_paths(potential_copyright_files);
|
||||
}
|
||||
|
||||
@ -230,7 +230,7 @@ namespace vcpkg::PostBuildLint
|
||||
|
||||
if (!exes.empty())
|
||||
{
|
||||
System::println(System::color::warning, "The following EXEs were found in /bin and /debug/bin. EXEs are not valid distribution targets.");
|
||||
System::println(System::Color::warning, "The following EXEs were found in /bin and /debug/bin. EXEs are not valid distribution targets.");
|
||||
Files::print_paths(exes);
|
||||
return lint_status::ERROR_DETECTED;
|
||||
}
|
||||
@ -255,9 +255,9 @@ namespace vcpkg::PostBuildLint
|
||||
|
||||
if (!dlls_with_no_exports.empty())
|
||||
{
|
||||
System::println(System::color::warning, "The following DLLs have no exports:");
|
||||
System::println(System::Color::warning, "The following DLLs have no exports:");
|
||||
Files::print_paths(dlls_with_no_exports);
|
||||
System::println(System::color::warning, "DLLs without any exports are likely a bug in the build script.");
|
||||
System::println(System::Color::warning, "DLLs without any exports are likely a bug in the build script.");
|
||||
return lint_status::ERROR_DETECTED;
|
||||
}
|
||||
|
||||
@ -286,9 +286,9 @@ namespace vcpkg::PostBuildLint
|
||||
|
||||
if (!dlls_with_improper_uwp_bit.empty())
|
||||
{
|
||||
System::println(System::color::warning, "The following DLLs do not have the App Container bit set:");
|
||||
System::println(System::Color::warning, "The following DLLs do not have the App Container bit set:");
|
||||
Files::print_paths(dlls_with_improper_uwp_bit);
|
||||
System::println(System::color::warning, "This bit is required for Windows Store apps.");
|
||||
System::println(System::Color::warning, "This bit is required for Windows Store apps.");
|
||||
return lint_status::ERROR_DETECTED;
|
||||
}
|
||||
|
||||
@ -320,7 +320,7 @@ namespace vcpkg::PostBuildLint
|
||||
|
||||
static void print_invalid_architecture_files(const std::string& expected_architecture, std::vector<file_and_arch> binaries_with_invalid_architecture)
|
||||
{
|
||||
System::println(System::color::warning, "The following files were built for an incorrect architecture:");
|
||||
System::println(System::Color::warning, "The following files were built for an incorrect architecture:");
|
||||
System::println("");
|
||||
for (const file_and_arch& b : binaries_with_invalid_architecture)
|
||||
{
|
||||
@ -388,7 +388,7 @@ namespace vcpkg::PostBuildLint
|
||||
return lint_status::SUCCESS;
|
||||
}
|
||||
|
||||
System::println(System::color::warning, "DLLs should not be present in a static build, but the following DLLs were found:");
|
||||
System::println(System::Color::warning, "DLLs should not be present in a static build, but the following DLLs were found:");
|
||||
Files::print_paths(dlls);
|
||||
return lint_status::ERROR_DETECTED;
|
||||
}
|
||||
@ -402,7 +402,7 @@ namespace vcpkg::PostBuildLint
|
||||
return lint_status::SUCCESS;
|
||||
}
|
||||
|
||||
System::println(System::color::warning, "Mismatching number of debug and release binaries. Found %d for debug but %d for release.", debug_count, release_count);
|
||||
System::println(System::Color::warning, "Mismatching number of debug and release binaries. Found %d for debug but %d for release.", debug_count, release_count);
|
||||
System::println("Debug binaries");
|
||||
Files::print_paths(debug_binaries);
|
||||
|
||||
@ -411,11 +411,11 @@ namespace vcpkg::PostBuildLint
|
||||
|
||||
if (debug_count == 0)
|
||||
{
|
||||
System::println(System::color::warning, "Debug binaries were not found");
|
||||
System::println(System::Color::warning, "Debug binaries were not found");
|
||||
}
|
||||
if (release_count == 0)
|
||||
{
|
||||
System::println(System::color::warning, "Release binaries were not found");
|
||||
System::println(System::Color::warning, "Release binaries were not found");
|
||||
}
|
||||
|
||||
System::println("");
|
||||
@ -433,8 +433,8 @@ namespace vcpkg::PostBuildLint
|
||||
|
||||
if (lib_count == 0 && dll_count != 0)
|
||||
{
|
||||
System::println(System::color::warning, "Import libs were not present in %s", lib_dir.generic_string());
|
||||
System::println(System::color::warning,
|
||||
System::println(System::Color::warning, "Import libs were not present in %s", lib_dir.generic_string());
|
||||
System::println(System::Color::warning,
|
||||
"If this is intended, add the following line in the portfile:\n"
|
||||
" SET(%s enabled)", BuildPolicies::DLLS_WITHOUT_LIBS.cmake_variable());
|
||||
return lint_status::ERROR_DETECTED;
|
||||
@ -455,15 +455,15 @@ namespace vcpkg::PostBuildLint
|
||||
|
||||
if (fs::exists(bin))
|
||||
{
|
||||
System::println(System::color::warning, R"(There should be no bin\ directory in a static build, but %s is present.)", bin.generic_string());
|
||||
System::println(System::Color::warning, R"(There should be no bin\ directory in a static build, but %s is present.)", bin.generic_string());
|
||||
}
|
||||
|
||||
if (fs::exists(debug_bin))
|
||||
{
|
||||
System::println(System::color::warning, R"(There should be no debug\bin\ directory in a static build, but %s is present.)", debug_bin.generic_string());
|
||||
System::println(System::Color::warning, R"(There should be no debug\bin\ directory in a static build, but %s is present.)", debug_bin.generic_string());
|
||||
}
|
||||
|
||||
System::println(System::color::warning, R"(If the creation of bin\ and/or debug\bin\ cannot be disabled, use this in the portfile to remove them)" "\n"
|
||||
System::println(System::Color::warning, R"(If the creation of bin\ and/or debug\bin\ cannot be disabled, use this in the portfile to remove them)" "\n"
|
||||
"\n"
|
||||
R"###( if(VCPKG_LIBRARY_LINKAGE STREQUAL static))###""\n"
|
||||
R"###( file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin))###""\n"
|
||||
@ -483,10 +483,10 @@ namespace vcpkg::PostBuildLint
|
||||
|
||||
if (!empty_directories.empty())
|
||||
{
|
||||
System::println(System::color::warning, "There should be no empty directories in %s", dir.generic_string());
|
||||
System::println(System::Color::warning, "There should be no empty directories in %s", dir.generic_string());
|
||||
System::println("The following empty directories were found: ");
|
||||
Files::print_paths(empty_directories);
|
||||
System::println(System::color::warning, "If a directory should be populated but is not, this might indicate an error in the portfile.\n"
|
||||
System::println(System::Color::warning, "If a directory should be populated but is not, this might indicate an error in the portfile.\n"
|
||||
"If the directories are not needed and their creation cannot be disabled, use something like this in the portfile to remove them:\n"
|
||||
"\n"
|
||||
R"###( file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/a/dir ${CURRENT_PACKAGES_DIR}/some/other/dir))###""\n"
|
||||
@ -528,7 +528,7 @@ namespace vcpkg::PostBuildLint
|
||||
|
||||
if (!libs_with_invalid_crt.empty())
|
||||
{
|
||||
System::println(System::color::warning, "Expected %s crt linkage, but the following libs had invalid crt linkage:", expected_build_type.toString());
|
||||
System::println(System::Color::warning, "Expected %s crt linkage, but the following libs had invalid crt linkage:", expected_build_type.toString());
|
||||
System::println("");
|
||||
for (const BuildType_and_file btf : libs_with_invalid_crt)
|
||||
{
|
||||
@ -536,7 +536,7 @@ namespace vcpkg::PostBuildLint
|
||||
}
|
||||
System::println("");
|
||||
|
||||
System::println(System::color::warning, "To inspect the lib files, use:\n dumpbin.exe /directives mylibfile.lib");
|
||||
System::println(System::Color::warning, "To inspect the lib files, use:\n dumpbin.exe /directives mylibfile.lib");
|
||||
return lint_status::ERROR_DETECTED;
|
||||
}
|
||||
|
||||
@ -575,7 +575,7 @@ namespace vcpkg::PostBuildLint
|
||||
|
||||
if (!dlls_with_outdated_crt.empty())
|
||||
{
|
||||
System::println(System::color::warning, "Detected outdated dynamic CRT in the following files:");
|
||||
System::println(System::Color::warning, "Detected outdated dynamic CRT in the following files:");
|
||||
System::println("");
|
||||
for (const OutdatedDynamicCrt_and_file btf : dlls_with_outdated_crt)
|
||||
{
|
||||
@ -583,7 +583,7 @@ namespace vcpkg::PostBuildLint
|
||||
}
|
||||
System::println("");
|
||||
|
||||
System::println(System::color::warning, "To inspect the dll files, use:\n dumpbin.exe /dependents mydllfile.dll");
|
||||
System::println(System::Color::warning, "To inspect the dll files, use:\n dumpbin.exe /dependents mydllfile.dll");
|
||||
return lint_status::ERROR_DETECTED;
|
||||
}
|
||||
|
||||
@ -605,9 +605,9 @@ namespace vcpkg::PostBuildLint
|
||||
|
||||
if (!misplaced_files.empty())
|
||||
{
|
||||
System::println(System::color::warning, "The following files are placed in\n%s and\n%s: ", package_dir.generic_string(), debug_dir.generic_string());
|
||||
System::println(System::Color::warning, "The following files are placed in\n%s and\n%s: ", package_dir.generic_string(), debug_dir.generic_string());
|
||||
Files::print_paths(misplaced_files);
|
||||
System::println(System::color::warning, "Files cannot be present in those directories.\n");
|
||||
System::println(System::Color::warning, "Files cannot be present in those directories.\n");
|
||||
return lint_status::ERROR_DETECTED;
|
||||
}
|
||||
|
||||
@ -717,7 +717,7 @@ namespace vcpkg::PostBuildLint
|
||||
if (error_count != 0)
|
||||
{
|
||||
const fs::path portfile = paths.ports / spec.name() / "portfile.cmake";
|
||||
System::println(System::color::error, "Found %u error(s). Please correct the portfile:\n %s", error_count, portfile.string());
|
||||
System::println(System::Color::error, "Found %u error(s). Please correct the portfile:\n %s", error_count, portfile.string());
|
||||
}
|
||||
|
||||
System::println("-- Performing post-build validation done");
|
||||
|
@ -57,7 +57,7 @@ namespace vcpkg
|
||||
const std::string remaining_fields_as_string = Strings::join("\n ", remaining_fields);
|
||||
const std::string valid_fields_as_string = Strings::join("\n ", valid_fields);
|
||||
|
||||
System::println(System::color::error, "Error: There are invalid fields in the Source Paragraph of %s", this->name);
|
||||
System::println(System::Color::error, "Error: There are invalid fields in the Source Paragraph of %s", this->name);
|
||||
System::println("The following fields were not expected:\n\n %s\n\n", remaining_fields_as_string);
|
||||
System::println("This is the list of valid fields (case-sensitive): \n\n %s\n", valid_fields_as_string);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
|
@ -14,7 +14,7 @@ namespace vcpkg
|
||||
{
|
||||
if (arg_begin == arg_end)
|
||||
{
|
||||
System::println(System::color::error, "Error: expected value after %s", option_name);
|
||||
System::println(System::Color::error, "Error: expected value after %s", option_name);
|
||||
Metrics::track_property("error", "error option name");
|
||||
Commands::Help::print_usage();
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
@ -22,7 +22,7 @@ namespace vcpkg
|
||||
|
||||
if (option_field != nullptr)
|
||||
{
|
||||
System::println(System::color::error, "Error: %s specified multiple times", option_name);
|
||||
System::println(System::Color::error, "Error: %s specified multiple times", option_name);
|
||||
Metrics::track_property("error", "error option specified multiple times");
|
||||
Commands::Help::print_usage();
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
@ -38,7 +38,7 @@ namespace vcpkg
|
||||
{
|
||||
if (option_field != OptBoolT::UNSPECIFIED && option_field != new_setting)
|
||||
{
|
||||
System::println(System::color::error, "Error: conflicting values specified for --%s", option_name);
|
||||
System::println(System::Color::error, "Error: conflicting values specified for --%s", option_name);
|
||||
Metrics::track_property("error", "error conflicting switches");
|
||||
Commands::Help::print_usage();
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
@ -150,7 +150,7 @@ namespace vcpkg
|
||||
|
||||
if (!options_copy.empty())
|
||||
{
|
||||
System::println(System::color::error, "Unknown option(s) for command '%s':", this->command);
|
||||
System::println(System::Color::error, "Unknown option(s) for command '%s':", this->command);
|
||||
for (const std::string& option : options_copy)
|
||||
{
|
||||
System::println(option);
|
||||
@ -181,7 +181,7 @@ namespace vcpkg
|
||||
const size_t actual_arg_count = command_arguments.size();
|
||||
if (actual_arg_count > expected_arg_count)
|
||||
{
|
||||
System::println(System::color::error, "Error: `%s` requires at most %u arguments, but %u were provided", this->command, expected_arg_count, actual_arg_count);
|
||||
System::println(System::Color::error, "Error: `%s` requires at most %u arguments, but %u were provided", this->command, expected_arg_count, actual_arg_count);
|
||||
System::print(example_text);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
@ -192,7 +192,7 @@ namespace vcpkg
|
||||
const size_t actual_arg_count = command_arguments.size();
|
||||
if (actual_arg_count < expected_arg_count)
|
||||
{
|
||||
System::println(System::color::error, "Error: `%s` requires at least %u arguments, but %u were provided", this->command, expected_arg_count, actual_arg_count);
|
||||
System::println(System::Color::error, "Error: `%s` requires at least %u arguments, but %u were provided", this->command, expected_arg_count, actual_arg_count);
|
||||
System::print(example_text);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
@ -203,7 +203,7 @@ namespace vcpkg
|
||||
const size_t actual_arg_count = command_arguments.size();
|
||||
if (actual_arg_count != expected_arg_count)
|
||||
{
|
||||
System::println(System::color::error, "Error: `%s` requires %u arguments, but %u were provided", this->command, expected_arg_count, actual_arg_count);
|
||||
System::println(System::Color::error, "Error: `%s` requires %u arguments, but %u were provided", this->command, expected_arg_count, actual_arg_count);
|
||||
System::print(example_text);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ namespace vcpkg
|
||||
System::ExitCodeAndOutput rc = System::cmd_execute_and_capture_output(install_cmd);
|
||||
if (rc.exit_code)
|
||||
{
|
||||
System::println(System::color::error, "Launching powershell failed or was denied");
|
||||
System::println(System::Color::error, "Launching powershell failed or was denied");
|
||||
Metrics::track_property("error", "powershell install failed");
|
||||
Metrics::track_property("installcmd", install_cmd);
|
||||
Checks::exit_with_code(VCPKG_LINE_INFO, rc.exit_code);
|
||||
@ -322,7 +322,7 @@ namespace vcpkg
|
||||
}
|
||||
}
|
||||
|
||||
System::println(System::color::error, "Could not locate a complete toolset.");
|
||||
System::println(System::Color::error, "Could not locate a complete toolset.");
|
||||
System::println("The following paths were examined:");
|
||||
for (const fs::path& path : paths_examined)
|
||||
{
|
||||
|
@ -153,7 +153,7 @@ namespace vcpkg::Commands::Build
|
||||
unmet_dependencies.end());
|
||||
|
||||
Checks::check_exit(VCPKG_LINE_INFO, !unmet_dependencies.empty());
|
||||
System::println(System::color::error, "The build command requires all dependencies to be already installed.");
|
||||
System::println(System::Color::error, "The build command requires all dependencies to be already installed.");
|
||||
System::println("The following dependencies are missing:");
|
||||
System::println("");
|
||||
for (const PackageSpecWithInstallPlan& p : unmet_dependencies)
|
||||
@ -166,7 +166,7 @@ namespace vcpkg::Commands::Build
|
||||
|
||||
if (result != BuildResult::SUCCEEDED)
|
||||
{
|
||||
System::println(System::color::error, Build::create_error_message(result, spec));
|
||||
System::println(System::Color::error, Build::create_error_message(result, spec));
|
||||
System::println(Build::create_user_troubleshooting_message(spec));
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ namespace vcpkg::Commands::CI
|
||||
if (action.plan.plan_type == InstallPlanType::ALREADY_INSTALLED)
|
||||
{
|
||||
results.back() = BuildResult::SUCCEEDED;
|
||||
System::println(System::color::success, "Package %s is already installed", action.spec);
|
||||
System::println(System::Color::success, "Package %s is already installed", action.spec);
|
||||
}
|
||||
else if (action.plan.plan_type == InstallPlanType::BUILD_AND_INSTALL)
|
||||
{
|
||||
@ -71,25 +71,25 @@ namespace vcpkg::Commands::CI
|
||||
results.back() = result;
|
||||
if (result != BuildResult::SUCCEEDED)
|
||||
{
|
||||
System::println(System::color::error, Build::create_error_message(result, action.spec));
|
||||
System::println(System::Color::error, Build::create_error_message(result, action.spec));
|
||||
continue;
|
||||
}
|
||||
const BinaryParagraph bpgh = Paragraphs::try_load_cached_package(paths, action.spec).value_or_exit(VCPKG_LINE_INFO);
|
||||
Install::install_package(paths, bpgh, &status_db);
|
||||
System::println(System::color::success, "Package %s is installed", action.spec);
|
||||
System::println(System::Color::success, "Package %s is installed", action.spec);
|
||||
}
|
||||
else if (action.plan.plan_type == InstallPlanType::INSTALL)
|
||||
{
|
||||
results.back() = BuildResult::SUCCEEDED;
|
||||
Install::install_package(paths, action.plan.binary_pgh.value_or_exit(VCPKG_LINE_INFO), &status_db);
|
||||
System::println(System::color::success, "Package %s is installed from cache", action.spec);
|
||||
System::println(System::Color::success, "Package %s is installed from cache", action.spec);
|
||||
}
|
||||
else
|
||||
Checks::unreachable(VCPKG_LINE_INFO);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
System::println(System::color::error, "Error: Could not install package %s: %s", action.spec, e.what());
|
||||
System::println(System::Color::error, "Error: Could not install package %s: %s", action.spec, e.what());
|
||||
results.back() = BuildResult::NULLVALUE;
|
||||
}
|
||||
System::println("Elapsed time for package %s: %s", action.spec, build_timer.to_string());
|
||||
|
@ -81,7 +81,7 @@ namespace vcpkg::Commands::Help
|
||||
}
|
||||
else
|
||||
{
|
||||
System::println(System::color::error, "Error: unknown topic %s", topic);
|
||||
System::println(System::Color::error, "Error: unknown topic %s", topic);
|
||||
print_usage();
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace vcpkg::Commands::Install
|
||||
auto status = it->status(ec);
|
||||
if (ec)
|
||||
{
|
||||
System::println(System::color::error, "failed: %s: %s", it->path().u8string(), ec.message());
|
||||
System::println(System::Color::error, "failed: %s: %s", it->path().u8string(), ec.message());
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ namespace vcpkg::Commands::Install
|
||||
fs::create_directory(target, ec);
|
||||
if (ec)
|
||||
{
|
||||
System::println(System::color::error, "failed: %s: %s", target.u8string(), ec.message());
|
||||
System::println(System::Color::error, "failed: %s: %s", target.u8string(), ec.message());
|
||||
}
|
||||
|
||||
// Trailing backslash for directories
|
||||
@ -63,12 +63,12 @@ namespace vcpkg::Commands::Install
|
||||
{
|
||||
if (fs::exists(target))
|
||||
{
|
||||
System::println(System::color::warning, "File %s was already present and will be overwritten", target.u8string(), ec.message());
|
||||
System::println(System::Color::warning, "File %s was already present and will be overwritten", target.u8string(), ec.message());
|
||||
}
|
||||
fs::copy_file(*it, target, fs::copy_options::overwrite_existing, ec);
|
||||
if (ec)
|
||||
{
|
||||
System::println(System::color::error, "failed: %s: %s", target.u8string(), ec.message());
|
||||
System::println(System::Color::error, "failed: %s: %s", target.u8string(), ec.message());
|
||||
}
|
||||
output.push_back(Strings::format(R"(%s/%s)", target_triplet_as_string, suffix));
|
||||
continue;
|
||||
@ -76,11 +76,11 @@ namespace vcpkg::Commands::Install
|
||||
|
||||
if (!fs::status_known(status))
|
||||
{
|
||||
System::println(System::color::error, "failed: %s: unknown status", it->path().u8string());
|
||||
System::println(System::Color::error, "failed: %s: unknown status", it->path().u8string());
|
||||
continue;
|
||||
}
|
||||
|
||||
System::println(System::color::error, "failed: %s: cannot handle file type", it->path().u8string());
|
||||
System::println(System::Color::error, "failed: %s: cannot handle file type", it->path().u8string());
|
||||
}
|
||||
|
||||
std::sort(output.begin(), output.end());
|
||||
@ -153,7 +153,7 @@ namespace vcpkg::Commands::Install
|
||||
if (!intersection.empty())
|
||||
{
|
||||
const fs::path triplet_install_path = paths.installed / triplet.canonical_name();
|
||||
System::println(System::color::error, "The following files are already installed in %s and are in conflict with %s",
|
||||
System::println(System::Color::error, "The following files are already installed in %s and are in conflict with %s",
|
||||
triplet_install_path.generic_string(),
|
||||
binary_paragraph.spec);
|
||||
System::print("\n ");
|
||||
@ -221,7 +221,7 @@ namespace vcpkg::Commands::Install
|
||||
{
|
||||
if (std::find(specs.begin(), specs.end(), action.spec) != specs.end())
|
||||
{
|
||||
System::println(System::color::success, "Package %s is already installed", action.spec);
|
||||
System::println(System::Color::success, "Package %s is already installed", action.spec);
|
||||
}
|
||||
}
|
||||
else if (action.plan.plan_type == InstallPlanType::BUILD_AND_INSTALL)
|
||||
@ -233,25 +233,25 @@ namespace vcpkg::Commands::Install
|
||||
status_db);
|
||||
if (result != Build::BuildResult::SUCCEEDED)
|
||||
{
|
||||
System::println(System::color::error, Build::create_error_message(result, action.spec));
|
||||
System::println(System::Color::error, Build::create_error_message(result, action.spec));
|
||||
System::println(Build::create_user_troubleshooting_message(action.spec));
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
const BinaryParagraph bpgh = Paragraphs::try_load_cached_package(paths, action.spec).value_or_exit(VCPKG_LINE_INFO);
|
||||
install_package(paths, bpgh, &status_db);
|
||||
System::println(System::color::success, "Package %s is installed", action.spec);
|
||||
System::println(System::Color::success, "Package %s is installed", action.spec);
|
||||
}
|
||||
else if (action.plan.plan_type == InstallPlanType::INSTALL)
|
||||
{
|
||||
install_package(paths, action.plan.binary_pgh.value_or_exit(VCPKG_LINE_INFO), &status_db);
|
||||
System::println(System::color::success, "Package %s is installed", action.spec);
|
||||
System::println(System::Color::success, "Package %s is installed", action.spec);
|
||||
}
|
||||
else
|
||||
Checks::unreachable(VCPKG_LINE_INFO);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
System::println(System::color::error, "Error: Could not install package %s: %s", action.spec, e.what());
|
||||
System::println(System::Color::error, "Error: Could not install package %s: %s", action.spec, e.what());
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ namespace vcpkg::Commands::Integrate
|
||||
case elevation_prompt_user_choice::yes:
|
||||
break;
|
||||
case elevation_prompt_user_choice::no:
|
||||
System::println(System::color::warning, "Warning: Previous integration file was not removed");
|
||||
System::println(System::Color::warning, "Warning: Previous integration file was not removed");
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
default:
|
||||
Checks::unreachable(VCPKG_LINE_INFO);
|
||||
@ -192,7 +192,7 @@ namespace vcpkg::Commands::Integrate
|
||||
case elevation_prompt_user_choice::yes:
|
||||
break;
|
||||
case elevation_prompt_user_choice::no:
|
||||
System::println(System::color::warning, "Warning: integration was not applied");
|
||||
System::println(System::Color::warning, "Warning: integration was not applied");
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
default:
|
||||
Checks::unreachable(VCPKG_LINE_INFO);
|
||||
@ -207,10 +207,10 @@ namespace vcpkg::Commands::Integrate
|
||||
|
||||
if (!fs::copy_file(appdata_src_path, appdata_dst_path, fs::copy_options::overwrite_existing))
|
||||
{
|
||||
System::println(System::color::error, "Error: Failed to copy file: %s -> %s", appdata_src_path.string(), appdata_dst_path.string());
|
||||
System::println(System::Color::error, "Error: Failed to copy file: %s -> %s", appdata_src_path.string(), appdata_dst_path.string());
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
System::println(System::color::success, "Applied user-wide integration for this vcpkg root.");
|
||||
System::println(System::Color::success, "Applied user-wide integration for this vcpkg root.");
|
||||
const fs::path cmake_toolchain = paths.buildsystems / "vcpkg.cmake";
|
||||
System::println("\n"
|
||||
"All MSBuild C++ projects can now #include any installed libraries.\n"
|
||||
@ -233,11 +233,11 @@ namespace vcpkg::Commands::Integrate
|
||||
|
||||
if (was_deleted)
|
||||
{
|
||||
System::println(System::color::success, "User-wide integration was removed");
|
||||
System::println(System::Color::success, "User-wide integration was removed");
|
||||
}
|
||||
else
|
||||
{
|
||||
System::println(System::color::success, "User-wide integration is not installed");
|
||||
System::println(System::Color::success, "User-wide integration is not installed");
|
||||
}
|
||||
|
||||
Checks::exit_success(VCPKG_LINE_INFO);
|
||||
@ -269,7 +269,7 @@ namespace vcpkg::Commands::Integrate
|
||||
|
||||
const fs::path nuget_package = buildsystems_dir / Strings::format("%s.%s.nupkg", nuget_id, nupkg_version);
|
||||
Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0 && fs::exists(nuget_package), "Error: NuGet package creation failed");
|
||||
System::println(System::color::success, "Created nupkg: %s", nuget_package.string());
|
||||
System::println(System::Color::success, "Created nupkg: %s", nuget_package.string());
|
||||
|
||||
System::println(R"(
|
||||
With a project open, go to Tools->NuGet Package Manager->Package Manager Console and paste:
|
||||
|
@ -19,11 +19,11 @@ namespace vcpkg::Commands::Remove
|
||||
fs::remove_all(directory, ec);
|
||||
if (!ec)
|
||||
{
|
||||
System::println(System::color::success, "Cleaned up %s", directory.string());
|
||||
System::println(System::Color::success, "Cleaned up %s", directory.string());
|
||||
}
|
||||
if (fs::exists(directory))
|
||||
{
|
||||
System::println(System::color::warning, "Some files in %s were unable to be removed. Close any editors operating in this directory and retry.", directory.string());
|
||||
System::println(System::Color::warning, "Some files in %s were unable to be removed. Close any editors operating in this directory and retry.", directory.string());
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ namespace vcpkg::Commands::Remove
|
||||
auto status = fs::status(target, ec);
|
||||
if (ec)
|
||||
{
|
||||
System::println(System::color::error, "failed: %s", ec.message());
|
||||
System::println(System::Color::error, "failed: %s", ec.message());
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -65,16 +65,16 @@ namespace vcpkg::Commands::Remove
|
||||
fs::remove(target, ec);
|
||||
if (ec)
|
||||
{
|
||||
System::println(System::color::error, "failed: %s: %s", target.u8string(), ec.message());
|
||||
System::println(System::Color::error, "failed: %s: %s", target.u8string(), ec.message());
|
||||
}
|
||||
}
|
||||
else if (!fs::status_known(status))
|
||||
{
|
||||
System::println(System::color::warning, "Warning: unknown status: %s", target.u8string());
|
||||
System::println(System::Color::warning, "Warning: unknown status: %s", target.u8string());
|
||||
}
|
||||
else
|
||||
{
|
||||
System::println(System::color::warning, "Warning: %s: cannot handle file type", target.u8string());
|
||||
System::println(System::Color::warning, "Warning: %s: cannot handle file type", target.u8string());
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ namespace vcpkg::Commands::Remove
|
||||
fs::remove(*b, ec);
|
||||
if (ec)
|
||||
{
|
||||
System::println(System::color::error, "failed: %s", ec.message());
|
||||
System::println(System::Color::error, "failed: %s", ec.message());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -191,7 +191,7 @@ namespace vcpkg::Commands::Remove
|
||||
if (options.find(OPTION_PURGE) != options.end() && !alsoRemoveFolderFromPackages)
|
||||
{
|
||||
// User specified --purge and --no-purge
|
||||
System::println(System::color::error, "Error: cannot specify both --no-purge and --purge.");
|
||||
System::println(System::Color::error, "Error: cannot specify both --no-purge and --purge.");
|
||||
System::print(example);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
@ -210,11 +210,11 @@ namespace vcpkg::Commands::Remove
|
||||
|
||||
if (has_non_user_requested_packages)
|
||||
{
|
||||
System::println(System::color::warning, "Additional packages (*) need to be removed to complete this operation.");
|
||||
System::println(System::Color::warning, "Additional packages (*) need to be removed to complete this operation.");
|
||||
|
||||
if (!isRecursive)
|
||||
{
|
||||
System::println(System::color::warning, "If you are sure you want to remove them, run the command with the --recurse option");
|
||||
System::println(System::Color::warning, "If you are sure you want to remove them, run the command with the --recurse option");
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
}
|
||||
@ -231,12 +231,12 @@ namespace vcpkg::Commands::Remove
|
||||
switch (action.plan.plan_type)
|
||||
{
|
||||
case RemovePlanType::NOT_INSTALLED:
|
||||
System::println(System::color::success, "Package %s is not installed", display_name);
|
||||
System::println(System::Color::success, "Package %s is not installed", display_name);
|
||||
break;
|
||||
case RemovePlanType::REMOVE:
|
||||
System::println("Removing package %s... ", display_name);
|
||||
remove_package(paths, action.spec, &status_db);
|
||||
System::println(System::color::success, "Removing package %s... done", display_name);
|
||||
System::println(System::Color::success, "Removing package %s... done", display_name);
|
||||
break;
|
||||
case RemovePlanType::UNKNOWN:
|
||||
default:
|
||||
@ -247,7 +247,7 @@ namespace vcpkg::Commands::Remove
|
||||
{
|
||||
System::println("Purging package %s... ", display_name);
|
||||
delete_directory(paths.packages / action.spec.dir());
|
||||
System::println(System::color::success, "Purging package %s... done", display_name);
|
||||
System::println(System::Color::success, "Purging package %s... done", display_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ using namespace vcpkg;
|
||||
|
||||
void invalid_command(const std::string& cmd)
|
||||
{
|
||||
System::println(System::color::error, "invalid command: %s", cmd);
|
||||
System::println(System::Color::error, "invalid command: %s", cmd);
|
||||
Commands::Help::print_usage();
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ namespace vcpkg::Checks
|
||||
[[noreturn]]
|
||||
void unreachable(const LineInfo& line_info)
|
||||
{
|
||||
System::println(System::color::error, "Error: Unreachable code was reached");
|
||||
System::println(System::color::error, line_info.toString()); // Always print line_info here
|
||||
System::println(System::Color::error, "Error: Unreachable code was reached");
|
||||
System::println(System::Color::error, line_info.toString()); // Always print line_info here
|
||||
#ifndef NDEBUG
|
||||
std::abort();
|
||||
#else
|
||||
@ -22,7 +22,7 @@ namespace vcpkg::Checks
|
||||
{
|
||||
if (g_debugging)
|
||||
{
|
||||
System::println(System::color::error, line_info.toString());
|
||||
System::println(System::Color::error, line_info.toString());
|
||||
}
|
||||
|
||||
::exit(exit_code);
|
||||
@ -31,7 +31,7 @@ namespace vcpkg::Checks
|
||||
[[noreturn]]
|
||||
void exit_with_message(const LineInfo& line_info, const CStringView errorMessage)
|
||||
{
|
||||
System::println(System::color::error, errorMessage);
|
||||
System::println(System::Color::error, errorMessage);
|
||||
exit_fail(line_info);
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ namespace vcpkg::Input
|
||||
}
|
||||
|
||||
// Intentionally show the lowercased string
|
||||
System::println(System::color::error, "Error: %s: %s", expected_spec.error_code().message(), as_lowercase);
|
||||
System::println(System::Color::error, "Error: %s: %s", expected_spec.error_code().message(), as_lowercase);
|
||||
System::print(example_text);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
@ -25,7 +25,7 @@ namespace vcpkg::Input
|
||||
{
|
||||
if (!paths.is_valid_triplet(t))
|
||||
{
|
||||
System::println(System::color::error, "Error: invalid triplet: %s", t.canonical_name());
|
||||
System::println(System::Color::error, "Error: invalid triplet: %s", t.canonical_name());
|
||||
Metrics::track_property("error", "invalid triplet: " + t.canonical_name());
|
||||
Commands::Help::help_topic_valid_triplet(paths);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
|
@ -142,7 +142,7 @@ namespace vcpkg::System
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
void print(const color c, const CStringView message)
|
||||
void print(const Color c, const CStringView message)
|
||||
{
|
||||
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
@ -155,7 +155,7 @@ namespace vcpkg::System
|
||||
SetConsoleTextAttribute(hConsole, original_color);
|
||||
}
|
||||
|
||||
void println(const color c, const CStringView message)
|
||||
void println(const Color c, const CStringView message)
|
||||
{
|
||||
print(c, message);
|
||||
putchar('\n');
|
||||
|
Loading…
x
Reference in New Issue
Block a user