This commit is contained in:
Robert Schumacher 2023-10-10 15:27:30 -07:00 коммит произвёл GitHub
Родитель 72858a8672
Коммит aedbe0424d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
16 изменённых файлов: 40 добавлений и 61 удалений

Просмотреть файл

@ -50,9 +50,9 @@ Messages in vcpkg are written in American English. They should not contain:
if you need to add more than one indentation, you can use `append_indent(N)`
- Any other interesting characters (like `- ` for lists, for example) should use `append_raw(...)`
* or for the prefixes:
- `"warning: "`, instead use `msg::format(msg::msgWarningMessage).append(msgMyWarning)`
- `"error: "`, instead use `msg::msgErrorMessage`
- `"internal error: "`, instead use `msg::msgInternalErrorMessage`.
- `"warning: "`, instead use `msg::format(msgWarningMessage).append(msgMyWarning)`
- `"error: "`, instead use `msgErrorMessage`
- `"internal error: "`, instead use `msgInternalErrorMessage`.
They should also not be simple, locale-invariant messages -- something like, for example,
`{file}:{line}:{column}: ` should be done with `LocalizedString::from_raw(fmt::format("{}:{}:{}", file, line, column))`.

Просмотреть файл

@ -267,14 +267,4 @@ namespace vcpkg
#include <vcpkg/base/message-data.inc.h>
#undef DECLARE_MESSAGE
namespace msg
{
extern const decltype(vcpkg::msgErrorMessage) msgErrorMessage;
extern const decltype(vcpkg::msgWarningMessage) msgWarningMessage;
extern const decltype(vcpkg::msgNoteMessage) msgNoteMessage;
extern const decltype(vcpkg::msgSeeURL) msgSeeURL;
extern const decltype(vcpkg::msgInternalErrorMessage) msgInternalErrorMessage;
extern const decltype(vcpkg::msgInternalErrorMessageContact) msgInternalErrorMessageContact;
}
}

Просмотреть файл

@ -89,11 +89,11 @@ namespace vcpkg
if (!expression)
{
msg::println(Color::error,
msg::format(msg::msgInternalErrorMessage)
msg::format(msgInternalErrorMessage)
.append(locale_invariant_lineinfo(line_info))
.append(msgChecksFailedCheck)
.append_raw('\n')
.append(msg::msgInternalErrorMessageContact));
.append(msgInternalErrorMessageContact));
exit_fail(line_info);
}
}
@ -103,11 +103,11 @@ namespace vcpkg
if (!expression)
{
msg::println(Color::error,
msg::format(msg::msgInternalErrorMessage)
msg::format(msgInternalErrorMessage)
.append(locale_invariant_lineinfo(line_info))
.append_raw(error_message)
.append_raw('\n')
.append(msg::msgInternalErrorMessageContact));
.append(msgInternalErrorMessageContact));
exit_fail(line_info);
}
}
@ -122,7 +122,7 @@ namespace vcpkg
static void display_upgrade_message()
{
msg::println(Color::error, msg::format(msg::msgNoteMessage).append(msgChecksUpdateVcpkg));
msg::println(Color::error, msg::format(msgNoteMessage).append(msgChecksUpdateVcpkg));
}
[[noreturn]] void Checks::exit_maybe_upgrade(const LineInfo& line_info)

Просмотреть файл

@ -565,7 +565,7 @@ namespace vcpkg::Hash
auto file = fs.open_for_read(path, ec);
if (ec)
{
return msg::format(msg::msgErrorMessage)
return msg::format(msgErrorMessage)
.append(msgHashFileFailureToRead, msg::path = path)
.append_raw(ec.message());
}
@ -582,7 +582,7 @@ namespace vcpkg::Hash
}
else if ((ec = file.error()))
{
return msg::format(msg::msgErrorMessage)
return msg::format(msgErrorMessage)
.append(msgHashFileFailureToRead, msg::path = path)
.append_raw(ec.message());
}

Просмотреть файл

@ -32,12 +32,12 @@ namespace vcpkg
void MessageSink::println_warning(const LocalizedString& s)
{
println(Color::warning, format(msg::msgWarningMessage).append(s));
println(Color::warning, format(msgWarningMessage).append(s));
}
void MessageSink::println_error(const LocalizedString& s)
{
println(Color::error, format(msg::msgErrorMessage).append(s));
println(Color::error, format(msgErrorMessage).append(s));
}
MessageSink& null_sink = null_sink_instance;

Просмотреть файл

