From bb975f598f7b63e147fbfe57fffd1ee55e6eb342 Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Wed, 30 Aug 2023 19:26:02 -0700 Subject: [PATCH 1/2] Delete 'vcpkg cache'. 'vcpkg cache' was a helper for folks to attempt to implement caching systems. It prints the contents of the "packages" directory. It was a kind of helper for before we had real binary caching support built into the tool proper. @vicroms indicates that telemetry shows fewer than 100 invocations of `vcpkg cache` in the last 90 days, so this should be OK to outright remove without a deprecation period. --- include/vcpkg/commands.cache.h | 10 ----- src/vcpkg/commands.cache.cpp | 75 ---------------------------------- src/vcpkg/commands.cpp | 2 - src/vcpkg/commands.help.cpp | 2 - 4 files changed, 89 deletions(-) delete mode 100644 include/vcpkg/commands.cache.h delete mode 100644 src/vcpkg/commands.cache.cpp diff --git a/include/vcpkg/commands.cache.h b/include/vcpkg/commands.cache.h deleted file mode 100644 index fb5185363f..0000000000 --- a/include/vcpkg/commands.cache.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include -#include - -namespace vcpkg -{ - extern const CommandMetadata CommandCacheMetadata; - void command_cache_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); -} diff --git a/src/vcpkg/commands.cache.cpp b/src/vcpkg/commands.cache.cpp deleted file mode 100644 index e1c38f5acd..0000000000 --- a/src/vcpkg/commands.cache.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include -#include - -#include -#include -#include -#include -#include -#include - -using namespace vcpkg; - -namespace -{ - std::vector read_all_binary_paragraphs(const VcpkgPaths& paths) - { - std::vector output; - for (auto&& path : paths.get_filesystem().get_files_non_recursive(paths.packages(), VCPKG_LINE_INFO)) - { - auto pghs = Paragraphs::get_single_paragraph(paths.get_filesystem(), std::move(path) / "CONTROL"); - if (const auto p = pghs.get()) - { - output.emplace_back(std::move(*p)); - } - } - - return output; - } -} // unnamed namespace - -namespace vcpkg -{ - constexpr CommandMetadata CommandCacheMetadata = { - [] { return msg::format(msgCacheHelp).append_raw('\n').append(create_example_string("cache png")); }, - 0, - 1, - {}, - nullptr, - }; - - void command_cache_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) - { - auto parsed = args.parse_arguments(CommandCacheMetadata); - - const std::vector binary_paragraphs = read_all_binary_paragraphs(paths); - if (binary_paragraphs.empty()) - { - msg::println(msgNoCachedPackages); - Checks::exit_success(VCPKG_LINE_INFO); - } - - if (parsed.command_arguments.empty()) - { - for (const BinaryParagraph& binary_paragraph : binary_paragraphs) - { - msg::write_unlocalized_text_to_stdout(Color::none, binary_paragraph.displayname() + '\n'); - } - } - else - { - // At this point there is 1 argument - for (const BinaryParagraph& binary_paragraph : binary_paragraphs) - { - const std::string displayname = binary_paragraph.displayname(); - if (!Strings::case_insensitive_ascii_contains(displayname, parsed.command_arguments[0])) - { - continue; - } - msg::write_unlocalized_text_to_stdout(Color::none, displayname + '\n'); - } - } - - Checks::exit_success(VCPKG_LINE_INFO); - } -} // namespace vcpkg diff --git a/src/vcpkg/commands.cpp b/src/vcpkg/commands.cpp index fe1f9484ff..9236f27fe8 100644 --- a/src/vcpkg/commands.cpp +++ b/src/vcpkg/commands.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -80,7 +79,6 @@ namespace vcpkg {"add", command_add_and_exit}, {"x-add-version", command_add_version_and_exit}, {"autocomplete", command_autocomplete_and_exit}, - {"cache", command_cache_and_exit}, {"x-ci-clean", command_ci_clean_and_exit}, {"x-ci-verify-versions", command_ci_verify_versions_and_exit}, {"create", command_create_and_exit}, diff --git a/src/vcpkg/commands.help.cpp b/src/vcpkg/commands.help.cpp index 57b4df85b3..bc18b1a827 100644 --- a/src/vcpkg/commands.help.cpp +++ b/src/vcpkg/commands.help.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -127,7 +126,6 @@ namespace // bootstrap-standalone intentionally has no help topic {"build", command_topic_fn}, {"build-external", command_topic_fn}, - {"cache", command_topic_fn}, {"x-check-support", command_topic_fn}, {"ci", command_topic_fn}, {"x-ci-clean", command_topic_fn}, From e1a28ed8ef8d93e0286b2de16ac208a7eda2e626 Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Wed, 30 Aug 2023 21:18:17 -0700 Subject: [PATCH 2/2] Also get rid of unique messages. --- include/vcpkg/base/message-data.inc.h | 5 ----- locales/messages.json | 2 -- 2 files changed, 7 deletions(-) diff --git a/include/vcpkg/base/message-data.inc.h b/include/vcpkg/base/message-data.inc.h index b5585291a4..41bb4e79ca 100644 --- a/include/vcpkg/base/message-data.inc.h +++ b/include/vcpkg/base/message-data.inc.h @@ -417,10 +417,6 @@ DECLARE_MESSAGE(BuildTroubleshootingMessage4, "Please use the prefilled template from {path} when reporting your issue.") DECLARE_MESSAGE(BuiltInTriplets, (), "", "vcpkg built-in triplets:") DECLARE_MESSAGE(BuiltWithIncorrectArchitecture, (), "", "The following files were built for an incorrect architecture:") -DECLARE_MESSAGE(CacheHelp, - (), - "", - "The argument should be a substring to search for or no argument to display all cached libraries.") DECLARE_MESSAGE(CheckedOutGitSha, (msg::commit_sha), "", "Checked out Git SHA: {commit_sha}") DECLARE_MESSAGE(CheckedOutObjectMissingManifest, (), @@ -1968,7 +1964,6 @@ DECLARE_MESSAGE(NewSpecifyNameVersionOrApplication, "--application to indicate that the manifest is not intended to be used as a port.") DECLARE_MESSAGE(NewVersionCannotBeEmpty, (), "", "--version cannot be empty.") DECLARE_MESSAGE(NoArgumentsForOption, (msg::option), "", "The option --{option} does not accept an argument.") -DECLARE_MESSAGE(NoCachedPackages, (), "", "No packages are cached.") DECLARE_MESSAGE(NoError, (), "", "no error") DECLARE_MESSAGE(NoInstalledPackages, (), diff --git a/locales/messages.json b/locales/messages.json index fec03a842b..e5be1ed226 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -275,7 +275,6 @@ "_CMakeToolChainFile.comment": "An example of {path} is /foo/bar.", "CMakeUsingExportedLibs": "To use exported libraries in CMake projects, add {value} to your CMake command line.", "_CMakeUsingExportedLibs.comment": "{value} is a CMake command line switch of the form -DFOO=BAR", - "CacheHelp": "The argument should be a substring to search for or no argument to display all cached libraries.", "CheckedOutGitSha": "Checked out Git SHA: {commit_sha}", "_CheckedOutGitSha.comment": "An example of {commit_sha} is 7cfad47ae9f68b183983090afd6337cd60fd4949.", "CheckedOutObjectMissingManifest": "The checked-out object does not contain a CONTROL file or vcpkg.json file.", @@ -1101,7 +1100,6 @@ "NewVersionCannotBeEmpty": "--version cannot be empty.", "NoArgumentsForOption": "The option --{option} does not accept an argument.", "_NoArgumentsForOption.comment": "An example of {option} is editable.", - "NoCachedPackages": "No packages are cached.", "NoError": "no error", "NoInstalledPackages": "No packages are installed. Did you mean `search`?", "_NoInstalledPackages.comment": "The name 'search' is the name of a command that is not localized.",