Skip to content

Commit

Permalink
oops Debug::print did not need to be localized
Browse files Browse the repository at this point in the history
  • Loading branch information
JavierMatosD committed Sep 22, 2022
1 parent 934363f commit 3572a99
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 62 deletions.
14 changes: 0 additions & 14 deletions include/vcpkg/base/messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,6 @@ namespace vcpkg
"",
"The control or mnaifest file for {spec} could not be loaded due to the following error. Please "
"remove {spec} and re-attempt.");
DECLARE_MESSAGE(FailedToLoadLockfile, (msg::error_msg), "", "Failed to load lockfile: {error_msg}");
DECLARE_MESSAGE(FailedToLoadManifest,
(msg::path, msg::error_msg),
"",
Expand Down Expand Up @@ -1295,19 +1294,6 @@ namespace vcpkg
(),
"",
"Using local portfile versions. To update the local portfiles, use `git pull`.");
DECLARE_MESSAGE(LockfileNotObj, (), "", "Lockfile was not an object");
DECLARE_MESSAGE(LockfileValueNotCommitSha,
(msg::package_name),
"",
"Lockfile value for key {package_name} was not a git commit sha");
DECLARE_MESSAGE(LockfileValueNotObj,
(msg::package_name),
"",
"Lockfile value for key {package_name} was not an object");
DECLARE_MESSAGE(LockfileValueNotString,
(msg::package_name),
"",
"Lockfile value for key {package_name} was not an string");
DECLARE_MESSAGE(ManifestFormatCompleted, (), "", "Succeeded in formatting the manifest files.");
DECLARE_MESSAGE(ManifestWithNoTopLevelObj,
(msg::path),
Expand Down
5 changes: 0 additions & 5 deletions locales/messages.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@
"FailedToFindPortFeature": "Could not find {feature} in {spec}.",
"FailedToFormatMissingFile": "No files to format.\nPlease pass either --all, or the explicit files to format or convert.",
"FailedToLoadInstalledManifest": "The control or mnaifest file for {spec} could not be loaded due to the following error. Please remove {spec} and re-attempt.",
"FailedToLoadLockfile": "Failed to load lockfile: {error_msg}",
"FailedToLoadManifest": "Failed to load manifest from directory {path}: {error_msg}",
"FailedToLocateSpec": "Failed to locate spec in graph: {spec}",
"FailedToObtainDependencyVersion": "Cannot find desired dependency version.",
Expand Down Expand Up @@ -299,10 +298,6 @@
"LocalPortfileVersion": "Using local portfile versions. To update the local portfiles, use `git pull`.",
"LocalizedMessageMustNotContainIndents": "The message named {value} contains what appears to be indenting which must be changed to use LocalizedString::append_indent instead.",
"LocalizedMessageMustNotEndWithNewline": "The message named {value} ends with a newline which should be added by formatting rather than by localization.",
"LockfileNotObj": "Lockfile was not an object",
"LockfileValueNotCommitSha": "Lockfile value for key {package_name} was not a git commit sha",
"LockfileValueNotObj": "Lockfile value for key {package_name} was not an object",
"LockfileValueNotString": "Lockfile value for key {package_name} was not an string",
"ManifestFormatCompleted": "Succeeded in formatting the manifest files.",
"ManifestWithNoTopLevelObj": "Failed to parse manifest at {path}: manifest files must have a top-level object",
"MismatchedFiles": "file to store does not match hash",
Expand Down
9 changes: 0 additions & 9 deletions locales/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,6 @@
"FailedToFormatMissingFile": "No files to format.\nPlease pass either --all, or the explicit files to format or convert.",
"FailedToLoadInstalledManifest": "The control or mnaifest file for {spec} could not be loaded due to the following error. Please remove {spec} and re-attempt.",
"_FailedToLoadInstalledManifest.comment": "An example of {spec} is zlib:x64-windows.",
"FailedToLoadLockfile": "Failed to load lockfile: {error_msg}",
"_FailedToLoadLockfile.comment": "An example of {error_msg} is File Not Found.",
"FailedToLoadManifest": "Failed to load manifest from directory {path}: {error_msg}",
"_FailedToLoadManifest.comment": "An example of {path} is /foo/bar. An example of {error_msg} is File Not Found.",
"FailedToLocateSpec": "Failed to locate spec in graph: {spec}",
Expand Down Expand Up @@ -497,13 +495,6 @@
"_LocalizedMessageMustNotContainIndents.comment": "{value} is is a localized message name like LocalizedMessageMustNotContainIndents. The 'LocalizedString::append_indent' part is locale-invariant.",
"LocalizedMessageMustNotEndWithNewline": "The message named {value} ends with a newline which should be added by formatting rather than by localization.",
"_LocalizedMessageMustNotEndWithNewline.comment": "{value} is a localized message name like LocalizedMessageMustNotEndWithNewline",
"LockfileNotObj": "Lockfile was not an object",
"LockfileValueNotCommitSha": "Lockfile value for key {package_name} was not a git commit sha",
"_LockfileValueNotCommitSha.comment": "An example of {package_name} is zlib.",
"LockfileValueNotObj": "Lockfile value for key {package_name} was not an object",
"_LockfileValueNotObj.comment": "An example of {package_name} is zlib.",
"LockfileValueNotString": "Lockfile value for key {package_name} was not an string",
"_LockfileValueNotString.comment": "An example of {package_name} is zlib.",
"ManifestFormatCompleted": "Succeeded in formatting the manifest files.",
"ManifestWithNoTopLevelObj": "Failed to parse manifest at {path}: manifest files must have a top-level object",
"_ManifestWithNoTopLevelObj.comment": "An example of {path} is /foo/bar.",
Expand Down
5 changes: 0 additions & 5 deletions src/vcpkg/base/messages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,6 @@ namespace vcpkg
REGISTER_MESSAGE(FailedToFindPortFeature);
REGISTER_MESSAGE(FailedToFormatMissingFile);
REGISTER_MESSAGE(FailedToLoadInstalledManifest);
REGISTER_MESSAGE(FailedToLoadLockfile);
REGISTER_MESSAGE(FailedToLoadManifest);
REGISTER_MESSAGE(FailedToLocateSpec);
REGISTER_MESSAGE(FailedToObtainDependencyVersion);
Expand Down Expand Up @@ -676,10 +675,6 @@ namespace vcpkg
REGISTER_MESSAGE(LocalizedMessageMustNotContainIndents);
REGISTER_MESSAGE(LocalizedMessageMustNotEndWithNewline);
REGISTER_MESSAGE(LocalPortfileVersion);
REGISTER_MESSAGE(LockfileNotObj);
REGISTER_MESSAGE(LockfileValueNotCommitSha);
REGISTER_MESSAGE(LockfileValueNotObj);
REGISTER_MESSAGE(LockfileValueNotString);
REGISTER_MESSAGE(ManifestFormatCompleted);
REGISTER_MESSAGE(ManifestWithNoTopLevelObj);
REGISTER_MESSAGE(MismatchedFiles);
Expand Down
53 changes: 24 additions & 29 deletions src/vcpkg/vcpkgpaths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace
Filesystem& filesystem, const Path& root, std::string* option, StringLiteral name, LineInfo li)
{
auto result = process_input_directory_impl(filesystem, root, option, name, li);
msg::write_unlocalized_text_to_stdout(Color::none, fmt::format("Using {}-root: {}\n", name, result));
Debug::print("Using ", name, "-root: ", result, '\n');
return result;
}