@ -276,17 +276,6 @@ namespace vcpkg
#include <vcpkg/base/message-data.inc.h>
#undef DECLARE_MESSAGE
namespace msg
{
const decltype(vcpkg::msgErrorMessage) msgErrorMessage = vcpkg::msgErrorMessage;
const decltype(vcpkg::msgWarningMessage) msgWarningMessage = vcpkg::msgWarningMessage;
const decltype(vcpkg::msgNoteMessage) msgNoteMessage = vcpkg::msgNoteMessage;
const decltype(vcpkg::msgSeeURL) msgSeeURL = vcpkg::msgSeeURL;
const decltype(vcpkg::msgInternalErrorMessage) msgInternalErrorMessage = vcpkg::msgInternalErrorMessage;
const decltype(vcpkg::msgInternalErrorMessageContact) msgInternalErrorMessageContact =
vcpkg::msgInternalErrorMessageContact;
}
}
namespace vcpkg::msg
{

Просмотреть файл

@ -38,11 +38,11 @@ namespace vcpkg
res = LocalizedString::from_raw(fmt::format("{}:{}:{}: ", origin, location.row, location.column));
if (kind == MessageKind::Warning)
{
res.append(msg::msgWarningMessage);
res.append(msgWarningMessage);
}
else
{
res.append(msg::msgErrorMessage);
res.append(msgErrorMessage);
}
res.append(message);

Просмотреть файл

@ -2307,23 +2307,23 @@ ExpectedL<DownloadManagerConfig> vcpkg::parse_download_configuration(const Optio
{
return LocalizedString::from_raw(err->to_string()) // note that this already contains error:
.append_raw('\n')
.append(msg::msgNoteMessage)
.append(msg::msgSeeURL, msg::url = docs::assetcaching_url);
.append(msgNoteMessage)
.append(msgSeeURL, msg::url = docs::assetcaching_url);
}
if (s.azblob_templates_to_put.size() > 1)
{
return msg::format_error(msgAMaximumOfOneAssetWriteUrlCanBeSpecified)
.append_raw('\n')
.append(msg::msgNoteMessage)
.append(msg::msgSeeURL, msg::url = docs::assetcaching_url);
.append(msgNoteMessage)
.append(msgSeeURL, msg::url = docs::assetcaching_url);
}
if (s.url_templates_to_get.size() > 1)
{
return msg::format_error(msgAMaximumOfOneAssetReadUrlCanBeSpecified)
.append_raw('\n')
.append(msg::msgNoteMessage)
.append(msg::msgSeeURL, msg::url = docs::assetcaching_url);
.append(msgNoteMessage)
.append(msgSeeURL, msg::url = docs::assetcaching_url);
}
Optional<std::string> get_url;

Просмотреть файл

@ -100,7 +100,7 @@ namespace vcpkg
if (!pmanifest_scf)
{
print_error_message(maybe_manifest_scf.error());
msg::println(Color::error, msg::msgSeeURL, msg::url = docs::manifests_url);
msg::println(Color::error, msgSeeURL, msg::url = docs::manifests_url);
Checks::exit_fail(VCPKG_LINE_INFO);
}

Просмотреть файл

@ -166,7 +166,7 @@ namespace vcpkg
msg::print(msgElapsedForPackage, msg::spec = spec, msg::elapsed = build_timer);
if (result.code == BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES)
{
LocalizedString errorMsg = msg::format(msg::msgErrorMessage).append(msgBuildDependenciesMissing);
LocalizedString errorMsg = msg::format(msgErrorMessage).append(msgBuildDependenciesMissing);
for (const auto& p : result.unmet_dependencies)
{
errorMsg.append_raw('\n').append_indent().append_raw(p.to_string());
@ -339,7 +339,7 @@ namespace vcpkg
msg::arch = target_architecture,
msg::path = toolset.visual_studio_root_path,
msg::list = toolset_list);
msg::println(msg::msgSeeURL, msg::url = docs::vcpkg_visual_studio_path_url);
msg::println(msgSeeURL, msg::url = docs::vcpkg_visual_studio_path_url);
Checks::exit_maybe_upgrade(VCPKG_LINE_INFO);
}
#endif

Просмотреть файл

@ -1026,7 +1026,7 @@ namespace vcpkg
if (!options.command_arguments.empty())
{
msg::println_error(msgErrorIndividualPackagesUnsupported);
msg::println(Color::error, msg::msgSeeURL, msg::url = docs::manifests_url);
msg::println(Color::error, msgSeeURL, msg::url = docs::manifests_url);
failure = true;
}
if (use_head_version)

Просмотреть файл

@ -203,7 +203,7 @@ namespace vcpkg
}
else
{
return msg::format(msg::msgErrorMessage)
return msg::format(msgErrorMessage)
.append(msgVersionSpecMismatch,
msg::path = path->path,
msg::expected_version = version_spec,

Просмотреть файл

@ -665,30 +665,30 @@ namespace
fs.create_directories(destination_parent, ec);
if (ec)
{
return {msg::format(msg::msgErrorMessage)
return {msg::format(msgErrorMessage)
.append(format_filesystem_call_error(ec, "create_directories", {destination_parent}))
.append_raw('\n')
.append(msg::msgNoteMessage)
.append(msgNoteMessage)
.append(msgWhileCheckingOutBaseline, msg::commit_sha = commit_sha),
expected_right_tag};
}
fs.write_contents(destination_tmp, *contents, ec);
if (ec)
{
return {msg::format(msg::msgErrorMessage)
return {msg::format(msgErrorMessage)
.append(format_filesystem_call_error(ec, "write_contents", {destination_tmp}))
.append_raw('\n')
.append(msg::msgNoteMessage)
.append(msgNoteMessage)
.append(msgWhileCheckingOutBaseline, msg::commit_sha = commit_sha),
expected_right_tag};
}
fs.rename(destination_tmp, destination, ec);
if (ec)
{
return {msg::format(msg::msgErrorMessage)
return {msg::format(msgErrorMessage)
.append(format_filesystem_call_error(ec, "rename", {destination_tmp, destination}))
.append_raw('\n')
.append(msg::msgNoteMessage)
.append(msgNoteMessage)
.append(msgWhileCheckingOutBaseline, msg::commit_sha = commit_sha),
expected_right_tag};
}
@ -1124,7 +1124,7 @@ namespace
{
return format_version_git_entry_missing(port_name, version, port_versions)
.append_raw('\n')
.append(msg::msgNoteMessage)
.append(msgNoteMessage)
.append(msgChecksUpdateVcpkg);
}
@ -1544,7 +1544,7 @@ namespace vcpkg
ExpectedL<Optional<Version>> RegistrySet::baseline_for_port(StringView port_name) const
{
auto impl = registry_for_port(port_name);
if (!impl) return msg::format(msg::msgErrorMessage).append(msgNoRegistryForPort, msg::package_name = port_name);
if (!impl) return msg::format(msgErrorMessage).append(msgNoRegistryForPort, msg::package_name = port_name);
return impl->get_baseline_version(port_name);
}

Просмотреть файл

@ -839,7 +839,7 @@ namespace vcpkg
}
// If no acceptable tool was found and downloading was unavailable, emit an error message
LocalizedString s = msg::format(msg::msgErrorMessage);
LocalizedString s = msg::format(msgErrorMessage);
s.append(msgToolFetchFailed, msg::tool_name = tool.tool_data_name());
if (env_force_system_binaries && download_available)
{
@ -908,7 +908,7 @@ namespace vcpkg
const auto tools = fs.find_from_PATH(Tools::TAR);
if (tools.empty())
{
return msg::format(msg::msgErrorMessage)
return msg::format(msgErrorMessage)
.append(msgToolFetchFailed, msg::tool_name = Tools::TAR)
#if defined(_WIN32)
.append(msgToolInWin10)
@ -948,7 +948,7 @@ namespace vcpkg
}
#endif
return msg::format(msg::msgErrorMessage)
return msg::format(msgErrorMessage)
.append(msgToolFetchFailed, msg::tool_name = Tools::CMAKE)
#if !defined(_WIN32)
.append(msgInstallWithSystemManager)

Просмотреть файл

@ -947,7 +947,7 @@ namespace vcpkg
return std::move(maybe_tree)
.error()
.append(msg::msgNoteMessage)
.append(msgNoteMessage)
.append(msgWhileCheckingOutPortTreeIsh, msg::package_name = port_name, msg::commit_sha = git_tree);
}
@ -1009,7 +1009,7 @@ namespace vcpkg
.append_raw('\n')
.append(std::move(maybe_output).error())
.append_raw('\n')
.append(msg::msgNoteMessage)
.append(msgNoteMessage)
.append(msgWhileGettingLocalTreeIshObjectsForPorts);
}
@ -1194,7 +1194,7 @@ namespace vcpkg
fs.rename_with_retry(git_tree_temp, destination, ec);
if (ec)
{
return msg::format(msg::msgErrorMessage)
return msg::format(msgErrorMessage)
.append(format_filesystem_call_error(ec, "rename_with_retry", {git_tree_temp, destination}));
}

Просмотреть файл

@ -303,7 +303,7 @@ namespace vcpkg
static LocalizedString format_invalid_date_version(StringView version)
{
return msg::format(msg::msgErrorMessage).append(msg::format(msgVersionInvalidDate, msg::version = version));
return msg::format(msgErrorMessage).append(msg::format(msgVersionInvalidDate, msg::version = version));
}
ExpectedL<DateVersion> DateVersion::try_parse(StringView version)