diff --git a/toolsrc/include/vcpkg/commands.autocomplete.h b/toolsrc/include/vcpkg/commands.autocomplete.h new file mode 100644 index 00000000000000..52998b110463b0 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.autocomplete.h @@ -0,0 +1,8 @@ +#pragma once + +#include + +namespace vcpkg::Commands::Autocomplete +{ + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); +} diff --git a/toolsrc/include/vcpkg/commands.buildexternal.h b/toolsrc/include/vcpkg/commands.buildexternal.h new file mode 100644 index 00000000000000..1e3da99db388c9 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.buildexternal.h @@ -0,0 +1,8 @@ +#pragma once + +#include + +namespace vcpkg::Commands::BuildExternal +{ + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet); +} diff --git a/toolsrc/include/vcpkg/commands.cache.h b/toolsrc/include/vcpkg/commands.cache.h new file mode 100644 index 00000000000000..0f48c4eb76784a --- /dev/null +++ b/toolsrc/include/vcpkg/commands.cache.h @@ -0,0 +1,8 @@ +#pragma once + +#include + +namespace vcpkg::Commands::Cache +{ + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); +} diff --git a/toolsrc/include/vcpkg/commands.ci.h b/toolsrc/include/vcpkg/commands.ci.h new file mode 100644 index 00000000000000..e153c1fdeb1e56 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.ci.h @@ -0,0 +1,9 @@ +#pragma once + +#include + +namespace vcpkg::Commands::CI +{ + extern const CommandStructure COMMAND_STRUCTURE; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet); +} diff --git a/toolsrc/include/vcpkg/commands.ciclean.h b/toolsrc/include/vcpkg/commands.ciclean.h new file mode 100644 index 00000000000000..bf5c3a736d3f1f --- /dev/null +++ b/toolsrc/include/vcpkg/commands.ciclean.h @@ -0,0 +1,8 @@ +#pragma once + +#include + +namespace vcpkg::Commands::CIClean +{ + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); +} diff --git a/toolsrc/include/vcpkg/commands.contact.h b/toolsrc/include/vcpkg/commands.contact.h new file mode 100644 index 00000000000000..079d6862614637 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.contact.h @@ -0,0 +1,10 @@ +#pragma once + +#include + +namespace vcpkg::Commands::Contact +{ + extern const CommandStructure COMMAND_STRUCTURE; + const std::string& email(); + void perform_and_exit(const VcpkgCmdArguments& args, Files::Filesystem& fs); +} diff --git a/toolsrc/include/vcpkg/commands.create.h b/toolsrc/include/vcpkg/commands.create.h new file mode 100644 index 00000000000000..5a6a7088956321 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.create.h @@ -0,0 +1,10 @@ +#pragma once + +#include + +namespace vcpkg::Commands::Create +{ + extern const CommandStructure COMMAND_STRUCTURE; + int perform(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); +} diff --git a/toolsrc/include/vcpkg/commands.dependinfo.h b/toolsrc/include/vcpkg/commands.dependinfo.h new file mode 100644 index 00000000000000..573cf297a9e129 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.dependinfo.h @@ -0,0 +1,9 @@ +#pragma once + +#include + +namespace vcpkg::Commands::DependInfo +{ + extern const CommandStructure COMMAND_STRUCTURE; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet); +} diff --git a/toolsrc/include/vcpkg/commands.edit.h b/toolsrc/include/vcpkg/commands.edit.h new file mode 100644 index 00000000000000..f1a2109cf91196 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.edit.h @@ -0,0 +1,9 @@ +#pragma once + +#include + +namespace vcpkg::Commands::Edit +{ + extern const CommandStructure COMMAND_STRUCTURE; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); +} diff --git a/toolsrc/include/vcpkg/commands.env.h b/toolsrc/include/vcpkg/commands.env.h new file mode 100644 index 00000000000000..69ff543d240261 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.env.h @@ -0,0 +1,9 @@ +#pragma once + +#include + +namespace vcpkg::Commands::Env +{ + extern const CommandStructure COMMAND_STRUCTURE; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet); +} diff --git a/toolsrc/include/vcpkg/commands.fetch.h b/toolsrc/include/vcpkg/commands.fetch.h new file mode 100644 index 00000000000000..08d4f4351ab621 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.fetch.h @@ -0,0 +1,8 @@ +#pragma once + +#include + +namespace vcpkg::Commands::Fetch +{ + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); +} diff --git a/toolsrc/include/vcpkg/commands.format-manifest.h b/toolsrc/include/vcpkg/commands.format-manifest.h new file mode 100644 index 00000000000000..20e12684684c10 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.format-manifest.h @@ -0,0 +1,9 @@ +#pragma once + +#include + +namespace vcpkg::Commands::FormatManifest +{ + extern const CommandStructure COMMAND_STRUCTURE; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); +} diff --git a/toolsrc/include/vcpkg/commands.h b/toolsrc/include/vcpkg/commands.h index cec9237f5737f4..3a682b0913fd36 100644 --- a/toolsrc/include/vcpkg/commands.h +++ b/toolsrc/include/vcpkg/commands.h @@ -1,10 +1,9 @@ #pragma once #include +#include #include #include -#include -#include #include #include @@ -16,158 +15,6 @@ namespace vcpkg::Commands using CommandTypeB = void (*)(const VcpkgCmdArguments& args, const VcpkgPaths& paths); using CommandTypeC = void (*)(const VcpkgCmdArguments& args, Files::Filesystem& fs); - enum class DryRun : bool - { - No, - Yes, - }; - - namespace BuildExternal - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet); - } - - namespace CI - { - extern const CommandStructure COMMAND_STRUCTURE; - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet); - } - - namespace CIClean - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Env - { - extern const CommandStructure COMMAND_STRUCTURE; - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet); - } - - namespace Create - { - extern const CommandStructure COMMAND_STRUCTURE; - int perform(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Upgrade - { - extern const CommandStructure COMMAND_STRUCTURE; - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet); - } - - namespace Edit - { - extern const CommandStructure COMMAND_STRUCTURE; - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace DependInfo - { - extern const CommandStructure COMMAND_STRUCTURE; - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet); - } - - namespace Search - { - extern const CommandStructure COMMAND_STRUCTURE; - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace List - { - extern const CommandStructure COMMAND_STRUCTURE; - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Owns - { - extern const CommandStructure COMMAND_STRUCTURE; - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Cache - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Integrate - { - extern const CommandStructure COMMAND_STRUCTURE; - - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - void append_helpstring(HelpTableFormatter& table); - std::string get_helpstring(); - } - - namespace PortsDiff - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace PortHistory - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Autocomplete - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Version - { - const char* base_version(); - const std::string& version(); - void warn_if_vcpkg_version_mismatch(const VcpkgPaths& paths); - void perform_and_exit(const VcpkgCmdArguments& args, Files::Filesystem& fs); - } - - namespace Contact - { - extern const CommandStructure COMMAND_STRUCTURE; - const std::string& email(); - void perform_and_exit(const VcpkgCmdArguments& args, Files::Filesystem& fs); - } - - namespace X_VSInstances - { - extern const CommandStructure COMMAND_STRUCTURE; - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Hash - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Fetch - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace FormatManifest - { - extern const CommandStructure COMMAND_STRUCTURE; - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace SetInstalled - { - extern const CommandStructure COMMAND_STRUCTURE; - void perform_and_exit_ex(const VcpkgCmdArguments& args, - const VcpkgPaths& paths, - const PortFileProvider::PathsPortFileProvider& provider, - IBinaryProvider& binary_provider, - const CMakeVars::CMakeVarProvider& cmake_vars, - const std::vector& specs, - const Build::BuildPackageOptions& install_plan_options, - DryRun dry_run, - const Optional& pkgsconfig_path); - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet); - } - template struct PackageNameAndFunction { diff --git a/toolsrc/include/vcpkg/commands.hash.h b/toolsrc/include/vcpkg/commands.hash.h new file mode 100644 index 00000000000000..8cb42ff30c454a --- /dev/null +++ b/toolsrc/include/vcpkg/commands.hash.h @@ -0,0 +1,8 @@ +#pragma once + +#include + +namespace vcpkg::Commands::Hash +{ + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); +} diff --git a/toolsrc/include/vcpkg/commands.integrate.h b/toolsrc/include/vcpkg/commands.integrate.h new file mode 100644 index 00000000000000..a8ca5026be4937 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.integrate.h @@ -0,0 +1,12 @@ +#pragma once + +#include + +namespace vcpkg::Commands::Integrate +{ + extern const CommandStructure COMMAND_STRUCTURE; + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + void append_helpstring(HelpTableFormatter& table); + std::string get_helpstring(); +} diff --git a/toolsrc/include/vcpkg/commands.interface.h b/toolsrc/include/vcpkg/commands.interface.h new file mode 100644 index 00000000000000..96745a2fba994d --- /dev/null +++ b/toolsrc/include/vcpkg/commands.interface.h @@ -0,0 +1,13 @@ +#pragma once + +#include +#include + +namespace vcpkg::Commands +{ + enum class DryRun : bool + { + No, + Yes, + }; +} diff --git a/toolsrc/include/vcpkg/commands.list.h b/toolsrc/include/vcpkg/commands.list.h new file mode 100644 index 00000000000000..65c22ef9e4f607 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.list.h @@ -0,0 +1,9 @@ +#pragma once + +#include + +namespace vcpkg::Commands::List +{ + extern const CommandStructure COMMAND_STRUCTURE; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); +} diff --git a/toolsrc/include/vcpkg/commands.owns.h b/toolsrc/include/vcpkg/commands.owns.h new file mode 100644 index 00000000000000..a46e2bd4e239a9 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.owns.h @@ -0,0 +1,9 @@ +#pragma once + +#include + +namespace vcpkg::Commands::Owns +{ + extern const CommandStructure COMMAND_STRUCTURE; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); +} diff --git a/toolsrc/include/vcpkg/commands.porthistory.h b/toolsrc/include/vcpkg/commands.porthistory.h new file mode 100644 index 00000000000000..ee03be2064af7c --- /dev/null +++ b/toolsrc/include/vcpkg/commands.porthistory.h @@ -0,0 +1,8 @@ +#pragma once + +#include + +namespace vcpkg::Commands::PortHistory +{ + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); +} diff --git a/toolsrc/include/vcpkg/commands.portsdiff.h b/toolsrc/include/vcpkg/commands.portsdiff.h new file mode 100644 index 00000000000000..efa3877101f782 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.portsdiff.h @@ -0,0 +1,8 @@ +#pragma once + +#include + +namespace vcpkg::Commands::PortsDiff +{ + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); +} diff --git a/toolsrc/include/vcpkg/commands.search.h b/toolsrc/include/vcpkg/commands.search.h new file mode 100644 index 00000000000000..81c03985651645 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.search.h @@ -0,0 +1,9 @@ +#pragma once + +#include + +namespace vcpkg::Commands::Search +{ + extern const CommandStructure COMMAND_STRUCTURE; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); +} diff --git a/toolsrc/include/vcpkg/commands.setinstalled.h b/toolsrc/include/vcpkg/commands.setinstalled.h new file mode 100644 index 00000000000000..88065be1c676a4 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.setinstalled.h @@ -0,0 +1,20 @@ +#pragma once + +#include +#include +#include + +namespace vcpkg::Commands::SetInstalled +{ + extern const CommandStructure COMMAND_STRUCTURE; + void perform_and_exit_ex(const VcpkgCmdArguments& args, + const VcpkgPaths& paths, + const PortFileProvider::PathsPortFileProvider& provider, + IBinaryProvider& binary_provider, + const CMakeVars::CMakeVarProvider& cmake_vars, + const std::vector& specs, + const Build::BuildPackageOptions& install_plan_options, + DryRun dry_run, + const Optional& pkgsconfig_path); + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet); +} diff --git a/toolsrc/include/vcpkg/commands.upgrade.h b/toolsrc/include/vcpkg/commands.upgrade.h new file mode 100644 index 00000000000000..5e6047c139fb88 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.upgrade.h @@ -0,0 +1,9 @@ +#pragma once + +#include + +namespace vcpkg::Commands::Upgrade +{ + extern const CommandStructure COMMAND_STRUCTURE; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet); +} diff --git a/toolsrc/include/vcpkg/commands.version.h b/toolsrc/include/vcpkg/commands.version.h new file mode 100644 index 00000000000000..1af134b04ec0a6 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.version.h @@ -0,0 +1,11 @@ +#pragma once + +#include + +namespace vcpkg::Commands::Version +{ + const char* base_version(); + const std::string& version(); + void warn_if_vcpkg_version_mismatch(const VcpkgPaths& paths); + void perform_and_exit(const VcpkgCmdArguments& args, Files::Filesystem& fs); +} diff --git a/toolsrc/include/vcpkg/commands.xvsinstances.h b/toolsrc/include/vcpkg/commands.xvsinstances.h new file mode 100644 index 00000000000000..0ffa67a50c5bab --- /dev/null +++ b/toolsrc/include/vcpkg/commands.xvsinstances.h @@ -0,0 +1,12 @@ +#pragma once + +#include + +namespace vcpkg::Commands +{ + namespace X_VSInstances + { + extern const CommandStructure COMMAND_STRUCTURE; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } +} diff --git a/toolsrc/src/vcpkg-test/commands.create.cpp b/toolsrc/src/vcpkg-test/commands.create.cpp index 4d8b2fd5098f0a..0cc93bd57652fb 100644 --- a/toolsrc/src/vcpkg-test/commands.create.cpp +++ b/toolsrc/src/vcpkg-test/commands.create.cpp @@ -2,7 +2,7 @@ #include -#include +#include #include #include diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 40ccb1668470ee..2bfa3f5085eda3 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -8,7 +8,9 @@ #include #include +#include #include +#include #include #include #include diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index bcd0a7f89c012f..83d5964737f3f0 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/toolsrc/src/vcpkg/commands.autocomplete.cpp b/toolsrc/src/vcpkg/commands.autocomplete.cpp index 17d38f395f87ac..05499988d14c6f 100644 --- a/toolsrc/src/vcpkg/commands.autocomplete.cpp +++ b/toolsrc/src/vcpkg/commands.autocomplete.cpp @@ -2,7 +2,10 @@ #include -#include +#include +#include +#include +#include #include #include #include diff --git a/toolsrc/src/vcpkg/commands.buildexternal.cpp b/toolsrc/src/vcpkg/commands.buildexternal.cpp index 79a8dd3c4b6895..ccd477a076bff6 100644 --- a/toolsrc/src/vcpkg/commands.buildexternal.cpp +++ b/toolsrc/src/vcpkg/commands.buildexternal.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include diff --git a/toolsrc/src/vcpkg/commands.cache.cpp b/toolsrc/src/vcpkg/commands.cache.cpp index e7802498c703f5..70d88bcd3ab81a 100644 --- a/toolsrc/src/vcpkg/commands.cache.cpp +++ b/toolsrc/src/vcpkg/commands.cache.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include diff --git a/toolsrc/src/vcpkg/commands.ci.cpp b/toolsrc/src/vcpkg/commands.ci.cpp index 50336a4c183d24..92f25c80697383 100644 --- a/toolsrc/src/vcpkg/commands.ci.cpp +++ b/toolsrc/src/vcpkg/commands.ci.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include #include diff --git a/toolsrc/src/vcpkg/commands.ciclean.cpp b/toolsrc/src/vcpkg/commands.ciclean.cpp index 980e17da8f4a7b..3152be7d9b3dae 100644 --- a/toolsrc/src/vcpkg/commands.ciclean.cpp +++ b/toolsrc/src/vcpkg/commands.ciclean.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include using namespace vcpkg; diff --git a/toolsrc/src/vcpkg/commands.contact.cpp b/toolsrc/src/vcpkg/commands.contact.cpp index ce83fab80eff00..14e78c92bf2951 100644 --- a/toolsrc/src/vcpkg/commands.contact.cpp +++ b/toolsrc/src/vcpkg/commands.contact.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include diff --git a/toolsrc/src/vcpkg/commands.cpp b/toolsrc/src/vcpkg/commands.cpp index be6d553047c20b..f8b67de7456d52 100644 --- a/toolsrc/src/vcpkg/commands.cpp +++ b/toolsrc/src/vcpkg/commands.cpp @@ -1,10 +1,32 @@ #include "pch.h" -#include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -64,53 +86,3 @@ namespace vcpkg::Commands return t; } } - -namespace vcpkg::Commands::Fetch -{ - const CommandStructure COMMAND_STRUCTURE = { - Strings::format("The argument should be tool name\n%s", create_example_string("fetch cmake")), - 1, - 1, - {}, - nullptr, - }; - - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) - { - Util::unused(args.parse_arguments(COMMAND_STRUCTURE)); - - const std::string tool = args.command_arguments[0]; - const fs::path tool_path = paths.get_tool_exe(tool); - System::print2(tool_path.u8string(), '\n'); - Checks::exit_success(VCPKG_LINE_INFO); - } -} - -namespace vcpkg::Commands::Hash -{ - const CommandStructure COMMAND_STRUCTURE = { - Strings::format("The argument should be a file path\n%s", create_example_string("hash boost_1_62_0.tar.bz2")), - 1, - 2, - {}, - nullptr, - }; - - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) - { - Util::unused(args.parse_arguments(COMMAND_STRUCTURE)); - - const fs::path file_to_hash = args.command_arguments[0]; - - auto algorithm = vcpkg::Hash::Algorithm::Sha512; - if (args.command_arguments.size() == 2) - { - algorithm = vcpkg::Hash::algorithm_from_string(args.command_arguments[1]).value_or_exit(VCPKG_LINE_INFO); - } - - const std::string hash = - vcpkg::Hash::get_file_hash(VCPKG_LINE_INFO, paths.get_filesystem(), file_to_hash, algorithm); - System::print2(hash, '\n'); - Checks::exit_success(VCPKG_LINE_INFO); - } -} diff --git a/toolsrc/src/vcpkg/commands.create.cpp b/toolsrc/src/vcpkg/commands.create.cpp index 83d2e109d5dffa..9ea265f2971158 100644 --- a/toolsrc/src/vcpkg/commands.create.cpp +++ b/toolsrc/src/vcpkg/commands.create.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include namespace vcpkg::Commands::Create diff --git a/toolsrc/src/vcpkg/commands.dependinfo.cpp b/toolsrc/src/vcpkg/commands.dependinfo.cpp index ba6da1aa3fbde7..e1cf0643f9a271 100644 --- a/toolsrc/src/vcpkg/commands.dependinfo.cpp +++ b/toolsrc/src/vcpkg/commands.dependinfo.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include #include diff --git a/toolsrc/src/vcpkg/commands.edit.cpp b/toolsrc/src/vcpkg/commands.edit.cpp index a433af8ecf8feb..32d0723b1293f9 100644 --- a/toolsrc/src/vcpkg/commands.edit.cpp +++ b/toolsrc/src/vcpkg/commands.edit.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include diff --git a/toolsrc/src/vcpkg/commands.env.cpp b/toolsrc/src/vcpkg/commands.env.cpp index bcde9916671c1d..204bbd622c568c 100644 --- a/toolsrc/src/vcpkg/commands.env.cpp +++ b/toolsrc/src/vcpkg/commands.env.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include #include namespace vcpkg::Commands::Env diff --git a/toolsrc/src/vcpkg/commands.fetch.cpp b/toolsrc/src/vcpkg/commands.fetch.cpp new file mode 100644 index 00000000000000..d20db7aac560ac --- /dev/null +++ b/toolsrc/src/vcpkg/commands.fetch.cpp @@ -0,0 +1,24 @@ +#include "pch.h" + +#include + +namespace vcpkg::Commands::Fetch +{ + const CommandStructure COMMAND_STRUCTURE = { + Strings::format("The argument should be tool name\n%s", create_example_string("fetch cmake")), + 1, + 1, + {}, + nullptr, + }; + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) + { + Util::unused(args.parse_arguments(COMMAND_STRUCTURE)); + + const std::string tool = args.command_arguments[0]; + const fs::path tool_path = paths.get_tool_exe(tool); + System::print2(tool_path.u8string(), '\n'); + Checks::exit_success(VCPKG_LINE_INFO); + } +} diff --git a/toolsrc/src/vcpkg/commands.format-manifest.cpp b/toolsrc/src/vcpkg/commands.format-manifest.cpp index f234722457b286..4cbe964d62bdeb 100644 --- a/toolsrc/src/vcpkg/commands.format-manifest.cpp +++ b/toolsrc/src/vcpkg/commands.format-manifest.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include #include namespace vcpkg::Commands::FormatManifest diff --git a/toolsrc/src/vcpkg/commands.hash.cpp b/toolsrc/src/vcpkg/commands.hash.cpp new file mode 100644 index 00000000000000..c43c5a6b4df645 --- /dev/null +++ b/toolsrc/src/vcpkg/commands.hash.cpp @@ -0,0 +1,34 @@ +#include "pch.h" + +#include + +#include + +namespace vcpkg::Commands::Hash +{ + const CommandStructure COMMAND_STRUCTURE = { + Strings::format("The argument should be a file path\n%s", create_example_string("hash boost_1_62_0.tar.bz2")), + 1, + 2, + {}, + nullptr, + }; + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) + { + Util::unused(args.parse_arguments(COMMAND_STRUCTURE)); + + const fs::path file_to_hash = args.command_arguments[0]; + + auto algorithm = vcpkg::Hash::Algorithm::Sha512; + if (args.command_arguments.size() == 2) + { + algorithm = vcpkg::Hash::algorithm_from_string(args.command_arguments[1]).value_or_exit(VCPKG_LINE_INFO); + } + + const std::string hash = + vcpkg::Hash::get_file_hash(VCPKG_LINE_INFO, paths.get_filesystem(), file_to_hash, algorithm); + System::print2(hash, '\n'); + Checks::exit_success(VCPKG_LINE_INFO); + } +} diff --git a/toolsrc/src/vcpkg/commands.integrate.cpp b/toolsrc/src/vcpkg/commands.integrate.cpp index a7ef5a012226c3..5a9b4b594e5d27 100644 --- a/toolsrc/src/vcpkg/commands.integrate.cpp +++ b/toolsrc/src/vcpkg/commands.integrate.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include @@ -16,10 +16,10 @@ namespace vcpkg::Commands::Integrate #if defined(_WIN32) static std::string create_appdata_shortcut(const std::string& target_path) noexcept { - return Strings::format(R"###( - - - + return Strings::format(R"###( + + + )###", target_path, target_path); @@ -29,15 +29,15 @@ namespace vcpkg::Commands::Integrate #if defined(_WIN32) static std::string create_system_targets_shortcut() noexcept { - return R"###( - - - - $(LOCALAPPDATA)\vcpkg\vcpkg.user - - - - + return R"###( + + + + $(LOCALAPPDATA)\vcpkg\vcpkg.user + + + + )###"; } #endif @@ -47,13 +47,13 @@ namespace vcpkg::Commands::Integrate { const std::string as_string = msbuild_vcpkg_targets_file.string(); - return Strings::format(R"###( - - - - - - + return Strings::format(R"###( + + + + + + )###", as_string, as_string); @@ -63,12 +63,12 @@ namespace vcpkg::Commands::Integrate #if defined(_WIN32) static std::string create_nuget_props_file_contents() noexcept { - return R"###( - - - true - - + return R"###( + + + true + + )###"; } #endif @@ -93,21 +93,21 @@ namespace vcpkg::Commands::Integrate const std::string& nuget_id, const std::string& nupkg_version) { - static constexpr auto CONTENT_TEMPLATE = R"( - - - @NUGET_ID@ - @VERSION@ - vcpkg - - This package imports all libraries currently installed in @VCPKG_DIR@. This package does not contain any libraries and instead refers to the folder directly (like a symlink). - - - - - - - + static constexpr auto CONTENT_TEMPLATE = R"( + + + @NUGET_ID@ + @VERSION@ + vcpkg + + This package imports all libraries currently installed in @VCPKG_DIR@. This package does not contain any libraries and instead refers to the folder directly (like a symlink). + + + + + + + )"; std::string content = Strings::replace_all(CONTENT_TEMPLATE, "@NUGET_ID@", nuget_id); @@ -301,18 +301,18 @@ namespace vcpkg::Commands::Integrate const fs::path cmake_toolchain = paths.buildsystems / "vcpkg.cmake"; #if defined(_WIN32) System::printf( - R"( -All MSBuild C++ projects can now #include any installed libraries. -Linking will be handled automatically. -Installing new libraries will make them instantly available. - -CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=%s" + R"( +All MSBuild C++ projects can now #include any installed libraries. +Linking will be handled automatically. +Installing new libraries will make them instantly available. + +CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=%s" )", cmake_toolchain.generic_u8string()); #else System::printf( - R"( -CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=%s" + R"( +CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=%s" )", cmake_toolchain.generic_u8string()); #endif @@ -394,10 +394,10 @@ CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=%s" auto source_path = buildsystems_dir.u8string(); source_path = Strings::replace_all(std::move(source_path), "`", "``"); - System::printf(R"( -With a project open, go to Tools->NuGet Package Manager->Package Manager Console and paste: - Install-Package %s -Source "%s" - + System::printf(R"( +With a project open, go to Tools->NuGet Package Manager->Package Manager Console and paste: + Install-Package %s -Source "%s" + )", nuget_id, source_path); diff --git a/toolsrc/src/vcpkg/commands.list.cpp b/toolsrc/src/vcpkg/commands.list.cpp index f65ba9497974ae..006dfb040b8f8e 100644 --- a/toolsrc/src/vcpkg/commands.list.cpp +++ b/toolsrc/src/vcpkg/commands.list.cpp @@ -2,7 +2,7 @@ #include -#include +#include #include #include #include diff --git a/toolsrc/src/vcpkg/commands.owns.cpp b/toolsrc/src/vcpkg/commands.owns.cpp index a71a56ed30153e..839298eb8b6979 100644 --- a/toolsrc/src/vcpkg/commands.owns.cpp +++ b/toolsrc/src/vcpkg/commands.owns.cpp @@ -2,7 +2,7 @@ #include -#include +#include #include #include diff --git a/toolsrc/src/vcpkg/commands.porthistory.cpp b/toolsrc/src/vcpkg/commands.porthistory.cpp index b1bf29f5f3e0b7..1fdbc8287dd360 100644 --- a/toolsrc/src/vcpkg/commands.porthistory.cpp +++ b/toolsrc/src/vcpkg/commands.porthistory.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include namespace vcpkg::Commands::PortHistory diff --git a/toolsrc/src/vcpkg/commands.portsdiff.cpp b/toolsrc/src/vcpkg/commands.portsdiff.cpp index 94c6e490b410cd..a4547323ebc402 100644 --- a/toolsrc/src/vcpkg/commands.portsdiff.cpp +++ b/toolsrc/src/vcpkg/commands.portsdiff.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include #include diff --git a/toolsrc/src/vcpkg/commands.search.cpp b/toolsrc/src/vcpkg/commands.search.cpp index b78420b4db2ccf..5c9070ca483140 100644 --- a/toolsrc/src/vcpkg/commands.search.cpp +++ b/toolsrc/src/vcpkg/commands.search.cpp @@ -2,7 +2,7 @@ #include -#include +#include #include #include #include diff --git a/toolsrc/src/vcpkg/commands.setinstalled.cpp b/toolsrc/src/vcpkg/commands.setinstalled.cpp index 82e1c763f14f9a..2c42ff6a3361e6 100644 --- a/toolsrc/src/vcpkg/commands.setinstalled.cpp +++ b/toolsrc/src/vcpkg/commands.setinstalled.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include #include diff --git a/toolsrc/src/vcpkg/commands.upgrade.cpp b/toolsrc/src/vcpkg/commands.upgrade.cpp index 25fb0de9895aac..3092f0bbae0cde 100644 --- a/toolsrc/src/vcpkg/commands.upgrade.cpp +++ b/toolsrc/src/vcpkg/commands.upgrade.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include #include diff --git a/toolsrc/src/vcpkg/commands.version.cpp b/toolsrc/src/vcpkg/commands.version.cpp index 273b4f10a64e20..fab43e116db082 100644 --- a/toolsrc/src/vcpkg/commands.version.cpp +++ b/toolsrc/src/vcpkg/commands.version.cpp @@ -2,7 +2,7 @@ #include -#include +#include #include #include diff --git a/toolsrc/src/vcpkg/commands.xvsinstances.cpp b/toolsrc/src/vcpkg/commands.xvsinstances.cpp index 718c73ec015604..279f596742d8ca 100644 --- a/toolsrc/src/vcpkg/commands.xvsinstances.cpp +++ b/toolsrc/src/vcpkg/commands.xvsinstances.cpp @@ -2,7 +2,7 @@ #include -#include +#include #include #include diff --git a/toolsrc/src/vcpkg/commands.exportifw.cpp b/toolsrc/src/vcpkg/export.ifw.cpp similarity index 100% rename from toolsrc/src/vcpkg/commands.exportifw.cpp rename to toolsrc/src/vcpkg/export.ifw.cpp diff --git a/toolsrc/src/vcpkg/help.cpp b/toolsrc/src/vcpkg/help.cpp index d341b32ab790e5..87436e01c97b37 100644 --- a/toolsrc/src/vcpkg/help.cpp +++ b/toolsrc/src/vcpkg/help.cpp @@ -3,7 +3,14 @@ #include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include diff --git a/toolsrc/src/vcpkg/install.cpp b/toolsrc/src/vcpkg/install.cpp index da4248c39e1953..51682e18bfeeda 100644 --- a/toolsrc/src/vcpkg/install.cpp +++ b/toolsrc/src/vcpkg/install.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/toolsrc/src/vcpkg/metrics.cpp b/toolsrc/src/vcpkg/metrics.cpp index f348e32c0fb8ce..7ce4646e21e3b9 100644 --- a/toolsrc/src/vcpkg/metrics.cpp +++ b/toolsrc/src/vcpkg/metrics.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #if defined(_WIN32) diff --git a/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp b/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp index 280faae0d80f19..40782cc61a0568 100644 --- a/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp +++ b/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include #include diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index b955e435783794..c0adbd3a0198a4 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -180,6 +180,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -253,8 +277,9 @@ - + + @@ -268,6 +293,7 @@ + diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters index 5c5beb540527a4..f13461b6b7e5d0 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters @@ -69,12 +69,15 @@ Source Files\vcpkg - + Source Files\vcpkg Source Files\vcpkg + + Source Files\vcpkg + Source Files\vcpkg @@ -105,6 +108,9 @@ Source Files\vcpkg + + Source Files\vcpkg + Source Files\vcpkg @@ -311,6 +317,78 @@ Header Files\vcpkg + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + + + Header Files\vcpkg + Header Files\vcpkg