Expand Down Expand Up @@ -358,15 +358,15 @@ namespace vcpkg
, scripts(process_input_directory(fs, root, args.scripts_root_dir.get(), "scripts", VCPKG_LINE_INFO))
, m_registries_cache(compute_registries_cache_root(fs, args))
{
msg::write_unlocalized_text_to_stdout(
Color::none,
fmt::format("Bundle config: readonly={}, usegitregistry={}, embeddedsha={}\n",
m_bundle.m_readonly,
m_bundle.m_usegitregistry,
m_bundle.m_embedded_git_sha.value_or("nullopt")));

msg::write_unlocalized_text_to_stdout(Color::none,
fmt::format("Using builtin-ports: {}\n", m_builtin_ports));
Debug::print("Bundle config: readonly=",
m_bundle.m_readonly,
", usegitregistry=",
m_bundle.m_usegitregistry,
", embeddedsha=",
m_bundle.m_embedded_git_sha.value_or("nullopt"),
"\n");

Debug::print("Using builtin-ports: ", m_builtin_ports, '\n');
}

Filesystem& m_fs;
Expand Down Expand Up @@ -468,19 +468,15 @@ namespace vcpkg
{
if (auto i = m_installed.get())
{
msg::write_unlocalized_text_to_stdout(Color::none,
fmt::format("Using installed-root: {}\n", i->root()));
Debug::print("Using installed-root: ", i->root(), '\n');
}

msg::write_unlocalized_text_to_stdout(
Color::none, fmt::format("Using buildtrees-root: {}\n", buildtrees.value_or("nullopt")));
msg::write_unlocalized_text_to_stdout(
Color::none, fmt::format("Using packages-root: {}\n", packages.value_or("nullopt")));
Debug::print("Using buildtrees-root: ", buildtrees.value_or("nullopt"), '\n');
Debug::print("Using packages-root: ", packages.value_or("nullopt"), '\n');

if (!m_manifest_dir.empty())
{
msg::write_unlocalized_text_to_stdout(Color::none,
fmt::format("Using manifest-root: {}\n", m_manifest_dir));
Debug::print("Using manifest-root: ", m_manifest_dir, '\n');

std::error_code ec;
const auto vcpkg_root_file = root / ".vcpkg-root";
Expand Down Expand Up @@ -623,11 +619,10 @@ namespace vcpkg
, triplets(filesystem.almost_canonical(root / "triplets", VCPKG_LINE_INFO))
, community_triplets(filesystem.almost_canonical(triplets / "community", VCPKG_LINE_INFO))
{
msg::write_unlocalized_text_to_stdout(Color::none, fmt::format("Using vcpkg-root: {}\n", root));
msg::write_unlocalized_text_to_stdout(Color::none, fmt::format("Using scripts-root: {}\n", scripts));
msg::write_unlocalized_text_to_stdout(Color::none,
fmt::format("Using builtin-registry: {}\n", builtin_registry_versions));
msg::write_unlocalized_text_to_stdout(Color::none, fmt::format("Using downloads-root: {}\n", downloads));
Debug::print("Using vcpkg-root: ", root, '\n');
Debug::print("Using scripts-root: ", scripts, '\n');
Debug::print("Using builtin-registry: ", builtin_registry_versions, '\n');
Debug::print("Using downloads-root: ", downloads, '\n');

m_pimpl->triplets_dirs.emplace_back(triplets);
m_pimpl->triplets_dirs.emplace_back(community_triplets);
Expand Down Expand Up @@ -761,7 +756,7 @@ namespace vcpkg

if (!ref_info_value.is_object())
{
msg::println(msgLockfileValueNotObj, msg::package_name = repo);
Debug::print("Lockfile value for key '", repo, "' was not an object\n");
return ret;
}

Expand All @@ -772,13 +767,13 @@ namespace vcpkg

if (!commit.is_string())
{
msg::println(msgLockfileValueNotString, msg::package_name = reference);
Debug::print("Lockfile value for key '", reference, "' was not a string\n");
return ret;
}
auto sv = commit.string(VCPKG_LINE_INFO);
if (!is_git_commit_sha(sv))
{
msg::println(msgLockfileValueNotCommitSha, msg::package_name = reference);
Debug::print("Lockfile value for key '", reference, "' was not a string\n");
return ret;
}
ret.emplace(repo.to_string(), LockFile::EntryData{reference.to_string(), sv.to_string(), true});
Expand Down Expand Up @@ -815,15 +810,15 @@ namespace vcpkg
auto maybe_lock_contents = Json::parse_file(fs, p, ec);
if (ec)
{
msg::println(msgFailedToLoadLockfile, msg::error_msg = ec.message());
Debug::print("Failed to load lockfile: ", ec.message(), "\n");
return ret;
}
else if (auto lock_contents = maybe_lock_contents.get())
{
auto& doc = lock_contents->first;
if (!doc.is_object())
{
msg::println(msgLockfileNotObj);
Debug::print("Lockfile was not an object\n");
return ret;
}

Expand All @@ -833,7 +828,7 @@ namespace vcpkg
}
else
{
msg::println(msgFailedToLoadLockfile, msg::error_msg = maybe_lock_contents.error()->to_string());
Debug::print("Failed to load lockfile:\n", maybe_lock_contents.error()->to_string());
return ret;
}
}
Expand Down

0 comments on commit 3572a99

Please sign in to comment.