diff options
| author | nicole mazzuca <mazzucan@outlook.com> | 2020-07-31 11:53:42 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-31 11:53:42 -0700 |
| commit | 56fffbe49dfb4dd8fae0940f272c5fd2b86be991 (patch) | |
| tree | 089a1e7d10c178d5f5aa916bd7127304b6aa9378 /toolsrc/include | |
| parent | 37f7d69757d7e52e21a391710fdbd3ef17f2540a (diff) | |
| download | vcpkg-56fffbe49dfb4dd8fae0940f272c5fd2b86be991.tar.gz vcpkg-56fffbe49dfb4dd8fae0940f272c5fd2b86be991.zip | |
[vcpkg] Refactor Commands: Part 1 (#12585)
* Rename commands.exportifw.cpp -> export.ifw.cpp
* move DryRun from commands.h -> commands.interface.h
* move vcpkgcmdarguments and vcpkgpaths over to commands.interface.h
* move vcpkg::Commands::BuildExternal -> commands.buildexternal.h
* add commands.*.h for the commands.*.cpp
* move vcpkg::Commands::* to commands.*.h
* move vcpkg::Commands::{Hash,Fetch} to their own files
* change include commands.h -> commands.*.h in commands.*.cpp
* remove commands.*.h from commands.h
* join vcpkg::Commands::* into one namespace line
* fix vcxproj build
Diffstat (limited to 'toolsrc/include')
25 files changed, 234 insertions, 154 deletions
diff --git a/toolsrc/include/vcpkg/commands.autocomplete.h b/toolsrc/include/vcpkg/commands.autocomplete.h new file mode 100644 index 000000000..52998b110 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.autocomplete.h @@ -0,0 +1,8 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 000000000..1e3da99db --- /dev/null +++ b/toolsrc/include/vcpkg/commands.buildexternal.h @@ -0,0 +1,8 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 000000000..0f48c4eb7 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.cache.h @@ -0,0 +1,8 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 000000000..e153c1fde --- /dev/null +++ b/toolsrc/include/vcpkg/commands.ci.h @@ -0,0 +1,9 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 000000000..bf5c3a736 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.ciclean.h @@ -0,0 +1,8 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 000000000..079d68626 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.contact.h @@ -0,0 +1,10 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 000000000..5a6a70889 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.create.h @@ -0,0 +1,10 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 000000000..573cf297a --- /dev/null +++ b/toolsrc/include/vcpkg/commands.dependinfo.h @@ -0,0 +1,9 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 000000000..f1a2109cf --- /dev/null +++ b/toolsrc/include/vcpkg/commands.edit.h @@ -0,0 +1,9 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 000000000..69ff543d2 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.env.h @@ -0,0 +1,9 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 000000000..08d4f4351 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.fetch.h @@ -0,0 +1,8 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 000000000..20e126846 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.format-manifest.h @@ -0,0 +1,9 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 cec9237f5..3a682b091 100644 --- a/toolsrc/include/vcpkg/commands.h +++ b/toolsrc/include/vcpkg/commands.h @@ -1,10 +1,9 @@ #pragma once #include <vcpkg/build.h> +#include <vcpkg/commands.interface.h> #include <vcpkg/dependencies.h> #include <vcpkg/statusparagraphs.h> -#include <vcpkg/vcpkgcmdarguments.h> -#include <vcpkg/vcpkgpaths.h> #include <array> #include <map> @@ -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<FullPackageSpec>& specs, - const Build::BuildPackageOptions& install_plan_options, - DryRun dry_run, - const Optional<fs::path>& pkgsconfig_path); - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet); - } - template<class T> struct PackageNameAndFunction { diff --git a/toolsrc/include/vcpkg/commands.hash.h b/toolsrc/include/vcpkg/commands.hash.h new file mode 100644 index 000000000..8cb42ff30 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.hash.h @@ -0,0 +1,8 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 000000000..a8ca5026b --- /dev/null +++ b/toolsrc/include/vcpkg/commands.integrate.h @@ -0,0 +1,12 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 000000000..96745a2fb --- /dev/null +++ b/toolsrc/include/vcpkg/commands.interface.h @@ -0,0 +1,13 @@ +#pragma once + +#include <vcpkg/vcpkgcmdarguments.h> +#include <vcpkg/vcpkgpaths.h> + +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 000000000..65c22ef9e --- /dev/null +++ b/toolsrc/include/vcpkg/commands.list.h @@ -0,0 +1,9 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 000000000..a46e2bd4e --- /dev/null +++ b/toolsrc/include/vcpkg/commands.owns.h @@ -0,0 +1,9 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 000000000..ee03be206 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.porthistory.h @@ -0,0 +1,8 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 000000000..efa387710 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.portsdiff.h @@ -0,0 +1,8 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 000000000..81c039856 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.search.h @@ -0,0 +1,9 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 000000000..88065be1c --- /dev/null +++ b/toolsrc/include/vcpkg/commands.setinstalled.h @@ -0,0 +1,20 @@ +#pragma once + +#include <vcpkg/cmakevars.h> +#include <vcpkg/commands.interface.h> +#include <vcpkg/portfileprovider.h> + +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<FullPackageSpec>& specs, + const Build::BuildPackageOptions& install_plan_options, + DryRun dry_run, + const Optional<fs::path>& 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 000000000..5e6047c13 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.upgrade.h @@ -0,0 +1,9 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 000000000..1af134b04 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.version.h @@ -0,0 +1,11 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +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 000000000..0ffa67a50 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.xvsinstances.h @@ -0,0 +1,12 @@ +#pragma once + +#include <vcpkg/commands.interface.h> + +namespace vcpkg::Commands +{ + namespace X_VSInstances + { + extern const CommandStructure COMMAND_STRUCTURE; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } +} |
