From 0b5e2e9e76e66b566cf4d3f68146fdbdff2bac05 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 5 Jan 2017 12:47:08 -0800 Subject: Use nested namespace definition --- toolsrc/include/vcpkg_Checks.h | 4 ++-- toolsrc/include/vcpkg_Files.h | 4 ++-- toolsrc/include/vcpkg_Graphs.h | 4 ++-- toolsrc/include/vcpkg_Maps.h | 4 ++-- toolsrc/include/vcpkg_Sets.h | 4 ++-- toolsrc/include/vcpkg_Strings.h | 8 ++++---- toolsrc/include/vcpkg_System.h | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Checks.h b/toolsrc/include/vcpkg_Checks.h index 9d9b21ed6..a58b38ac0 100644 --- a/toolsrc/include/vcpkg_Checks.h +++ b/toolsrc/include/vcpkg_Checks.h @@ -2,7 +2,7 @@ #include "vcpkg_Strings.h" -namespace vcpkg {namespace Checks +namespace vcpkg::Checks { __declspec(noreturn) void unreachable(); @@ -46,4 +46,4 @@ namespace vcpkg {namespace Checks exit_with_message(Strings::format(errorMessageTemplate, errorMessageArgs...).c_str()); } } -}} +} diff --git a/toolsrc/include/vcpkg_Files.h b/toolsrc/include/vcpkg_Files.h index 6c9d0d365..3f9570946 100644 --- a/toolsrc/include/vcpkg_Files.h +++ b/toolsrc/include/vcpkg_Files.h @@ -4,7 +4,7 @@ #include "filesystem_fs.h" #include -namespace vcpkg {namespace Files +namespace vcpkg::Files { static const char* FILESYSTEM_INVALID_CHARACTERS = R"(\/:*?"<>|)"; @@ -53,4 +53,4 @@ namespace vcpkg {namespace Files std::vector non_recursive_find_all_files_in_dir(const fs::path& dir); void print_paths(const std::vector& paths); -}} +} diff --git a/toolsrc/include/vcpkg_Graphs.h b/toolsrc/include/vcpkg_Graphs.h index 9444ac45b..933d9ac67 100644 --- a/toolsrc/include/vcpkg_Graphs.h +++ b/toolsrc/include/vcpkg_Graphs.h @@ -3,7 +3,7 @@ #include #include -namespace vcpkg { namespace Graphs +namespace vcpkg::Graphs { enum class ExplorationStatus { @@ -117,4 +117,4 @@ namespace vcpkg { namespace Graphs private: std::unordered_map> vertices; }; -}} +} diff --git a/toolsrc/include/vcpkg_Maps.h b/toolsrc/include/vcpkg_Maps.h index c67462a39..5e2f92f55 100644 --- a/toolsrc/include/vcpkg_Maps.h +++ b/toolsrc/include/vcpkg_Maps.h @@ -4,7 +4,7 @@ #include #include -namespace vcpkg { namespace Maps +namespace vcpkg::Maps { template std::unordered_set extract_key_set(const std::unordered_map& input_map) @@ -38,4 +38,4 @@ namespace vcpkg { namespace Maps } return key_set; } -}} +} diff --git a/toolsrc/include/vcpkg_Sets.h b/toolsrc/include/vcpkg_Sets.h index 7b330f31c..6dec95b89 100644 --- a/toolsrc/include/vcpkg_Sets.h +++ b/toolsrc/include/vcpkg_Sets.h @@ -3,7 +3,7 @@ #include "vcpkg_Checks.h" #include -namespace vcpkg { namespace Sets +namespace vcpkg::Sets { template void remove_all(std::unordered_set* input_set, Container remove_these) @@ -14,4 +14,4 @@ namespace vcpkg { namespace Sets input_set->erase(r); } } -}} +} diff --git a/toolsrc/include/vcpkg_Strings.h b/toolsrc/include/vcpkg_Strings.h index a117a1a81..28853cb5d 100644 --- a/toolsrc/include/vcpkg_Strings.h +++ b/toolsrc/include/vcpkg_Strings.h @@ -2,7 +2,7 @@ #include -namespace vcpkg {namespace Strings {namespace details +namespace vcpkg::Strings::details { inline const char* to_printf_arg(const std::string& s) { @@ -42,9 +42,9 @@ namespace vcpkg {namespace Strings {namespace details } std::wstring wformat_internal(const wchar_t* fmtstr, ...); -}}} +} -namespace vcpkg {namespace Strings +namespace vcpkg::Strings { template std::string format(const char* fmtstr, const Args&...args) @@ -75,4 +75,4 @@ namespace vcpkg {namespace Strings std::string trimmed(const std::string& s); void trim_all_and_remove_whitespace_strings(std::vector* strings); -}} +} diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h index 1101c9b27..c9195163c 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg_System.h @@ -3,7 +3,7 @@ #include "vcpkg_Strings.h" #include "filesystem_fs.h" -namespace vcpkg {namespace System +namespace vcpkg::System { fs::path get_exe_path_of_current_process(); @@ -93,4 +93,4 @@ namespace vcpkg {namespace System }; std::wstring wdupenv_str(const wchar_t* varname) noexcept; -}} +} -- cgit v1.2.3 From 88b5791b0bcaa9cce7f488bbd03042aa65e4417e Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 5 Jan 2017 14:14:11 -0800 Subject: Use Nested Namespace Definition --- toolsrc/include/coff_file_reader.h | 4 ++-- toolsrc/include/post_build_lint.h | 4 ++-- toolsrc/include/vcpkg_Dependencies.h | 4 ++-- toolsrc/include/vcpkg_Environment.h | 4 ++-- toolsrc/include/vcpkg_Input.h | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/coff_file_reader.h b/toolsrc/include/coff_file_reader.h index edf6910a5..24fbf4576 100644 --- a/toolsrc/include/coff_file_reader.h +++ b/toolsrc/include/coff_file_reader.h @@ -3,7 +3,7 @@ #include "MachineType.h" #include "filesystem_fs.h" -namespace vcpkg {namespace COFFFileReader +namespace vcpkg::COFFFileReader { struct dll_info { @@ -18,4 +18,4 @@ namespace vcpkg {namespace COFFFileReader dll_info read_dll(const fs::path& path); lib_info read_lib(const fs::path& path); -}} +} diff --git a/toolsrc/include/post_build_lint.h b/toolsrc/include/post_build_lint.h index a5fb9149f..215a237aa 100644 --- a/toolsrc/include/post_build_lint.h +++ b/toolsrc/include/post_build_lint.h @@ -2,7 +2,7 @@ #include "package_spec.h" #include "vcpkg_paths.h" -namespace vcpkg {namespace PostBuildLint +namespace vcpkg::PostBuildLint { void perform_all_checks(const package_spec& spec, const vcpkg_paths& paths); -}} +} diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h index 3616e6be9..4da9de694 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -4,7 +4,7 @@ #include "StatusParagraphs.h" #include "vcpkg_paths.h" -namespace vcpkg {namespace Dependencies +namespace vcpkg::Dependencies { enum class install_plan_type { @@ -27,4 +27,4 @@ namespace vcpkg {namespace Dependencies }; std::vector create_install_plan(const vcpkg_paths& paths, const std::vector& specs, const StatusParagraphs& status_db); -}} +} diff --git a/toolsrc/include/vcpkg_Environment.h b/toolsrc/include/vcpkg_Environment.h index 877ac7deb..1e8624d89 100644 --- a/toolsrc/include/vcpkg_Environment.h +++ b/toolsrc/include/vcpkg_Environment.h @@ -1,7 +1,7 @@ #pragma once #include "vcpkg_paths.h" -namespace vcpkg {namespace Environment +namespace vcpkg::Environment { void ensure_nuget_on_path(const vcpkg_paths& paths); @@ -14,4 +14,4 @@ namespace vcpkg {namespace Environment ensure_cmake_on_path(paths); ensure_git_on_path(paths); } -}} +} diff --git a/toolsrc/include/vcpkg_Input.h b/toolsrc/include/vcpkg_Input.h index 5ce90e3b9..3cce334c4 100644 --- a/toolsrc/include/vcpkg_Input.h +++ b/toolsrc/include/vcpkg_Input.h @@ -3,7 +3,7 @@ #include "package_spec.h" #include "vcpkg_paths.h" -namespace vcpkg {namespace Input +namespace vcpkg::Input { package_spec check_and_get_package_spec(const std::string& package_spec_as_string, const triplet& default_target_triplet, const std::string& example_text); @@ -12,4 +12,4 @@ namespace vcpkg {namespace Input void check_triplet(const triplet& t, const vcpkg_paths& paths); void check_triplets(std::vector triplets, const vcpkg_paths& paths); -}} +} -- cgit v1.2.3 From 6e29b7b8d4b3a21e46a721f79d184213d1c874a4 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 5 Jan 2017 14:21:09 -0800 Subject: Pass by reference --- toolsrc/include/vcpkg_Input.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Input.h b/toolsrc/include/vcpkg_Input.h index 3cce334c4..96cbeecc3 100644 --- a/toolsrc/include/vcpkg_Input.h +++ b/toolsrc/include/vcpkg_Input.h @@ -11,5 +11,5 @@ namespace vcpkg::Input void check_triplet(const triplet& t, const vcpkg_paths& paths); - void check_triplets(std::vector triplets, const vcpkg_paths& paths); + void check_triplets(const std::vector& triplets, const vcpkg_paths& paths); } -- cgit v1.2.3 From 708e93d82acd4da9c651cc7043dfd32a182ecc11 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 5 Jan 2017 14:25:50 -0800 Subject: Use Nested Namespace Definition --- toolsrc/include/BuildInfo.h | 4 ++-- toolsrc/include/Paragraphs.h | 4 ++-- toolsrc/include/vcpkg_info.h | 4 ++-- toolsrc/include/vcpkglib_helpers.h | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/BuildInfo.h b/toolsrc/include/BuildInfo.h index 49811d521..c90ad7a4e 100644 --- a/toolsrc/include/BuildInfo.h +++ b/toolsrc/include/BuildInfo.h @@ -4,7 +4,7 @@ #include "Paragraphs.h" #include -namespace vcpkg { namespace PostBuildLint +namespace vcpkg::PostBuildLint { enum class LinkageType { @@ -126,4 +126,4 @@ namespace vcpkg { namespace PostBuildLint }; BuildInfo read_build_info(const fs::path& filepath); -}} +} diff --git a/toolsrc/include/Paragraphs.h b/toolsrc/include/Paragraphs.h index 9e9fafe49..761b49759 100644 --- a/toolsrc/include/Paragraphs.h +++ b/toolsrc/include/Paragraphs.h @@ -3,8 +3,8 @@ #include "filesystem_fs.h" #include -namespace vcpkg { namespace Paragraphs +namespace vcpkg::Paragraphs { std::vector> get_paragraphs(const fs::path& control_path); std::vector> parse_paragraphs(const std::string& str); -}} +} diff --git a/toolsrc/include/vcpkg_info.h b/toolsrc/include/vcpkg_info.h index 01da06307..5380e0158 100644 --- a/toolsrc/include/vcpkg_info.h +++ b/toolsrc/include/vcpkg_info.h @@ -2,9 +2,9 @@ #include -namespace vcpkg { namespace Info +namespace vcpkg::Info { const std::string& version(); const std::string& email(); -}} +} diff --git a/toolsrc/include/vcpkglib_helpers.h b/toolsrc/include/vcpkglib_helpers.h index 019bb8c39..8a08513f3 100644 --- a/toolsrc/include/vcpkglib_helpers.h +++ b/toolsrc/include/vcpkglib_helpers.h @@ -2,7 +2,7 @@ #include -namespace vcpkg {namespace details +namespace vcpkg::details { std::string optional_field(const std::unordered_map& fields, const std::string& fieldname); std::string remove_optional_field(std::unordered_map* fields, const std::string& fieldname); @@ -11,4 +11,4 @@ namespace vcpkg {namespace details std::string remove_required_field(std::unordered_map* fields, const std::string& fieldname); std::string shorten_description(const std::string& desc); -}} +} -- cgit v1.2.3 From e5f60816cb6a786aa828aa2845522bb81c02cbe6 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 22 Dec 2016 16:43:47 -0800 Subject: Introduce ImmutableSortedVector --- toolsrc/include/ImmutableSortedVector.h | 48 +++++++++++++++++++++++++++++++++ toolsrc/include/vcpkg.h | 3 ++- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 toolsrc/include/ImmutableSortedVector.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/ImmutableSortedVector.h b/toolsrc/include/ImmutableSortedVector.h new file mode 100644 index 000000000..681f9fd4d --- /dev/null +++ b/toolsrc/include/ImmutableSortedVector.h @@ -0,0 +1,48 @@ +#pragma once + +#include +#include + +// Add more forwarding functions to the delegate std::vector as needed. +namespace vcpkg +{ + template + class ImmutableSortedVector + { + public: + static ImmutableSortedVector create(std::vector vector) + { + ImmutableSortedVector out; + out.delegate = std::move(vector); + if (!std::is_sorted(out.delegate.cbegin(), out.delegate.cend())) + { + std::sort(out.delegate.begin(), out.delegate.end()); + } + + return out; + } + + typename std::vector::const_iterator begin() const + { + return this->delegate.cbegin(); + } + + typename std::vector::const_iterator end() const + { + return this->delegate.cend(); + } + + typename std::vector::const_iterator cbegin() const + { + return this->delegate.cbegin(); + } + + typename std::vector::const_iterator cend() const + { + return this->delegate.cend(); + } + + private: + std::vector delegate; + }; +} diff --git a/toolsrc/include/vcpkg.h b/toolsrc/include/vcpkg.h index 75dc40b43..b1653d197 100644 --- a/toolsrc/include/vcpkg.h +++ b/toolsrc/include/vcpkg.h @@ -4,6 +4,7 @@ #include "BinaryParagraph.h" #include "StatusParagraphs.h" #include "vcpkg_paths.h" +#include "ImmutableSortedVector.h" namespace vcpkg { @@ -14,7 +15,7 @@ namespace vcpkg struct StatusParagraph_and_associated_files { StatusParagraph pgh; - std::vector files; + ImmutableSortedVector files; }; std::vector get_installed_files(const vcpkg_paths& paths, const StatusParagraphs& status_db); -- cgit v1.2.3 From 6a4ec92a90849e7cc343bbc8673ce0f063ffd939 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 12 Jan 2017 17:03:21 -0800 Subject: Place build & build_external commands into separate files --- toolsrc/include/vcpkg_Commands.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index fd427fd40..213d31ada 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -5,6 +5,12 @@ namespace vcpkg { + // + namespace Commands::details + { + void build_internal(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir); + } + extern const char*const INTEGRATE_COMMAND_HELPSTRING; void print_usage(); -- cgit v1.2.3 From df2a05e8546281135c6ea12430734d74371bcf46 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 12 Jan 2017 17:35:33 -0800 Subject: Introduce Command namespace. Refactoring --- toolsrc/include/vcpkg_Commands.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 213d31ada..6b4941cc1 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -3,21 +3,17 @@ #include "vcpkg_cmd_arguments.h" #include "vcpkg_paths.h" -namespace vcpkg +namespace vcpkg::Commands { - // - namespace Commands::details - { - void build_internal(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir); - } - extern const char*const INTEGRATE_COMMAND_HELPSTRING; - void print_usage(); - void print_example(const std::string& command_and_arguments); - std::string create_example_string(const std::string& command_and_arguments); + using command_type_a = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); + using command_type_b = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + using command_type_c = void(*)(const vcpkg_cmd_arguments& args); + void update_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + void build_internal(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir); void build_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); void build_external_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); void install_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); @@ -30,7 +26,6 @@ namespace vcpkg void list_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); void import_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); void owns_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); - void internal_test_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); void cache_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); @@ -45,10 +40,6 @@ namespace vcpkg void contact_command(const vcpkg_cmd_arguments& args); void hash_command(const vcpkg_cmd_arguments& args); - using command_type_a = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); - using command_type_b = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); - using command_type_c = void(*)(const vcpkg_cmd_arguments& args); - template struct package_name_and_function { @@ -61,7 +52,7 @@ namespace vcpkg const std::vector>& get_available_commands_type_c(); template - T find_command(const std::string& command_name, const std::vector> available_commands) + T find(const std::string& command_name, const std::vector> available_commands) { for (const package_name_and_function& cmd : available_commands) { @@ -75,3 +66,12 @@ namespace vcpkg return nullptr; } } + +namespace vcpkg::Commands::Helpers +{ + void print_usage(); + + void print_example(const std::string& command_and_arguments); + + std::string create_example_string(const std::string& command_and_arguments); +} -- cgit v1.2.3 From cc8851144a871931b93d84bd962364159ad1c424 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 12 Jan 2017 22:03:57 -0800 Subject: Reorganize commands, each in its own namespace Additionally, functions related to a command can now live in the same namespace --- toolsrc/include/vcpkg_Commands.h | 123 +++++++++++++++++++++++++++++---------- 1 file changed, 92 insertions(+), 31 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 6b4941cc1..8d772b255 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -5,40 +5,110 @@ namespace vcpkg::Commands { - extern const char*const INTEGRATE_COMMAND_HELPSTRING; - using command_type_a = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); using command_type_b = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); using command_type_c = void(*)(const vcpkg_cmd_arguments& args); - void update_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + namespace Build + { + void build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir); + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); + } + + namespace BuildExternal + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); + } + + namespace Install + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); + } + + namespace Remove + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); + } + + namespace Update + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } + + namespace Create + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } + + namespace Edit + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } + + namespace Search + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } + + namespace List + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } + + namespace Import + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } + + namespace Owns + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } + + namespace Cache + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } + + namespace Integrate + { + extern const char*const INTEGRATE_COMMAND_HELPSTRING; + + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } + + namespace PortsDiff + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } - void build_internal(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir); - void build_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); - void build_external_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); - void install_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); - void remove_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); + namespace Help + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); - void edit_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); - void create_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + void help_topic_valid_triplet(const vcpkg_paths& paths); - void search_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); - void list_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); - void import_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); - void owns_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + void print_usage(); - void cache_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + void print_example(const std::string& command_and_arguments); - void integrate_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + std::string create_example_string(const std::string& command_and_arguments); + } - void portsdiff_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + namespace Version + { + void perform_and_exit(const vcpkg_cmd_arguments& args); + } - void help_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); - void help_topic_valid_triplet(const vcpkg_paths& paths); + namespace Contact + { + void perform_and_exit(const vcpkg_cmd_arguments& args); + } - void version_command(const vcpkg_cmd_arguments& args); - void contact_command(const vcpkg_cmd_arguments& args); - void hash_command(const vcpkg_cmd_arguments& args); + namespace Hash + { + void perform_and_exit(const vcpkg_cmd_arguments& args); + } template struct package_name_and_function @@ -66,12 +136,3 @@ namespace vcpkg::Commands return nullptr; } } - -namespace vcpkg::Commands::Helpers -{ - void print_usage(); - - void print_example(const std::string& command_and_arguments); - - std::string create_example_string(const std::string& command_and_arguments); -} -- cgit v1.2.3 From 6d3ab4579d50f74cbe43373fa16ba875a97a8717 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 15:12:43 -0800 Subject: [vcpkg_paths] Add "scripts" entry --- toolsrc/include/vcpkg_paths.h | 1 + 1 file changed, 1 insertion(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_paths.h b/toolsrc/include/vcpkg_paths.h index a2932070d..ba6defb9f 100644 --- a/toolsrc/include/vcpkg_paths.h +++ b/toolsrc/include/vcpkg_paths.h @@ -24,6 +24,7 @@ namespace vcpkg fs::path ports; fs::path installed; fs::path triplets; + fs::path scripts; fs::path buildsystems; fs::path buildsystems_msbuild_targets; -- cgit v1.2.3 From 3a6571a0191df8ff000384937a6254f378ca23cf Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 15:13:12 -0800 Subject: Add Strings::split() function --- toolsrc/include/vcpkg_Strings.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Strings.h b/toolsrc/include/vcpkg_Strings.h index 28853cb5d..cb5d2334c 100644 --- a/toolsrc/include/vcpkg_Strings.h +++ b/toolsrc/include/vcpkg_Strings.h @@ -75,4 +75,6 @@ namespace vcpkg::Strings std::string trimmed(const std::string& s); void trim_all_and_remove_whitespace_strings(std::vector* strings); + + std::vector split(const std::string& s, const std::string& delimiter); } -- cgit v1.2.3 From 79a00367390dd974170b3abb5ad357d3db8ff5e3 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 15:15:26 -0800 Subject: [VS2017] Add function do get dumpbin.exe --- toolsrc/include/vcpkg_Environment.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Environment.h b/toolsrc/include/vcpkg_Environment.h index 1e8624d89..64b2315b9 100644 --- a/toolsrc/include/vcpkg_Environment.h +++ b/toolsrc/include/vcpkg_Environment.h @@ -14,4 +14,6 @@ namespace vcpkg::Environment ensure_cmake_on_path(paths); ensure_git_on_path(paths); } + + const fs::path& get_dumpbin_exe(const vcpkg_paths& paths); } -- cgit v1.2.3 From e0e3f6ac21d074b0c043e9d6a2aff769930f07a7 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 16:15:30 -0800 Subject: [VS2017] Add function to get vcvarsall.bat --- toolsrc/include/vcpkg_Environment.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Environment.h b/toolsrc/include/vcpkg_Environment.h index 64b2315b9..9161f7ce5 100644 --- a/toolsrc/include/vcpkg_Environment.h +++ b/toolsrc/include/vcpkg_Environment.h @@ -16,4 +16,6 @@ namespace vcpkg::Environment } const fs::path& get_dumpbin_exe(const vcpkg_paths& paths); + + const fs::path& get_vcvarsall_bat(const vcpkg_paths& paths); } -- cgit v1.2.3 From 93c3c0648a782b1fa75bae1f200beca6ba871f9a Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 19:25:47 -0800 Subject: [VS2017] Enable building with v141 toolset --- toolsrc/include/vcpkg_Environment.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Environment.h b/toolsrc/include/vcpkg_Environment.h index 9161f7ce5..e4dd47472 100644 --- a/toolsrc/include/vcpkg_Environment.h +++ b/toolsrc/include/vcpkg_Environment.h @@ -17,5 +17,11 @@ namespace vcpkg::Environment const fs::path& get_dumpbin_exe(const vcpkg_paths& paths); - const fs::path& get_vcvarsall_bat(const vcpkg_paths& paths); + struct vcvarsall_and_platform_toolset + { + fs::path path; + std::wstring platform_toolset; + }; + + const vcvarsall_and_platform_toolset& get_vcvarsall_bat(const vcpkg_paths& paths); } -- cgit v1.2.3 From 59be40a100910d1f833cd54762e624b7123965ed Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 25 Jan 2017 19:32:50 -0800 Subject: Rename vcpkg.h/cpp to vcpkglib.h/cpp --- toolsrc/include/vcpkg.h | 31 ------------------------------- toolsrc/include/vcpkglib.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 31 deletions(-) delete mode 100644 toolsrc/include/vcpkg.h create mode 100644 toolsrc/include/vcpkglib.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg.h b/toolsrc/include/vcpkg.h deleted file mode 100644 index b1653d197..000000000 --- a/toolsrc/include/vcpkg.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include "package_spec.h" -#include "BinaryParagraph.h" -#include "StatusParagraphs.h" -#include "vcpkg_paths.h" -#include "ImmutableSortedVector.h" - -namespace vcpkg -{ - StatusParagraphs database_load_check(const vcpkg_paths& paths); - - void write_update(const vcpkg_paths& paths, const StatusParagraph& p); - - struct StatusParagraph_and_associated_files - { - StatusParagraph pgh; - ImmutableSortedVector files; - }; - - std::vector get_installed_files(const vcpkg_paths& paths, const StatusParagraphs& status_db); - - expected try_load_port(const fs::path& control_path); - - inline expected try_load_port(const vcpkg_paths& paths, const std::string& name) - { - return try_load_port(paths.ports / name); - } - - expected try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec); -} // namespace vcpkg diff --git a/toolsrc/include/vcpkglib.h b/toolsrc/include/vcpkglib.h new file mode 100644 index 000000000..b1653d197 --- /dev/null +++ b/toolsrc/include/vcpkglib.h @@ -0,0 +1,31 @@ +#pragma once + +#include "package_spec.h" +#include "BinaryParagraph.h" +#include "StatusParagraphs.h" +#include "vcpkg_paths.h" +#include "ImmutableSortedVector.h" + +namespace vcpkg +{ + StatusParagraphs database_load_check(const vcpkg_paths& paths); + + void write_update(const vcpkg_paths& paths, const StatusParagraph& p); + + struct StatusParagraph_and_associated_files + { + StatusParagraph pgh; + ImmutableSortedVector files; + }; + + std::vector get_installed_files(const vcpkg_paths& paths, const StatusParagraphs& status_db); + + expected try_load_port(const fs::path& control_path); + + inline expected try_load_port(const vcpkg_paths& paths, const std::string& name) + { + return try_load_port(paths.ports / name); + } + + expected try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec); +} // namespace vcpkg -- cgit v1.2.3 From 2a246f26af6771482938d4052e08ce2fdbad92e8 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 25 Jan 2017 19:38:14 -0800 Subject: Change check_throw() to check_exit() --- toolsrc/include/vcpkg_Sets.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Sets.h b/toolsrc/include/vcpkg_Sets.h index 6dec95b89..ec4800864 100644 --- a/toolsrc/include/vcpkg_Sets.h +++ b/toolsrc/include/vcpkg_Sets.h @@ -8,7 +8,7 @@ namespace vcpkg::Sets template void remove_all(std::unordered_set* input_set, Container remove_these) { - Checks::check_throw(input_set != nullptr, "Input set cannot be null"); + Checks::check_exit(input_set != nullptr, "Input set cannot be null"); for (const T& r : remove_these) { input_set->erase(r); -- cgit v1.2.3 From 9502d795bb325669df8e4e3b32f6ca60827813f1 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 26 Jan 2017 14:25:36 -0800 Subject: Move & rename remove_plan_type enum --- toolsrc/include/vcpkg_Dependencies.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h index 4da9de694..1c49ccafd 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -26,5 +26,13 @@ namespace vcpkg::Dependencies install_plan_action plan; }; + enum class remove_plan_type + { + NOT_INSTALLED, + DEPENDENCIES_NOT_SATISFIED, + SHOULD_REMOVE + }; + + std::vector create_install_plan(const vcpkg_paths& paths, const std::vector& specs, const StatusParagraphs& status_db); } -- cgit v1.2.3 From cc81c3de6c74837dc146d7d3de73e4388cfc14dc Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 26 Jan 2017 17:52:54 -0800 Subject: [StatusParagraphs] Replace auto with actual type --- toolsrc/include/StatusParagraphs.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/StatusParagraphs.h b/toolsrc/include/StatusParagraphs.h index 7a0f2177d..11491cf4e 100644 --- a/toolsrc/include/StatusParagraphs.h +++ b/toolsrc/include/StatusParagraphs.h @@ -1,6 +1,7 @@ #pragma once #include "StatusParagraph.h" #include +#include namespace vcpkg { @@ -25,22 +26,22 @@ namespace vcpkg friend std::ostream& operator<<(std::ostream&, const StatusParagraphs&); - auto end() + iterator end() { return paragraphs.rend(); } - auto end() const + const_iterator end() const { return paragraphs.rend(); } - auto begin() + iterator begin() { return paragraphs.rbegin(); } - auto begin() const + const_iterator begin() const { return paragraphs.rbegin(); } -- cgit v1.2.3 From 33b46b1fee70996a23a7860f853e95ef80ff3978 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 26 Jan 2017 17:53:45 -0800 Subject: Create a remove plan. NOT used yet --- toolsrc/include/vcpkg_Dependencies.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h index 1c49ccafd..528abedfb 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -30,9 +30,23 @@ namespace vcpkg::Dependencies { NOT_INSTALLED, DEPENDENCIES_NOT_SATISFIED, - SHOULD_REMOVE + REMOVE, + REMOVE_USER_REQUESTED }; + struct remove_plan_action + { + remove_plan_type type; + std::unique_ptr bpgh; + }; + + struct package_spec_with_remove_plan + { + package_spec spec; + remove_plan_action plan; + }; std::vector create_install_plan(const vcpkg_paths& paths, const std::vector& specs, const StatusParagraphs& status_db); + + std::vector create_remove_plan(const vcpkg_paths& paths, const std::vector& specs, const StatusParagraphs& status_db); } -- cgit v1.2.3 From 050e4a0f7a8156bd862f95c06ea298ab6697e147 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 27 Jan 2017 12:49:09 -0800 Subject: Introduce precompiled headers --- toolsrc/include/pch.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 toolsrc/include/pch.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/pch.h b/toolsrc/include/pch.h new file mode 100644 index 000000000..48aca2b77 --- /dev/null +++ b/toolsrc/include/pch.h @@ -0,0 +1,38 @@ +#pragma once + +#define WIN32_LEAN_AND_MEAN +#define NOMINMAX +#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 \ No newline at end of file -- cgit v1.2.3 From 6f363339d8eb5cd8c7a2dd83787af3a34ff0eb4b Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 27 Jan 2017 14:33:54 -0800 Subject: Reorganize pch.h --- toolsrc/include/pch.h | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/pch.h b/toolsrc/include/pch.h index 48aca2b77..2c8b5b5f7 100644 --- a/toolsrc/include/pch.h +++ b/toolsrc/include/pch.h @@ -7,32 +7,33 @@ #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 -#include -#include -#include -#include -#include +#include +#include +#include -#include -#include \ No newline at end of file +#include +#include -- cgit v1.2.3 From 9da07d4540c0c0bb34fedad649e4e2d5a75bbf09 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 27 Jan 2017 14:37:14 -0800 Subject: Add and to pch.h --- toolsrc/include/pch.h | 3 +++ toolsrc/include/vcpkg_cmd_arguments.h | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/pch.h b/toolsrc/include/pch.h index 2c8b5b5f7..56f24f161 100644 --- a/toolsrc/include/pch.h +++ b/toolsrc/include/pch.h @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -34,6 +35,8 @@ #include #include #include +#include #include #include +#include diff --git a/toolsrc/include/vcpkg_cmd_arguments.h b/toolsrc/include/vcpkg_cmd_arguments.h index 2194e6d2c..8ace98586 100644 --- a/toolsrc/include/vcpkg_cmd_arguments.h +++ b/toolsrc/include/vcpkg_cmd_arguments.h @@ -4,7 +4,6 @@ #include #include #include "opt_bool.h" -#include "vcpkg_paths.h" namespace vcpkg { -- cgit v1.2.3 From 4059d4a6b9f9467ff5c58594f7304eef7ba79664 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 27 Jan 2017 17:28:00 -0800 Subject: [package_spec] Make toString() a member function --- toolsrc/include/package_spec.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/package_spec.h b/toolsrc/include/package_spec.h index 30dfca5c7..01b4377a5 100644 --- a/toolsrc/include/package_spec.h +++ b/toolsrc/include/package_spec.h @@ -18,13 +18,13 @@ namespace vcpkg std::string dir() const; + std::string toString() const; + private: std::string m_name; triplet m_target_triplet; }; - std::string to_string(const package_spec& spec); - std::string to_printf_arg(const package_spec& spec); bool operator==(const package_spec& left, const package_spec& right); -- cgit v1.2.3 From 0f0698dc18ec162666ed92b4ac181e512b439b83 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 27 Jan 2017 20:09:40 -0800 Subject: Introduce Strings::Joiner --- toolsrc/include/vcpkg_Strings.h | 50 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Strings.h b/toolsrc/include/vcpkg_Strings.h index cb5d2334c..8d5d7135b 100644 --- a/toolsrc/include/vcpkg_Strings.h +++ b/toolsrc/include/vcpkg_Strings.h @@ -68,7 +68,55 @@ namespace vcpkg::Strings std::string ascii_to_lowercase(const std::string& input); - std::string join(const std::vector& v, const std::string& delimiter); + template + static std::string join(const std::vector& v, const std::string& prefix, const std::string& delimiter, const std::string& suffix, Transformer transformer) + { + if (v.empty()) + { + return std::string(); + } + + std::string output; + size_t size = v.size(); + + output.append(prefix); + output.append(transformer(v.at(0))); + + for (size_t i = 1; i < size; ++i) + { + output.append(delimiter); + output.append(transformer(v.at(i))); + } + + output.append(suffix); + return output; + } + + static std::string join(const std::vector& v, const std::string& prefix, const std::string& delimiter, const std::string& suffix); + + class Joiner + { + public: + static Joiner on(const std::string& delimiter); + + Joiner& prefix(const std::string& prefix); + Joiner& suffix(const std::string& suffix); + + std::string join(const std::vector& v) const; + + template + std::string join(const std::vector& v, Transformer transformer) const + { + return Strings::join(v, this->m_prefix, this->m_delimiter, this->m_suffix, transformer); + } + + private: + explicit Joiner(const std::string& delimiter); + + std::string m_prefix; + std::string m_delimiter; + std::string m_suffix; + }; void trim(std::string* s); -- cgit v1.2.3 From e0577978c512cbc3ea0e05067882b14eedacc679 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 27 Jan 2017 20:21:04 -0800 Subject: Remove unneeded #include directive --- toolsrc/include/package_spec.h | 1 - 1 file changed, 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/package_spec.h b/toolsrc/include/package_spec.h index 01b4377a5..b469567c7 100644 --- a/toolsrc/include/package_spec.h +++ b/toolsrc/include/package_spec.h @@ -1,5 +1,4 @@ #pragma once -#include #include "package_spec_parse_result.h" #include "triplet.h" #include "expected.h" -- cgit v1.2.3 From 661776fe29344c431731e5ae464da4942b38bf79 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 30 Jan 2017 12:34:36 -0800 Subject: Enable recursive `remove` command --- toolsrc/include/vcpkg_Dependencies.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h index 528abedfb..2a3030c89 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -29,15 +29,14 @@ namespace vcpkg::Dependencies enum class remove_plan_type { NOT_INSTALLED, - DEPENDENCIES_NOT_SATISFIED, - REMOVE, + REMOVE_AUTO_SELECTED, REMOVE_USER_REQUESTED }; struct remove_plan_action { remove_plan_type type; - std::unique_ptr bpgh; + std::unique_ptr status_pgh; }; struct package_spec_with_remove_plan -- cgit v1.2.3 From 884cd176b05a76e7fbba924685a0d71c3dea0f9b Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 30 Jan 2017 12:36:27 -0800 Subject: Renames and formatting --- toolsrc/include/vcpkg_Dependencies.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h index 2a3030c89..5b0bf3187 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -16,8 +16,8 @@ namespace vcpkg::Dependencies struct install_plan_action { install_plan_type type; - std::unique_ptr bpgh; - std::unique_ptr spgh; + std::unique_ptr binary_pgh; + std::unique_ptr source_pgh; }; struct package_spec_with_install_plan -- cgit v1.2.3 From 4d104541674f1975b60c2ccd694d447e25a16359 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 30 Jan 2017 12:45:26 -0800 Subject: Add package_spec::display_name() --- toolsrc/include/package_spec.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/package_spec.h b/toolsrc/include/package_spec.h index b469567c7..1bc493756 100644 --- a/toolsrc/include/package_spec.h +++ b/toolsrc/include/package_spec.h @@ -15,6 +15,8 @@ namespace vcpkg const triplet& target_triplet() const; + std::string display_name() const; + std::string dir() const; std::string toString() const; -- cgit v1.2.3 From e461467affad578d2e13a5c8f18cc37ee3007938 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 30 Jan 2017 13:57:43 -0800 Subject: [Dependencies] User-requested vs autos-elected info is now in a separate enum --- toolsrc/include/vcpkg_Dependencies.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h index 5b0bf3187..b987a6b38 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -6,6 +6,12 @@ namespace vcpkg::Dependencies { + enum class request_type + { + USER_REQUESTED, + AUTO_SELECTED + }; + enum class install_plan_type { BUILD_AND_INSTALL, @@ -29,13 +35,13 @@ namespace vcpkg::Dependencies enum class remove_plan_type { NOT_INSTALLED, - REMOVE_AUTO_SELECTED, - REMOVE_USER_REQUESTED + REMOVE }; struct remove_plan_action { - remove_plan_type type; + remove_plan_type plan_type; + request_type request_type; std::unique_ptr status_pgh; }; -- cgit v1.2.3 From b4e9322a11aa2d0d9b0f1c0f960d921ce51e1c0f Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 30 Jan 2017 13:58:58 -0800 Subject: Rename field --- toolsrc/include/vcpkg_Dependencies.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h index b987a6b38..ac4a13e84 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -21,7 +21,7 @@ namespace vcpkg::Dependencies struct install_plan_action { - install_plan_type type; + install_plan_type plan_type; std::unique_ptr binary_pgh; std::unique_ptr source_pgh; }; -- cgit v1.2.3 From 836de4b0748617db6d06b0eef6fe9ccff9980b1f Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 30 Jan 2017 15:29:02 -0800 Subject: Fix remove_plan code --- toolsrc/include/vcpkg_Dependencies.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h index ac4a13e84..9180cb65e 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -42,7 +42,7 @@ namespace vcpkg::Dependencies { remove_plan_type plan_type; request_type request_type; - std::unique_ptr status_pgh; + StatusParagraph* status_pgh; }; struct package_spec_with_remove_plan -- cgit v1.2.3 From 8de71af4bd94ae1e41bf39a455ed716ac8cdf9bc Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 30 Jan 2017 16:14:48 -0800 Subject: Introduce "optional" alias --- toolsrc/include/vcpkg_Dependencies.h | 5 +++-- toolsrc/include/vcpkg_optional.h | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 toolsrc/include/vcpkg_optional.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h index 9180cb65e..2595d9fb8 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -3,6 +3,7 @@ #include "package_spec.h" #include "StatusParagraphs.h" #include "vcpkg_paths.h" +#include "vcpkg_optional.h" namespace vcpkg::Dependencies { @@ -22,8 +23,8 @@ namespace vcpkg::Dependencies struct install_plan_action { install_plan_type plan_type; - std::unique_ptr binary_pgh; - std::unique_ptr source_pgh; + optional binary_pgh; + optional source_pgh; }; struct package_spec_with_install_plan diff --git a/toolsrc/include/vcpkg_optional.h b/toolsrc/include/vcpkg_optional.h new file mode 100644 index 000000000..7b935bea9 --- /dev/null +++ b/toolsrc/include/vcpkg_optional.h @@ -0,0 +1,5 @@ +#pragma once +#include + +template +using optional = std::unique_ptr; -- cgit v1.2.3 From 4252d9436e6d4104f6acc5560aef461046aae853 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 30 Jan 2017 16:46:39 -0800 Subject: remove_plan now depends on the spec, instead of StatusParagraph --- toolsrc/include/vcpkg_Dependencies.h | 1 - 1 file changed, 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h index 2595d9fb8..ba84d1bd1 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -43,7 +43,6 @@ namespace vcpkg::Dependencies { remove_plan_type plan_type; request_type request_type; - StatusParagraph* status_pgh; }; struct package_spec_with_remove_plan -- cgit v1.2.3 From 4e64dc598a53493a85d65f94c81a33c4862fc89a Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 30 Jan 2017 17:52:53 -0800 Subject: [Dependencies] Specify constructors and fix bug with default remove_plan_action init --- toolsrc/include/vcpkg_Dependencies.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h index ba84d1bd1..b63816089 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -9,12 +9,14 @@ namespace vcpkg::Dependencies { enum class request_type { + UNKNOWN, USER_REQUESTED, AUTO_SELECTED }; enum class install_plan_type { + UNKNOWN, BUILD_AND_INSTALL, INSTALL, ALREADY_INSTALLED @@ -22,6 +24,13 @@ namespace vcpkg::Dependencies struct install_plan_action { + install_plan_action(); + install_plan_action(const install_plan_type& plan_type, optional binary_pgh, optional source_pgh); + install_plan_action(const install_plan_action&) = delete; + install_plan_action(install_plan_action&&) = default; + install_plan_action& operator=(const install_plan_action&) = delete; + install_plan_action& operator=(install_plan_action&&) = default; + install_plan_type plan_type; optional binary_pgh; optional source_pgh; @@ -29,24 +38,37 @@ namespace vcpkg::Dependencies struct package_spec_with_install_plan { + package_spec_with_install_plan(const package_spec& spec, install_plan_action&& plan); + package_spec spec; install_plan_action plan; }; enum class remove_plan_type { + UNKNOWN, NOT_INSTALLED, REMOVE }; struct remove_plan_action { + remove_plan_action(); + remove_plan_action(const remove_plan_type& plan_type, const request_type& request_type); + remove_plan_action(const remove_plan_action&) = delete; + remove_plan_action(remove_plan_action&&) = default; + remove_plan_action& operator=(const remove_plan_action&) = delete; + remove_plan_action& operator=(remove_plan_action&&) = default; + + remove_plan_type plan_type; request_type request_type; }; struct package_spec_with_remove_plan { + package_spec_with_remove_plan(const package_spec& spec, remove_plan_action&& plan); + package_spec spec; remove_plan_action plan; }; -- cgit v1.2.3 From 2a83c5eda6288cba46cb723996f95b0f6b21e61f Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 31 Jan 2017 12:59:20 -0800 Subject: [opt_bool] Make members ALL_CAPS --- toolsrc/include/opt_bool.h | 6 +++--- toolsrc/include/vcpkg_cmd_arguments.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/opt_bool.h b/toolsrc/include/opt_bool.h index 3856366c8..42133fb7a 100644 --- a/toolsrc/include/opt_bool.h +++ b/toolsrc/include/opt_bool.h @@ -4,8 +4,8 @@ namespace vcpkg { enum class opt_bool { - unspecified, - enabled, - disabled + UNSPECIFIED, + ENABLED, + DISABLED }; } diff --git a/toolsrc/include/vcpkg_cmd_arguments.h b/toolsrc/include/vcpkg_cmd_arguments.h index 8ace98586..79e12841d 100644 --- a/toolsrc/include/vcpkg_cmd_arguments.h +++ b/toolsrc/include/vcpkg_cmd_arguments.h @@ -14,9 +14,9 @@ namespace vcpkg std::unique_ptr vcpkg_root_dir; std::unique_ptr target_triplet; - opt_bool debug = opt_bool::unspecified; - opt_bool sendmetrics = opt_bool::unspecified; - opt_bool printmetrics = opt_bool::unspecified; + opt_bool debug = opt_bool::UNSPECIFIED; + opt_bool sendmetrics = opt_bool::UNSPECIFIED; + opt_bool printmetrics = opt_bool::UNSPECIFIED; std::string command; std::vector command_arguments; -- cgit v1.2.3 From bd1a10e5b97b073731cbb97e26611edf317c16d5 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 31 Jan 2017 13:31:45 -0800 Subject: Enhance the opt_bool type --- toolsrc/include/opt_bool.h | 28 +++++++++++++++++++++++++--- toolsrc/include/vcpkg_cmd_arguments.h | 6 +++--- 2 files changed, 28 insertions(+), 6 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/opt_bool.h b/toolsrc/include/opt_bool.h index 42133fb7a..06642a399 100644 --- a/toolsrc/include/opt_bool.h +++ b/toolsrc/include/opt_bool.h @@ -1,11 +1,33 @@ #pragma once -namespace vcpkg +#include +#include + +namespace vcpkg::opt_bool { - enum class opt_bool + enum class type { - UNSPECIFIED, + UNSPECIFIED = 0, ENABLED, DISABLED }; + + type parse(const std::string& s); + + template + type from_map(const std::map& map, const T& key) + { + auto it = map.find(key); + if (it == map.cend()) + { + return type::UNSPECIFIED; + } + + return parse(*it); + } } + +namespace vcpkg +{ + using opt_bool_t = opt_bool::type; +} \ No newline at end of file diff --git a/toolsrc/include/vcpkg_cmd_arguments.h b/toolsrc/include/vcpkg_cmd_arguments.h index 79e12841d..91f7de8ac 100644 --- a/toolsrc/include/vcpkg_cmd_arguments.h +++ b/toolsrc/include/vcpkg_cmd_arguments.h @@ -14,9 +14,9 @@ namespace vcpkg std::unique_ptr vcpkg_root_dir; std::unique_ptr target_triplet; - opt_bool debug = opt_bool::UNSPECIFIED; - opt_bool sendmetrics = opt_bool::UNSPECIFIED; - opt_bool printmetrics = opt_bool::UNSPECIFIED; + opt_bool_t debug = opt_bool_t::UNSPECIFIED; + opt_bool_t sendmetrics = opt_bool_t::UNSPECIFIED; + opt_bool_t printmetrics = opt_bool_t::UNSPECIFIED; std::string command; std::vector command_arguments; -- cgit v1.2.3 From 459999786960483f6d46229524500543459968ed Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 31 Jan 2017 17:09:48 -0800 Subject: Introduce BuildPolicies (not used by the post_build checks yet) --- toolsrc/include/BuildInfo.h | 6 +++++- toolsrc/include/BuildPolicies.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 toolsrc/include/BuildPolicies.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/BuildInfo.h b/toolsrc/include/BuildInfo.h index c90ad7a4e..1fd032aa2 100644 --- a/toolsrc/include/BuildInfo.h +++ b/toolsrc/include/BuildInfo.h @@ -3,6 +3,8 @@ #include #include "Paragraphs.h" #include +#include "BuildPolicies.h" +#include "opt_bool.h" namespace vcpkg::PostBuildLint { @@ -119,10 +121,12 @@ namespace vcpkg::PostBuildLint struct BuildInfo { - static BuildInfo create(const std::unordered_map& pgh); + static BuildInfo create(std::unordered_map pgh); std::string crt_linkage; std::string library_linkage; + + std::map policies; }; BuildInfo read_build_info(const fs::path& filepath); diff --git a/toolsrc/include/BuildPolicies.h b/toolsrc/include/BuildPolicies.h new file mode 100644 index 000000000..fbe9b0ff3 --- /dev/null +++ b/toolsrc/include/BuildPolicies.h @@ -0,0 +1,30 @@ +#pragma once +#include + +namespace vcpkg::PostBuildLint::BuildPolicies +{ + enum class backing_enum_t + { + UNKNOWN = 0, + DLLS_WITHOUT_LIBS + }; + + struct type + { + static constexpr int length() { return 2; } + constexpr explicit type(backing_enum_t backing_enum) : backing_enum(backing_enum) { } + constexpr operator backing_enum_t() const { return backing_enum; } + + const std::string& toString() const; + const std::string& cmake_variable() const; + + private: + type(); + backing_enum_t backing_enum; + }; + + static constexpr type UNKNOWN(backing_enum_t::UNKNOWN); + static constexpr type DLLS_WITHOUT_LIBS(backing_enum_t::DLLS_WITHOUT_LIBS); + + type parse(const std::string& s); +} -- cgit v1.2.3 From c595fac0ffb8de45f390ab591fbc76fa12ca0442 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 31 Jan 2017 18:55:14 -0800 Subject: Add BuildPolicies::values() --- toolsrc/include/BuildPolicies.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/BuildPolicies.h b/toolsrc/include/BuildPolicies.h index fbe9b0ff3..8298ffe2d 100644 --- a/toolsrc/include/BuildPolicies.h +++ b/toolsrc/include/BuildPolicies.h @@ -11,7 +11,6 @@ namespace vcpkg::PostBuildLint::BuildPolicies struct type { - static constexpr int length() { return 2; } constexpr explicit type(backing_enum_t backing_enum) : backing_enum(backing_enum) { } constexpr operator backing_enum_t() const { return backing_enum; } @@ -23,6 +22,9 @@ namespace vcpkg::PostBuildLint::BuildPolicies backing_enum_t backing_enum; }; + static constexpr int value_count = 2; + const std::vector& values(); + static constexpr type UNKNOWN(backing_enum_t::UNKNOWN); static constexpr type DLLS_WITHOUT_LIBS(backing_enum_t::DLLS_WITHOUT_LIBS); -- cgit v1.2.3 From 9086fcebdf43ad01892c8f96afc5e676f9b72135 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 1 Feb 2017 13:24:06 -0800 Subject: Rename files in PostBuildLint namespace --- toolsrc/include/BuildInfo.h | 133 -------------------------- toolsrc/include/BuildPolicies.h | 32 ------- toolsrc/include/PostBuildLint.h | 8 ++ toolsrc/include/PostBuildLint_BuildInfo.h | 133 ++++++++++++++++++++++++++ toolsrc/include/PostBuildLint_BuildPolicies.h | 32 +++++++ toolsrc/include/post_build_lint.h | 8 -- 6 files changed, 173 insertions(+), 173 deletions(-) delete mode 100644 toolsrc/include/BuildInfo.h delete mode 100644 toolsrc/include/BuildPolicies.h create mode 100644 toolsrc/include/PostBuildLint.h create mode 100644 toolsrc/include/PostBuildLint_BuildInfo.h create mode 100644 toolsrc/include/PostBuildLint_BuildPolicies.h delete mode 100644 toolsrc/include/post_build_lint.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/BuildInfo.h b/toolsrc/include/BuildInfo.h deleted file mode 100644 index 1fd032aa2..000000000 --- a/toolsrc/include/BuildInfo.h +++ /dev/null @@ -1,133 +0,0 @@ -#pragma once - -#include -#include "Paragraphs.h" -#include -#include "BuildPolicies.h" -#include "opt_bool.h" - -namespace vcpkg::PostBuildLint -{ - enum class LinkageType - { - DYNAMIC, - STATIC, - UNKNOWN - }; - - LinkageType linkage_type_value_of(const std::string& as_string); - - std::string to_string(const LinkageType& build_info); - - enum class ConfigurationType - { - DEBUG = 1, - RELEASE = 2 - }; - - std::string to_string(const ConfigurationType& conf); - - struct BuildType - { - static BuildType value_of(const ConfigurationType& config, const LinkageType& linkage); - - static const BuildType DEBUG_STATIC; - static const BuildType DEBUG_DYNAMIC; - static const BuildType RELEASE_STATIC; - static const BuildType RELEASE_DYNAMIC; - - static const std::vector& values() - { - static const std::vector v = {DEBUG_STATIC, DEBUG_DYNAMIC, RELEASE_STATIC, RELEASE_DYNAMIC}; - return v; - } - - BuildType() = delete; - - const ConfigurationType& config() const; - const LinkageType& linkage() const; - std::regex crt_regex() const; - std::string toString() const; - - private: - BuildType(const ConfigurationType& config, const LinkageType& linkage, const std::string& crt_regex_as_string) - : m_config(config), m_linkage(linkage), m_crt_regex_as_string(crt_regex_as_string) - { - } - - ConfigurationType m_config; - LinkageType m_linkage; - std::string m_crt_regex_as_string; - }; - - bool operator ==(const BuildType& lhs, const BuildType& rhs); - - bool operator !=(const BuildType& lhs, const BuildType& rhs); - - struct OutdatedDynamicCrt - { - // Old CPP - static const OutdatedDynamicCrt MSVCP100_DLL; - static const OutdatedDynamicCrt MSVCP100D_DLL; - static const OutdatedDynamicCrt MSVCP110_DLL; - static const OutdatedDynamicCrt MSVCP110_WIN_DLL; - static const OutdatedDynamicCrt MSVCP120_DLL; - static const OutdatedDynamicCrt MSVCP120_CLR0400_DLL; - static const OutdatedDynamicCrt MSVCP60_DLL; - static const OutdatedDynamicCrt MSVCP_WIN_DLL; - - // Old C - static const OutdatedDynamicCrt MSVCR100_DLL; - static const OutdatedDynamicCrt MSVCR100D_DLL; - static const OutdatedDynamicCrt MSVCR100_CLR0400_DLL; - static const OutdatedDynamicCrt MSVCR110_DLL; - static const OutdatedDynamicCrt MSVCR120_DLL; - static const OutdatedDynamicCrt MSVCR120_CLR0400_DLL; - static const OutdatedDynamicCrt MSVCRT_DLL; - static const OutdatedDynamicCrt MSVCRT20_DLL; - static const OutdatedDynamicCrt MSVCRT40_DLL; - - static const std::vector& values() - { - static const std::vector v = { - MSVCP100_DLL, MSVCP100D_DLL, - MSVCP110_DLL,MSVCP110_WIN_DLL, - MSVCP120_DLL, MSVCP120_CLR0400_DLL, - MSVCP60_DLL, - MSVCP_WIN_DLL, - - MSVCR100_DLL, MSVCR100D_DLL, MSVCR100_CLR0400_DLL, - MSVCR110_DLL, - MSVCR120_DLL, MSVCR120_CLR0400_DLL, - MSVCRT_DLL, MSVCRT20_DLL,MSVCRT40_DLL - }; - return v; - } - - OutdatedDynamicCrt() = delete; - - std::regex crt_regex() const; - const std::string& toString() const; - - private: - explicit OutdatedDynamicCrt(const std::string& dll_name, const std::string& crt_regex_as_string) - : m_dll_name(dll_name), m_crt_regex_as_string(crt_regex_as_string) - { - } - - std::string m_dll_name; - std::string m_crt_regex_as_string; - }; - - struct BuildInfo - { - static BuildInfo create(std::unordered_map pgh); - - std::string crt_linkage; - std::string library_linkage; - - std::map policies; - }; - - BuildInfo read_build_info(const fs::path& filepath); -} diff --git a/toolsrc/include/BuildPolicies.h b/toolsrc/include/BuildPolicies.h deleted file mode 100644 index 8298ffe2d..000000000 --- a/toolsrc/include/BuildPolicies.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once -#include - -namespace vcpkg::PostBuildLint::BuildPolicies -{ - enum class backing_enum_t - { - UNKNOWN = 0, - DLLS_WITHOUT_LIBS - }; - - struct type - { - constexpr explicit type(backing_enum_t backing_enum) : backing_enum(backing_enum) { } - constexpr operator backing_enum_t() const { return backing_enum; } - - const std::string& toString() const; - const std::string& cmake_variable() const; - - private: - type(); - backing_enum_t backing_enum; - }; - - static constexpr int value_count = 2; - const std::vector& values(); - - static constexpr type UNKNOWN(backing_enum_t::UNKNOWN); - static constexpr type DLLS_WITHOUT_LIBS(backing_enum_t::DLLS_WITHOUT_LIBS); - - type parse(const std::string& s); -} diff --git a/toolsrc/include/PostBuildLint.h b/toolsrc/include/PostBuildLint.h new file mode 100644 index 000000000..215a237aa --- /dev/null +++ b/toolsrc/include/PostBuildLint.h @@ -0,0 +1,8 @@ +#pragma once +#include "package_spec.h" +#include "vcpkg_paths.h" + +namespace vcpkg::PostBuildLint +{ + void perform_all_checks(const package_spec& spec, const vcpkg_paths& paths); +} diff --git a/toolsrc/include/PostBuildLint_BuildInfo.h b/toolsrc/include/PostBuildLint_BuildInfo.h new file mode 100644 index 000000000..cf444ce90 --- /dev/null +++ b/toolsrc/include/PostBuildLint_BuildInfo.h @@ -0,0 +1,133 @@ +#pragma once + +#include +#include "Paragraphs.h" +#include +#include "PostBuildLint_BuildPolicies.h" +#include "opt_bool.h" + +namespace vcpkg::PostBuildLint +{ + enum class LinkageType + { + DYNAMIC, + STATIC, + UNKNOWN + }; + + LinkageType linkage_type_value_of(const std::string& as_string); + + std::string to_string(const LinkageType& build_info); + + enum class ConfigurationType + { + DEBUG = 1, + RELEASE = 2 + }; + + std::string to_string(const ConfigurationType& conf); + + struct BuildType + { + static BuildType value_of(const ConfigurationType& config, const LinkageType& linkage); + + static const BuildType DEBUG_STATIC; + static const BuildType DEBUG_DYNAMIC; + static const BuildType RELEASE_STATIC; + static const BuildType RELEASE_DYNAMIC; + + static const std::vector& values() + { + static const std::vector v = {DEBUG_STATIC, DEBUG_DYNAMIC, RELEASE_STATIC, RELEASE_DYNAMIC}; + return v; + } + + BuildType() = delete; + + const ConfigurationType& config() const; + const LinkageType& linkage() const; + std::regex crt_regex() const; + std::string toString() const; + + private: + BuildType(const ConfigurationType& config, const LinkageType& linkage, const std::string& crt_regex_as_string) + : m_config(config), m_linkage(linkage), m_crt_regex_as_string(crt_regex_as_string) + { + } + + ConfigurationType m_config; + LinkageType m_linkage; + std::string m_crt_regex_as_string; + }; + + bool operator ==(const BuildType& lhs, const BuildType& rhs); + + bool operator !=(const BuildType& lhs, const BuildType& rhs); + + struct OutdatedDynamicCrt + { + // Old CPP + static const OutdatedDynamicCrt MSVCP100_DLL; + static const OutdatedDynamicCrt MSVCP100D_DLL; + static const OutdatedDynamicCrt MSVCP110_DLL; + static const OutdatedDynamicCrt MSVCP110_WIN_DLL; + static const OutdatedDynamicCrt MSVCP120_DLL; + static const OutdatedDynamicCrt MSVCP120_CLR0400_DLL; + static const OutdatedDynamicCrt MSVCP60_DLL; + static const OutdatedDynamicCrt MSVCP_WIN_DLL; + + // Old C + static const OutdatedDynamicCrt MSVCR100_DLL; + static const OutdatedDynamicCrt MSVCR100D_DLL; + static const OutdatedDynamicCrt MSVCR100_CLR0400_DLL; + static const OutdatedDynamicCrt MSVCR110_DLL; + static const OutdatedDynamicCrt MSVCR120_DLL; + static const OutdatedDynamicCrt MSVCR120_CLR0400_DLL; + static const OutdatedDynamicCrt MSVCRT_DLL; + static const OutdatedDynamicCrt MSVCRT20_DLL; + static const OutdatedDynamicCrt MSVCRT40_DLL; + + static const std::vector& values() + { + static const std::vector v = { + MSVCP100_DLL, MSVCP100D_DLL, + MSVCP110_DLL,MSVCP110_WIN_DLL, + MSVCP120_DLL, MSVCP120_CLR0400_DLL, + MSVCP60_DLL, + MSVCP_WIN_DLL, + + MSVCR100_DLL, MSVCR100D_DLL, MSVCR100_CLR0400_DLL, + MSVCR110_DLL, + MSVCR120_DLL, MSVCR120_CLR0400_DLL, + MSVCRT_DLL, MSVCRT20_DLL,MSVCRT40_DLL + }; + return v; + } + + OutdatedDynamicCrt() = delete; + + std::regex crt_regex() const; + const std::string& toString() const; + + private: + explicit OutdatedDynamicCrt(const std::string& dll_name, const std::string& crt_regex_as_string) + : m_dll_name(dll_name), m_crt_regex_as_string(crt_regex_as_string) + { + } + + std::string m_dll_name; + std::string m_crt_regex_as_string; + }; + + struct BuildInfo + { + static BuildInfo create(std::unordered_map pgh); + + std::string crt_linkage; + std::string library_linkage; + + std::map policies; + }; + + BuildInfo read_build_info(const fs::path& filepath); +} diff --git a/toolsrc/include/PostBuildLint_BuildPolicies.h b/toolsrc/include/PostBuildLint_BuildPolicies.h new file mode 100644 index 000000000..8298ffe2d --- /dev/null +++ b/toolsrc/include/PostBuildLint_BuildPolicies.h @@ -0,0 +1,32 @@ +#pragma once +#include + +namespace vcpkg::PostBuildLint::BuildPolicies +{ + enum class backing_enum_t + { + UNKNOWN = 0, + DLLS_WITHOUT_LIBS + }; + + struct type + { + constexpr explicit type(backing_enum_t backing_enum) : backing_enum(backing_enum) { } + constexpr operator backing_enum_t() const { return backing_enum; } + + const std::string& toString() const; + const std::string& cmake_variable() const; + + private: + type(); + backing_enum_t backing_enum; + }; + + static constexpr int value_count = 2; + const std::vector& values(); + + static constexpr type UNKNOWN(backing_enum_t::UNKNOWN); + static constexpr type DLLS_WITHOUT_LIBS(backing_enum_t::DLLS_WITHOUT_LIBS); + + type parse(const std::string& s); +} diff --git a/toolsrc/include/post_build_lint.h b/toolsrc/include/post_build_lint.h deleted file mode 100644 index 215a237aa..000000000 --- a/toolsrc/include/post_build_lint.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once -#include "package_spec.h" -#include "vcpkg_paths.h" - -namespace vcpkg::PostBuildLint -{ - void perform_all_checks(const package_spec& spec, const vcpkg_paths& paths); -} -- cgit v1.2.3 From 7a04aff33e596b843fba2162ab9b05180fc5169c Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 1 Feb 2017 13:38:02 -0800 Subject: Split LinkageType into separate h/cpp --- toolsrc/include/PostBuildLint_BuildInfo.h | 12 +----------- toolsrc/include/PostBuildLint_LinkageType.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 toolsrc/include/PostBuildLint_LinkageType.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/PostBuildLint_BuildInfo.h b/toolsrc/include/PostBuildLint_BuildInfo.h index cf444ce90..5305548e1 100644 --- a/toolsrc/include/PostBuildLint_BuildInfo.h +++ b/toolsrc/include/PostBuildLint_BuildInfo.h @@ -5,20 +5,10 @@ #include #include "PostBuildLint_BuildPolicies.h" #include "opt_bool.h" +#include "PostBuildLint_LinkageType.h" namespace vcpkg::PostBuildLint { - enum class LinkageType - { - DYNAMIC, - STATIC, - UNKNOWN - }; - - LinkageType linkage_type_value_of(const std::string& as_string); - - std::string to_string(const LinkageType& build_info); - enum class ConfigurationType { DEBUG = 1, diff --git a/toolsrc/include/PostBuildLint_LinkageType.h b/toolsrc/include/PostBuildLint_LinkageType.h new file mode 100644 index 000000000..7cca97639 --- /dev/null +++ b/toolsrc/include/PostBuildLint_LinkageType.h @@ -0,0 +1,16 @@ +#pragma once +#include + +namespace vcpkg::PostBuildLint +{ + enum class LinkageType + { + DYNAMIC, + STATIC, + UNKNOWN + }; + + LinkageType linkage_type_value_of(const std::string& as_string); + + std::string to_string(const LinkageType& build_info); +} -- cgit v1.2.3 From 4aef2485b9d5cf2dfbb30543963e5714dcc411c4 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 1 Feb 2017 13:43:29 -0800 Subject: Split ConfigurationType into separate h/cpp --- toolsrc/include/PostBuildLint_BuildInfo.h | 9 +-------- toolsrc/include/PostBuildLint_ConfigurationType.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 toolsrc/include/PostBuildLint_ConfigurationType.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/PostBuildLint_BuildInfo.h b/toolsrc/include/PostBuildLint_BuildInfo.h index 5305548e1..2685b6f7b 100644 --- a/toolsrc/include/PostBuildLint_BuildInfo.h +++ b/toolsrc/include/PostBuildLint_BuildInfo.h @@ -6,17 +6,10 @@ #include "PostBuildLint_BuildPolicies.h" #include "opt_bool.h" #include "PostBuildLint_LinkageType.h" +#include "PostBuildLint_ConfigurationType.h" namespace vcpkg::PostBuildLint { - enum class ConfigurationType - { - DEBUG = 1, - RELEASE = 2 - }; - - std::string to_string(const ConfigurationType& conf); - struct BuildType { static BuildType value_of(const ConfigurationType& config, const LinkageType& linkage); diff --git a/toolsrc/include/PostBuildLint_ConfigurationType.h b/toolsrc/include/PostBuildLint_ConfigurationType.h new file mode 100644 index 000000000..55dede921 --- /dev/null +++ b/toolsrc/include/PostBuildLint_ConfigurationType.h @@ -0,0 +1,14 @@ +#pragma once +#pragma once +#include + +namespace vcpkg::PostBuildLint +{ + enum class ConfigurationType + { + DEBUG = 1, + RELEASE = 2 + }; + + std::string to_string(const ConfigurationType& conf); +} -- cgit v1.2.3 From 0a0a17b7f9eb2aca7f999de1c4b8c63428e1eadf Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 1 Feb 2017 13:49:28 -0800 Subject: Split BuildType into separate h/cpp --- toolsrc/include/PostBuildLint_BuildInfo.h | 39 --------------------------- toolsrc/include/PostBuildLint_BuildType.h | 45 +++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 39 deletions(-) create mode 100644 toolsrc/include/PostBuildLint_BuildType.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/PostBuildLint_BuildInfo.h b/toolsrc/include/PostBuildLint_BuildInfo.h index 2685b6f7b..b41478ef0 100644 --- a/toolsrc/include/PostBuildLint_BuildInfo.h +++ b/toolsrc/include/PostBuildLint_BuildInfo.h @@ -5,48 +5,9 @@ #include #include "PostBuildLint_BuildPolicies.h" #include "opt_bool.h" -#include "PostBuildLint_LinkageType.h" -#include "PostBuildLint_ConfigurationType.h" namespace vcpkg::PostBuildLint { - struct BuildType - { - static BuildType value_of(const ConfigurationType& config, const LinkageType& linkage); - - static const BuildType DEBUG_STATIC; - static const BuildType DEBUG_DYNAMIC; - static const BuildType RELEASE_STATIC; - static const BuildType RELEASE_DYNAMIC; - - static const std::vector& values() - { - static const std::vector v = {DEBUG_STATIC, DEBUG_DYNAMIC, RELEASE_STATIC, RELEASE_DYNAMIC}; - return v; - } - - BuildType() = delete; - - const ConfigurationType& config() const; - const LinkageType& linkage() const; - std::regex crt_regex() const; - std::string toString() const; - - private: - BuildType(const ConfigurationType& config, const LinkageType& linkage, const std::string& crt_regex_as_string) - : m_config(config), m_linkage(linkage), m_crt_regex_as_string(crt_regex_as_string) - { - } - - ConfigurationType m_config; - LinkageType m_linkage; - std::string m_crt_regex_as_string; - }; - - bool operator ==(const BuildType& lhs, const BuildType& rhs); - - bool operator !=(const BuildType& lhs, const BuildType& rhs); - struct OutdatedDynamicCrt { // Old CPP diff --git a/toolsrc/include/PostBuildLint_BuildType.h b/toolsrc/include/PostBuildLint_BuildType.h new file mode 100644 index 000000000..a5cb24f49 --- /dev/null +++ b/toolsrc/include/PostBuildLint_BuildType.h @@ -0,0 +1,45 @@ +#pragma once +#include "PostBuildLint_ConfigurationType.h" +#include "PostBuildLint_LinkageType.h" +#include +#include + +namespace vcpkg::PostBuildLint +{ + struct BuildType + { + static BuildType value_of(const ConfigurationType& config, const LinkageType& linkage); + + static const BuildType DEBUG_STATIC; + static const BuildType DEBUG_DYNAMIC; + static const BuildType RELEASE_STATIC; + static const BuildType RELEASE_DYNAMIC; + + static const std::vector& values() + { + static const std::vector v = { DEBUG_STATIC, DEBUG_DYNAMIC, RELEASE_STATIC, RELEASE_DYNAMIC }; + return v; + } + + BuildType() = delete; + + const ConfigurationType& config() const; + const LinkageType& linkage() const; + std::regex crt_regex() const; + std::string toString() const; + + private: + BuildType(const ConfigurationType& config, const LinkageType& linkage, const std::string& crt_regex_as_string) + : m_config(config), m_linkage(linkage), m_crt_regex_as_string(crt_regex_as_string) + { + } + + ConfigurationType m_config; + LinkageType m_linkage; + std::string m_crt_regex_as_string; + }; + + bool operator ==(const BuildType& lhs, const BuildType& rhs); + + bool operator !=(const BuildType& lhs, const BuildType& rhs); +} -- cgit v1.2.3 From 1d34facb84812bd478f2320857a5a7a3ed327bbf Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 1 Feb 2017 13:54:08 -0800 Subject: Split OutdatedDynamicCrt into separate h/cpp --- toolsrc/include/PostBuildLint_BuildInfo.h | 56 -------------------- toolsrc/include/PostBuildLint_OutdatedDynamicCrt.h | 59 ++++++++++++++++++++++ 2 files changed, 59 insertions(+), 56 deletions(-) create mode 100644 toolsrc/include/PostBuildLint_OutdatedDynamicCrt.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/PostBuildLint_BuildInfo.h b/toolsrc/include/PostBuildLint_BuildInfo.h index b41478ef0..ff996b2b6 100644 --- a/toolsrc/include/PostBuildLint_BuildInfo.h +++ b/toolsrc/include/PostBuildLint_BuildInfo.h @@ -2,67 +2,11 @@ #include #include "Paragraphs.h" -#include #include "PostBuildLint_BuildPolicies.h" #include "opt_bool.h" namespace vcpkg::PostBuildLint { - struct OutdatedDynamicCrt - { - // Old CPP - static const OutdatedDynamicCrt MSVCP100_DLL; - static const OutdatedDynamicCrt MSVCP100D_DLL; - static const OutdatedDynamicCrt MSVCP110_DLL; - static const OutdatedDynamicCrt MSVCP110_WIN_DLL; - static const OutdatedDynamicCrt MSVCP120_DLL; - static const OutdatedDynamicCrt MSVCP120_CLR0400_DLL; - static const OutdatedDynamicCrt MSVCP60_DLL; - static const OutdatedDynamicCrt MSVCP_WIN_DLL; - - // Old C - static const OutdatedDynamicCrt MSVCR100_DLL; - static const OutdatedDynamicCrt MSVCR100D_DLL; - static const OutdatedDynamicCrt MSVCR100_CLR0400_DLL; - static const OutdatedDynamicCrt MSVCR110_DLL; - static const OutdatedDynamicCrt MSVCR120_DLL; - static const OutdatedDynamicCrt MSVCR120_CLR0400_DLL; - static const OutdatedDynamicCrt MSVCRT_DLL; - static const OutdatedDynamicCrt MSVCRT20_DLL; - static const OutdatedDynamicCrt MSVCRT40_DLL; - - static const std::vector& values() - { - static const std::vector v = { - MSVCP100_DLL, MSVCP100D_DLL, - MSVCP110_DLL,MSVCP110_WIN_DLL, - MSVCP120_DLL, MSVCP120_CLR0400_DLL, - MSVCP60_DLL, - MSVCP_WIN_DLL, - - MSVCR100_DLL, MSVCR100D_DLL, MSVCR100_CLR0400_DLL, - MSVCR110_DLL, - MSVCR120_DLL, MSVCR120_CLR0400_DLL, - MSVCRT_DLL, MSVCRT20_DLL,MSVCRT40_DLL - }; - return v; - } - - OutdatedDynamicCrt() = delete; - - std::regex crt_regex() const; - const std::string& toString() const; - - private: - explicit OutdatedDynamicCrt(const std::string& dll_name, const std::string& crt_regex_as_string) - : m_dll_name(dll_name), m_crt_regex_as_string(crt_regex_as_string) - { - } - - std::string m_dll_name; - std::string m_crt_regex_as_string; - }; - struct BuildInfo { static BuildInfo create(std::unordered_map pgh); diff --git a/toolsrc/include/PostBuildLint_OutdatedDynamicCrt.h b/toolsrc/include/PostBuildLint_OutdatedDynamicCrt.h new file mode 100644 index 000000000..484f74cf0 --- /dev/null +++ b/toolsrc/include/PostBuildLint_OutdatedDynamicCrt.h @@ -0,0 +1,59 @@ +#pragma once +#include +#include + +namespace vcpkg::PostBuildLint +{ + struct OutdatedDynamicCrt + { + // Old CPP + static const OutdatedDynamicCrt MSVCP100_DLL; + static const OutdatedDynamicCrt MSVCP100D_DLL; + static const OutdatedDynamicCrt MSVCP110_DLL; + static const OutdatedDynamicCrt MSVCP110_WIN_DLL; + static const OutdatedDynamicCrt MSVCP120_DLL; + static const OutdatedDynamicCrt MSVCP120_CLR0400_DLL; + static const OutdatedDynamicCrt MSVCP60_DLL; + static const OutdatedDynamicCrt MSVCP_WIN_DLL; + + // Old C + static const OutdatedDynamicCrt MSVCR100_DLL; + static const OutdatedDynamicCrt MSVCR100D_DLL; + static const OutdatedDynamicCrt MSVCR100_CLR0400_DLL; + static const OutdatedDynamicCrt MSVCR110_DLL; + static const OutdatedDynamicCrt MSVCR120_DLL; + static const OutdatedDynamicCrt MSVCR120_CLR0400_DLL; + static const OutdatedDynamicCrt MSVCRT_DLL; + static const OutdatedDynamicCrt MSVCRT20_DLL; + static const OutdatedDynamicCrt MSVCRT40_DLL; + + static const std::vector& values() + { + static const std::vector v = { + MSVCP100_DLL, MSVCP100D_DLL, + MSVCP110_DLL,MSVCP110_WIN_DLL, + MSVCP120_DLL, MSVCP120_CLR0400_DLL, + MSVCP60_DLL, + MSVCP_WIN_DLL, + + MSVCR100_DLL, MSVCR100D_DLL, MSVCR100_CLR0400_DLL, + MSVCR110_DLL, + MSVCR120_DLL, MSVCR120_CLR0400_DLL, + MSVCRT_DLL, MSVCRT20_DLL,MSVCRT40_DLL + }; + return v; + } + + OutdatedDynamicCrt() = delete; + + std::regex crt_regex() const; + const std::string& toString() const; + + private: + explicit OutdatedDynamicCrt(const std::string& dll_name, const std::string& crt_regex_as_string) + : m_dll_name(dll_name), m_crt_regex_as_string(crt_regex_as_string) { } + + std::string m_dll_name; + std::string m_crt_regex_as_string; + }; +} -- cgit v1.2.3 From f9616c6994ccf66e2a64e2d62e6a1408694c190c Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 7 Feb 2017 17:02:57 -0800 Subject: Add new Policy: Empty Package --- toolsrc/include/PostBuildLint_BuildPolicies.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/PostBuildLint_BuildPolicies.h b/toolsrc/include/PostBuildLint_BuildPolicies.h index 8298ffe2d..187ba6d64 100644 --- a/toolsrc/include/PostBuildLint_BuildPolicies.h +++ b/toolsrc/include/PostBuildLint_BuildPolicies.h @@ -6,6 +6,7 @@ namespace vcpkg::PostBuildLint::BuildPolicies enum class backing_enum_t { UNKNOWN = 0, + EMPTY_PACKAGE, DLLS_WITHOUT_LIBS }; @@ -22,10 +23,12 @@ namespace vcpkg::PostBuildLint::BuildPolicies backing_enum_t backing_enum; }; - static constexpr int value_count = 2; + static constexpr int value_count = 3; const std::vector& values(); + static constexpr type UNKNOWN(backing_enum_t::UNKNOWN); + static constexpr type EMPTY_PACKAGE(backing_enum_t::EMPTY_PACKAGE); static constexpr type DLLS_WITHOUT_LIBS(backing_enum_t::DLLS_WITHOUT_LIBS); type parse(const std::string& s); -- cgit v1.2.3 From d36a1b7cb0b8be59e7826a7a699d9951e91abc2c Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 7 Feb 2017 22:57:37 -0800 Subject: Remove OutdatedDynamicCrt enum. Replace with vector --- toolsrc/include/PostBuildLint_OutdatedDynamicCrt.h | 59 ---------------------- 1 file changed, 59 deletions(-) delete mode 100644 toolsrc/include/PostBuildLint_OutdatedDynamicCrt.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/PostBuildLint_OutdatedDynamicCrt.h b/toolsrc/include/PostBuildLint_OutdatedDynamicCrt.h deleted file mode 100644 index 484f74cf0..000000000 --- a/toolsrc/include/PostBuildLint_OutdatedDynamicCrt.h +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once -#include -#include - -namespace vcpkg::PostBuildLint -{ - struct OutdatedDynamicCrt - { - // Old CPP - static const OutdatedDynamicCrt MSVCP100_DLL; - static const OutdatedDynamicCrt MSVCP100D_DLL; - static const OutdatedDynamicCrt MSVCP110_DLL; - static const OutdatedDynamicCrt MSVCP110_WIN_DLL; - static const OutdatedDynamicCrt MSVCP120_DLL; - static const OutdatedDynamicCrt MSVCP120_CLR0400_DLL; - static const OutdatedDynamicCrt MSVCP60_DLL; - static const OutdatedDynamicCrt MSVCP_WIN_DLL; - - // Old C - static const OutdatedDynamicCrt MSVCR100_DLL; - static const OutdatedDynamicCrt MSVCR100D_DLL; - static const OutdatedDynamicCrt MSVCR100_CLR0400_DLL; - static const OutdatedDynamicCrt MSVCR110_DLL; - static const OutdatedDynamicCrt MSVCR120_DLL; - static const OutdatedDynamicCrt MSVCR120_CLR0400_DLL; - static const OutdatedDynamicCrt MSVCRT_DLL; - static const OutdatedDynamicCrt MSVCRT20_DLL; - static const OutdatedDynamicCrt MSVCRT40_DLL; - - static const std::vector& values() - { - static const std::vector v = { - MSVCP100_DLL, MSVCP100D_DLL, - MSVCP110_DLL,MSVCP110_WIN_DLL, - MSVCP120_DLL, MSVCP120_CLR0400_DLL, - MSVCP60_DLL, - MSVCP_WIN_DLL, - - MSVCR100_DLL, MSVCR100D_DLL, MSVCR100_CLR0400_DLL, - MSVCR110_DLL, - MSVCR120_DLL, MSVCR120_CLR0400_DLL, - MSVCRT_DLL, MSVCRT20_DLL,MSVCRT40_DLL - }; - return v; - } - - OutdatedDynamicCrt() = delete; - - std::regex crt_regex() const; - const std::string& toString() const; - - private: - explicit OutdatedDynamicCrt(const std::string& dll_name, const std::string& crt_regex_as_string) - : m_dll_name(dll_name), m_crt_regex_as_string(crt_regex_as_string) { } - - std::string m_dll_name; - std::string m_crt_regex_as_string; - }; -} -- cgit v1.2.3 From 47a4bff2d11881f95bd0eb0b659360ff1b7465c0 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 9 Feb 2017 18:26:16 -0800 Subject: Add vcpkg_Enums --- toolsrc/include/vcpkg_Enums.h | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 toolsrc/include/vcpkg_Enums.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Enums.h b/toolsrc/include/vcpkg_Enums.h new file mode 100644 index 000000000..5c4dc8b06 --- /dev/null +++ b/toolsrc/include/vcpkg_Enums.h @@ -0,0 +1,11 @@ +#pragma once +#include + +namespace vcpkg::Enums +{ + std::string nullvalue_toString(const std::string& enum_name); + + __declspec(noreturn) void nullvalue_used(const std::string& enum_name); + + __declspec(noreturn) void unreachable(const std::string& enum_name); +} -- cgit v1.2.3 From 7a0404cb839ae49bf7e52ca54f905d182a12de5d Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 9 Feb 2017 18:39:03 -0800 Subject: BuildInfo now holds enum instead of string --- toolsrc/include/PostBuildLint_BuildInfo.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/PostBuildLint_BuildInfo.h b/toolsrc/include/PostBuildLint_BuildInfo.h index ff996b2b6..878b90e6f 100644 --- a/toolsrc/include/PostBuildLint_BuildInfo.h +++ b/toolsrc/include/PostBuildLint_BuildInfo.h @@ -4,6 +4,7 @@ #include "Paragraphs.h" #include "PostBuildLint_BuildPolicies.h" #include "opt_bool.h" +#include "PostBuildLint_LinkageType.h" namespace vcpkg::PostBuildLint { @@ -11,8 +12,8 @@ namespace vcpkg::PostBuildLint { static BuildInfo create(std::unordered_map pgh); - std::string crt_linkage; - std::string library_linkage; + LinkageType crt_linkage; + LinkageType library_linkage; std::map policies; }; -- cgit v1.2.3 From 95650bdd424b9499f4676dae8f110b15b3fd024f Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 9 Feb 2017 19:00:09 -0800 Subject: PostBuildLint enum revamp --- toolsrc/include/PostBuildLint_BuildInfo.h | 4 +- toolsrc/include/PostBuildLint_BuildPolicies.h | 13 ++--- toolsrc/include/PostBuildLint_BuildType.h | 58 ++++++++++++----------- toolsrc/include/PostBuildLint_ConfigurationType.h | 25 ++++++++-- toolsrc/include/PostBuildLint_LinkageType.h | 30 +++++++++--- 5 files changed, 85 insertions(+), 45 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/PostBuildLint_BuildInfo.h b/toolsrc/include/PostBuildLint_BuildInfo.h index 878b90e6f..7dbadb147 100644 --- a/toolsrc/include/PostBuildLint_BuildInfo.h +++ b/toolsrc/include/PostBuildLint_BuildInfo.h @@ -12,8 +12,8 @@ namespace vcpkg::PostBuildLint { static BuildInfo create(std::unordered_map pgh); - LinkageType crt_linkage; - LinkageType library_linkage; + LinkageType::type crt_linkage; + LinkageType::type library_linkage; std::map policies; }; diff --git a/toolsrc/include/PostBuildLint_BuildPolicies.h b/toolsrc/include/PostBuildLint_BuildPolicies.h index 187ba6d64..082de31d0 100644 --- a/toolsrc/include/PostBuildLint_BuildPolicies.h +++ b/toolsrc/include/PostBuildLint_BuildPolicies.h @@ -1,17 +1,19 @@ #pragma once #include +#include namespace vcpkg::PostBuildLint::BuildPolicies { enum class backing_enum_t { - UNKNOWN = 0, + NULLVALUE = 0, EMPTY_PACKAGE, DLLS_WITHOUT_LIBS }; struct type { + constexpr type() : backing_enum(backing_enum_t::NULLVALUE) {} constexpr explicit type(backing_enum_t backing_enum) : backing_enum(backing_enum) { } constexpr operator backing_enum_t() const { return backing_enum; } @@ -19,17 +21,16 @@ namespace vcpkg::PostBuildLint::BuildPolicies const std::string& cmake_variable() const; private: - type(); backing_enum_t backing_enum; }; - static constexpr int value_count = 3; - const std::vector& values(); + static const std::string ENUM_NAME = "vcpkg::PostBuildLint::BuildPolicies"; - - static constexpr type UNKNOWN(backing_enum_t::UNKNOWN); + static constexpr type NULLVALUE(backing_enum_t::NULLVALUE); static constexpr type EMPTY_PACKAGE(backing_enum_t::EMPTY_PACKAGE); static constexpr type DLLS_WITHOUT_LIBS(backing_enum_t::DLLS_WITHOUT_LIBS); + static constexpr std::array values = { EMPTY_PACKAGE, DLLS_WITHOUT_LIBS }; + type parse(const std::string& s); } diff --git a/toolsrc/include/PostBuildLint_BuildType.h b/toolsrc/include/PostBuildLint_BuildType.h index a5cb24f49..31fbb11c9 100644 --- a/toolsrc/include/PostBuildLint_BuildType.h +++ b/toolsrc/include/PostBuildLint_BuildType.h @@ -1,45 +1,47 @@ #pragma once #include "PostBuildLint_ConfigurationType.h" #include "PostBuildLint_LinkageType.h" -#include +#include #include -namespace vcpkg::PostBuildLint +namespace vcpkg::PostBuildLint::BuildType { - struct BuildType + enum class backing_enum_t { - static BuildType value_of(const ConfigurationType& config, const LinkageType& linkage); + DEBUG_STATIC = 1, + DEBUG_DYNAMIC, + RELEASE_STATIC, + RELEASE_DYNAMIC + }; - static const BuildType DEBUG_STATIC; - static const BuildType DEBUG_DYNAMIC; - static const BuildType RELEASE_STATIC; - static const BuildType RELEASE_DYNAMIC; + struct type + { + type() = delete; - static const std::vector& values() - { - static const std::vector v = { DEBUG_STATIC, DEBUG_DYNAMIC, RELEASE_STATIC, RELEASE_DYNAMIC }; - return v; - } + constexpr explicit type(const backing_enum_t backing_enum, const ConfigurationType::type config, const LinkageType::type linkage) : + backing_enum(backing_enum), m_config(config), m_linkage(linkage) { } - BuildType() = delete; + constexpr operator backing_enum_t() const { return backing_enum; } - const ConfigurationType& config() const; - const LinkageType& linkage() const; - std::regex crt_regex() const; - std::string toString() const; + const ConfigurationType::type& config() const; + const LinkageType::type& linkage() const; + const std::regex& crt_regex() const; + const std::string& toString() const; private: - BuildType(const ConfigurationType& config, const LinkageType& linkage, const std::string& crt_regex_as_string) - : m_config(config), m_linkage(linkage), m_crt_regex_as_string(crt_regex_as_string) - { - } - - ConfigurationType m_config; - LinkageType m_linkage; - std::string m_crt_regex_as_string; + backing_enum_t backing_enum; + ConfigurationType::type m_config; + LinkageType::type m_linkage; }; - bool operator ==(const BuildType& lhs, const BuildType& rhs); + static const std::string ENUM_NAME = "vcpkg::PostBuildLint::BuildType"; + + static constexpr type DEBUG_STATIC = type(backing_enum_t::DEBUG_STATIC, ConfigurationType::DEBUG, LinkageType::STATIC); + static constexpr type DEBUG_DYNAMIC = type(backing_enum_t::DEBUG_DYNAMIC, ConfigurationType::DEBUG, LinkageType::DYNAMIC); + static constexpr type RELEASE_STATIC = type(backing_enum_t::RELEASE_STATIC, ConfigurationType::RELEASE, LinkageType::STATIC); + static constexpr type RELEASE_DYNAMIC = type(backing_enum_t::RELEASE_DYNAMIC, ConfigurationType::RELEASE, LinkageType::DYNAMIC); + + static constexpr std::array values = { DEBUG_STATIC, DEBUG_DYNAMIC, RELEASE_STATIC, RELEASE_DYNAMIC }; - bool operator !=(const BuildType& lhs, const BuildType& rhs); + type value_of(const ConfigurationType::type& config, const LinkageType::type& linkage); } diff --git a/toolsrc/include/PostBuildLint_ConfigurationType.h b/toolsrc/include/PostBuildLint_ConfigurationType.h index 55dede921..7245d2932 100644 --- a/toolsrc/include/PostBuildLint_ConfigurationType.h +++ b/toolsrc/include/PostBuildLint_ConfigurationType.h @@ -2,13 +2,32 @@ #pragma once #include -namespace vcpkg::PostBuildLint +namespace vcpkg::PostBuildLint::ConfigurationType { - enum class ConfigurationType + enum class backing_enum_t { + NULLVALUE = 0, DEBUG = 1, RELEASE = 2 }; - std::string to_string(const ConfigurationType& conf); + struct type + { + constexpr type() : backing_enum(backing_enum_t::NULLVALUE) {} + constexpr explicit type(backing_enum_t backing_enum) : backing_enum(backing_enum) { } + constexpr operator backing_enum_t() const { return backing_enum; } + + const std::string& toString() const; + + private: + backing_enum_t backing_enum; + }; + + static const std::string ENUM_NAME = "vcpkg::PostBuildLint::ConfigurationType"; + + static constexpr type NULLVALUE(backing_enum_t::NULLVALUE); + static constexpr type DEBUG(backing_enum_t::DEBUG); + static constexpr type RELEASE(backing_enum_t::RELEASE); + + static constexpr std::array values = { DEBUG, RELEASE }; } diff --git a/toolsrc/include/PostBuildLint_LinkageType.h b/toolsrc/include/PostBuildLint_LinkageType.h index 7cca97639..0cecc8c9f 100644 --- a/toolsrc/include/PostBuildLint_LinkageType.h +++ b/toolsrc/include/PostBuildLint_LinkageType.h @@ -1,16 +1,34 @@ #pragma once #include -namespace vcpkg::PostBuildLint +namespace vcpkg::PostBuildLint::LinkageType { - enum class LinkageType + enum class backing_enum_t { + NULLVALUE = 0, DYNAMIC, - STATIC, - UNKNOWN + STATIC }; - LinkageType linkage_type_value_of(const std::string& as_string); + struct type + { + constexpr type() : backing_enum(backing_enum_t::NULLVALUE) {} + constexpr explicit type(backing_enum_t backing_enum) : backing_enum(backing_enum) { } + constexpr operator backing_enum_t() const { return backing_enum; } + + const std::string& toString() const; + + private: + backing_enum_t backing_enum; + }; + + static const std::string ENUM_NAME = "vcpkg::PostBuildLint::LinkageType"; + + static constexpr type NULLVALUE(backing_enum_t::NULLVALUE); + static constexpr type DYNAMIC(backing_enum_t::DYNAMIC); + static constexpr type STATIC(backing_enum_t::STATIC); + + static constexpr std::array values = { DYNAMIC, STATIC }; - std::string to_string(const LinkageType& build_info); + type value_of(const std::string& as_string); } -- cgit v1.2.3 From a13b2f0c92d1cd5322ed0cb839a4bba5b1ab6aa7 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 3 Feb 2017 18:10:29 -0800 Subject: build_package() modified to return the result of the build --- toolsrc/include/PostBuildLint.h | 2 +- toolsrc/include/vcpkg_Commands.h | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/PostBuildLint.h b/toolsrc/include/PostBuildLint.h index 215a237aa..73c8ec54b 100644 --- a/toolsrc/include/PostBuildLint.h +++ b/toolsrc/include/PostBuildLint.h @@ -4,5 +4,5 @@ namespace vcpkg::PostBuildLint { - void perform_all_checks(const package_spec& spec, const vcpkg_paths& paths); + size_t perform_all_checks(const package_spec& spec, const vcpkg_paths& paths); } diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 8d772b255..ef300ac12 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -11,7 +11,16 @@ namespace vcpkg::Commands namespace Build { - void build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir); + enum class BuildResult + { + BUILD_NOT_STARTED = 0, + SUCCESS, + CASCADED_DUE_TO_MISSING_DEPENDENCIES, + BUILD_FAILED, + POST_BUILD_CHECKS_FAILED, + }; + + BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir); void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); } -- cgit v1.2.3 From 37f45b9d5f5a8a46653d0553318315d890a4fb42 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 10 Feb 2017 14:57:02 -0800 Subject: Make StatusParagraph::find_installed() const --- toolsrc/include/StatusParagraphs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/StatusParagraphs.h b/toolsrc/include/StatusParagraphs.h index 11491cf4e..3c5d35183 100644 --- a/toolsrc/include/StatusParagraphs.h +++ b/toolsrc/include/StatusParagraphs.h @@ -20,7 +20,7 @@ namespace vcpkg } const_iterator find(const std::string& name, const triplet& target_triplet) const; iterator find(const std::string& name, const triplet& target_triplet); - iterator find_installed(const std::string& name, const triplet& target_triplet); + const_iterator find_installed(const std::string& name, const triplet& target_triplet) const; iterator insert(std::unique_ptr); -- cgit v1.2.3 From af583825a7068614b080536870b15cbaa6bcf10a Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 10 Feb 2017 16:51:36 -0800 Subject: [Checks] Add check_exit() overload with no message --- toolsrc/include/vcpkg_Checks.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Checks.h b/toolsrc/include/vcpkg_Checks.h index a58b38ac0..23869f35f 100644 --- a/toolsrc/include/vcpkg_Checks.h +++ b/toolsrc/include/vcpkg_Checks.h @@ -35,6 +35,8 @@ namespace vcpkg::Checks } } + void check_exit(bool expression); + void check_exit(bool expression, const char* errorMessage); template -- cgit v1.2.3 From c11b2c790e0260434d057cd5fbeccd59f36732c7 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 13:21:30 -0800 Subject: Rename wdupenv_str to get_environmental_variable() --- toolsrc/include/vcpkg_System.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h index c9195163c..92ceacc88 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg_System.h @@ -92,5 +92,5 @@ namespace vcpkg::System double microseconds() const; }; - std::wstring wdupenv_str(const wchar_t* varname) noexcept; + std::wstring get_environmental_variable(const wchar_t* varname) noexcept; } -- cgit v1.2.3 From 0d47ce63ed1cc5159a038de0a8446e3828b8aeeb Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 13:26:21 -0800 Subject: Add System::set_environmental_variable() --- toolsrc/include/vcpkg_System.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h index 92ceacc88..777f64bf4 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg_System.h @@ -93,4 +93,6 @@ namespace vcpkg::System }; std::wstring get_environmental_variable(const wchar_t* varname) noexcept; + + void set_environmental_variable(const wchar_t* varname, const wchar_t* varvalue) noexcept; } -- cgit v1.2.3 From b882f365e9aebf95c07c8667e38ae2730931f74e Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 15:35:34 -0800 Subject: System::get_environmental_variable() now returns optional<> --- toolsrc/include/vcpkg_System.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h index 777f64bf4..7634034ab 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg_System.h @@ -2,6 +2,7 @@ #include "vcpkg_Strings.h" #include "filesystem_fs.h" +#include "vcpkg_optional.h" namespace vcpkg::System { @@ -92,7 +93,7 @@ namespace vcpkg::System double microseconds() const; }; - std::wstring get_environmental_variable(const wchar_t* varname) noexcept; + optional get_environmental_variable(const wchar_t* varname) noexcept; void set_environmental_variable(const wchar_t* varname, const wchar_t* varvalue) noexcept; } -- cgit v1.2.3 From a7c5063d4d08c44c100eb62726ef31a95c1e5121 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 16:23:02 -0800 Subject: Add functions to find the Program Files folders on the C++ side. Resolves #606 --- toolsrc/include/vcpkg_Environment.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Environment.h b/toolsrc/include/vcpkg_Environment.h index e4dd47472..c27ce54c2 100644 --- a/toolsrc/include/vcpkg_Environment.h +++ b/toolsrc/include/vcpkg_Environment.h @@ -24,4 +24,8 @@ namespace vcpkg::Environment }; const vcvarsall_and_platform_toolset& get_vcvarsall_bat(const vcpkg_paths& paths); + + const fs::path& get_ProgramFiles_32_bit(); + + const fs::path& get_ProgramFiles_Platform_bitness(); } -- cgit v1.2.3 From a9a63192dd77837fd3cf9fb4d04469a54f793317 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 16:57:34 -0800 Subject: Function rename --- toolsrc/include/vcpkg_Environment.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Environment.h b/toolsrc/include/vcpkg_Environment.h index c27ce54c2..c2d2ed7ae 100644 --- a/toolsrc/include/vcpkg_Environment.h +++ b/toolsrc/include/vcpkg_Environment.h @@ -27,5 +27,5 @@ namespace vcpkg::Environment const fs::path& get_ProgramFiles_32_bit(); - const fs::path& get_ProgramFiles_Platform_bitness(); + const fs::path& get_ProgramFiles_platform_bitness(); } -- cgit v1.2.3 From 2b9035063234f04fb68c3b4fefe8d3da7a5175a6 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 10 Feb 2017 17:00:46 -0800 Subject: Separate dependency check from build_package() --- toolsrc/include/vcpkg_Commands.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index ef300ac12..86c77a8bf 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -2,6 +2,7 @@ #include "vcpkg_cmd_arguments.h" #include "vcpkg_paths.h" +#include "StatusParagraphs.h" namespace vcpkg::Commands { @@ -11,16 +12,22 @@ namespace vcpkg::Commands namespace Build { + enum class DependencyStatus + { + ALL_DEPENDENCIES_INSTALLED, + MISSING_DEPENDENCIES + }; + enum class BuildResult { BUILD_NOT_STARTED = 0, SUCCESS, - CASCADED_DUE_TO_MISSING_DEPENDENCIES, BUILD_FAILED, POST_BUILD_CHECKS_FAILED, }; - BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir); + DependencyStatus check_dependencies(const SourceParagraph& source_paragraph, const package_spec& spec, const StatusParagraphs& status_db); + BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const DependencyStatus& dependency_status); void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); } -- cgit v1.2.3 From c60c9de6e2371b31a79c58719df1d344b564111c Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 13 Feb 2017 14:01:27 -0800 Subject: Restore dependency check in build_package() --- toolsrc/include/vcpkg_Commands.h | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 86c77a8bf..c3cda3d87 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -12,22 +12,19 @@ namespace vcpkg::Commands namespace Build { - enum class DependencyStatus - { - ALL_DEPENDENCIES_INSTALLED, - MISSING_DEPENDENCIES - }; - enum class BuildResult { BUILD_NOT_STARTED = 0, - SUCCESS, + SUCCEEDED, BUILD_FAILED, POST_BUILD_CHECKS_FAILED, + CASCADED_DUE_TO_MISSING_DEPENDENCIES }; - DependencyStatus check_dependencies(const SourceParagraph& source_paragraph, const package_spec& spec, const StatusParagraphs& status_db); - BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const DependencyStatus& dependency_status); + const std::string& to_string(const BuildResult build_result); + std::string create_error_message(const std::string& package_id, const BuildResult build_result); + + BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db); void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); } -- cgit v1.2.3 From c432b66034a4efe304d79926bf81f92cb6e96ad6 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 13 Feb 2017 14:01:56 -0800 Subject: Introduce ci command: builds all packages of a triplet --- toolsrc/include/vcpkg_Commands.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index c3cda3d87..976e66c18 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -34,6 +34,12 @@ namespace vcpkg::Commands } namespace Install + { + void install_package(const vcpkg_paths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs* status_db); + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); + } + + namespace CI { void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); } -- cgit v1.2.3 From 6e25bcf7cb1efd6de55f97aa978acd24d90af476 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 13 Feb 2017 14:07:27 -0800 Subject: Swap parameters of Build::create_error_message() --- toolsrc/include/vcpkg_Commands.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 976e66c18..1dbc9c375 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -22,7 +22,7 @@ namespace vcpkg::Commands }; const std::string& to_string(const BuildResult build_result); - std::string create_error_message(const std::string& package_id, const BuildResult build_result); + std::string create_error_message(const BuildResult build_result, const std::string& package_id); BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db); void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); -- cgit v1.2.3 From 6824cc9264d245ebd1302c27eb714250c5f7ec13 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 13 Feb 2017 16:22:02 -0800 Subject: Extract create_user_troubleshooting_message(). CI doesn't call it, interactive commands do --- toolsrc/include/vcpkg_Commands.h | 1 + 1 file changed, 1 insertion(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 1dbc9c375..1e8b3b9df 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -23,6 +23,7 @@ namespace vcpkg::Commands const std::string& to_string(const BuildResult build_result); std::string create_error_message(const BuildResult build_result, const std::string& package_id); + std::string create_user_troubleshooting_message(const package_spec& spec); BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db); void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); -- cgit v1.2.3 From 430739c468f7ea3cc513b85339ac51c16073325c Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 13 Feb 2017 16:23:21 -0800 Subject: Change parameter from std::string to package_spec --- toolsrc/include/vcpkg_Commands.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 1e8b3b9df..471485e31 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -22,7 +22,7 @@ namespace vcpkg::Commands }; const std::string& to_string(const BuildResult build_result); - std::string create_error_message(const BuildResult build_result, const std::string& package_id); + std::string create_error_message(const BuildResult build_result, const package_spec& spec); std::string create_user_troubleshooting_message(const package_spec& spec); BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db); -- cgit v1.2.3 From ab2cca3dad9d7efdc87e40554ccb6dc582d22360 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 14:34:03 -0800 Subject: Add BuildResul_Values and rename NULLVALUE const --- toolsrc/include/vcpkg_Commands.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 471485e31..5c643d017 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -3,6 +3,7 @@ #include "vcpkg_cmd_arguments.h" #include "vcpkg_paths.h" #include "StatusParagraphs.h" +#include namespace vcpkg::Commands { @@ -14,13 +15,15 @@ namespace vcpkg::Commands { enum class BuildResult { - BUILD_NOT_STARTED = 0, + NULLVALUE = 0, SUCCEEDED, BUILD_FAILED, POST_BUILD_CHECKS_FAILED, CASCADED_DUE_TO_MISSING_DEPENDENCIES }; + static constexpr std::array BuildResult_values = { BuildResult::SUCCEEDED, BuildResult::BUILD_FAILED, BuildResult::POST_BUILD_CHECKS_FAILED, BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES }; + const std::string& to_string(const BuildResult build_result); std::string create_error_message(const BuildResult build_result, const package_spec& spec); std::string create_user_troubleshooting_message(const package_spec& spec); -- cgit v1.2.3 From b39b2d298d0a1c9e05d0fcaf3e801a0a5bd9cb41 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 18:38:40 -0800 Subject: Remove unused variable from create_remove_plan() --- toolsrc/include/vcpkg_Dependencies.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h index b63816089..dca824ee9 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -75,5 +75,5 @@ namespace vcpkg::Dependencies std::vector create_install_plan(const vcpkg_paths& paths, const std::vector& specs, const StatusParagraphs& status_db); - std::vector create_remove_plan(const vcpkg_paths& paths, const std::vector& specs, const StatusParagraphs& status_db); + std::vector create_remove_plan(const std::vector& specs, const StatusParagraphs& status_db); } -- cgit v1.2.3 From a62558fb793a0c8e31c189f8f5eebe3fc5c83f58 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 16 Feb 2017 16:29:52 -0800 Subject: Introduce ElapsedTime class --- toolsrc/include/Stopwatch.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/Stopwatch.h b/toolsrc/include/Stopwatch.h index 105a4b1ee..e4ae121b3 100644 --- a/toolsrc/include/Stopwatch.h +++ b/toolsrc/include/Stopwatch.h @@ -5,6 +5,25 @@ namespace vcpkg { + class ElapsedTime + { + public: + static ElapsedTime createStarted(); + + constexpr ElapsedTime() :m_startTick() {} + + template + TimeUnit elapsed() const + { + return std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - this->m_startTick); + } + + std::string toString() const; + + private: + std::chrono::steady_clock::time_point m_startTick; + }; + class Stopwatch { public: -- cgit v1.2.3 From e16084cc8d15b0c042871b0d1cffa6320a1681d4 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 16 Feb 2017 16:32:14 -0800 Subject: Rename Stopwatch.h/cpp to vcpkg_Chrono.h/cpp --- toolsrc/include/Stopwatch.h | 59 ------------------------------------------ toolsrc/include/vcpkg_Chrono.h | 59 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 59 deletions(-) delete mode 100644 toolsrc/include/Stopwatch.h create mode 100644 toolsrc/include/vcpkg_Chrono.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/Stopwatch.h b/toolsrc/include/Stopwatch.h deleted file mode 100644 index e4ae121b3..000000000 --- a/toolsrc/include/Stopwatch.h +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once - -#include -#include - -namespace vcpkg -{ - class ElapsedTime - { - public: - static ElapsedTime createStarted(); - - constexpr ElapsedTime() :m_startTick() {} - - template - TimeUnit elapsed() const - { - return std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - this->m_startTick); - } - - std::string toString() const; - - private: - std::chrono::steady_clock::time_point m_startTick; - }; - - class Stopwatch - { - public: - static Stopwatch createUnstarted(); - - static Stopwatch createStarted(); - - bool isRunning() const; - - const Stopwatch& start(); - - const Stopwatch& stop(); - - Stopwatch& reset(); - - template - TimeUnit elapsed() const - { - return std::chrono::duration_cast(elapsedNanos()); - } - - std::string toString() const; - - private: - Stopwatch(); - - std::chrono::nanoseconds elapsedNanos() const; - - bool m_isRunning; - std::chrono::nanoseconds m_elapsedNanos; - std::chrono::steady_clock::time_point m_startTick; - }; -} diff --git a/toolsrc/include/vcpkg_Chrono.h b/toolsrc/include/vcpkg_Chrono.h new file mode 100644 index 000000000..e4ae121b3 --- /dev/null +++ b/toolsrc/include/vcpkg_Chrono.h @@ -0,0 +1,59 @@ +#pragma once + +#include +#include + +namespace vcpkg +{ + class ElapsedTime + { + public: + static ElapsedTime createStarted(); + + constexpr ElapsedTime() :m_startTick() {} + + template + TimeUnit elapsed() const + { + return std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - this->m_startTick); + } + + std::string toString() const; + + private: + std::chrono::steady_clock::time_point m_startTick; + }; + + class Stopwatch + { + public: + static Stopwatch createUnstarted(); + + static Stopwatch createStarted(); + + bool isRunning() const; + + const Stopwatch& start(); + + const Stopwatch& stop(); + + Stopwatch& reset(); + + template + TimeUnit elapsed() const + { + return std::chrono::duration_cast(elapsedNanos()); + } + + std::string toString() const; + + private: + Stopwatch(); + + std::chrono::nanoseconds elapsedNanos() const; + + bool m_isRunning; + std::chrono::nanoseconds m_elapsedNanos; + std::chrono::steady_clock::time_point m_startTick; + }; +} -- cgit v1.2.3 From 532c4f6a536ae0952844b39aceef7542204938a9 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 00:16:52 -0800 Subject: Add vcpkg_cmd_arguments::check_no_optional_arguments() --- toolsrc/include/vcpkg_cmd_arguments.h | 1 + 1 file changed, 1 insertion(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_cmd_arguments.h b/toolsrc/include/vcpkg_cmd_arguments.h index 91f7de8ac..58bc46098 100644 --- a/toolsrc/include/vcpkg_cmd_arguments.h +++ b/toolsrc/include/vcpkg_cmd_arguments.h @@ -20,6 +20,7 @@ namespace vcpkg std::string command; std::vector command_arguments; + void vcpkg_cmd_arguments::check_no_optional_command_arguments() const; std::unordered_set check_and_get_optional_command_arguments(const std::vector& valid_options) const; void check_max_arg_count(const size_t expected_arg_count) const; -- cgit v1.2.3 From ff222fac454449b2fc108bf5271e1823db54d3da Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 14:55:37 -0800 Subject: [build_command] Extract function for calculations after Input processing --- toolsrc/include/vcpkg_Commands.h | 1 + 1 file changed, 1 insertion(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 5c643d017..7956cdab8 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -29,6 +29,7 @@ namespace vcpkg::Commands std::string create_user_troubleshooting_message(const package_spec& spec); BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db); + void perform_and_exit(const package_spec& spec, const fs::path& port_dir, const std::unordered_set& options, const vcpkg_paths& paths); void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); } -- cgit v1.2.3 From 71b985dd032c37fd88010b70fd03dc4a5cfa9cf9 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 15:10:43 -0800 Subject: Remove try_load_port() overload --- toolsrc/include/vcpkglib.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkglib.h b/toolsrc/include/vcpkglib.h index b1653d197..50635589a 100644 --- a/toolsrc/include/vcpkglib.h +++ b/toolsrc/include/vcpkglib.h @@ -22,10 +22,5 @@ namespace vcpkg expected try_load_port(const fs::path& control_path); - inline expected try_load_port(const vcpkg_paths& paths, const std::string& name) - { - return try_load_port(paths.ports / name); - } - expected try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec); } // namespace vcpkg -- cgit v1.2.3 From 4313d8f398e12093b866fa8029b712c86f1bc127 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 15:38:39 -0800 Subject: `owns`: check for --options --- toolsrc/include/vcpkg_Commands.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 7956cdab8..907190bfc 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -79,17 +79,17 @@ namespace vcpkg::Commands void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); } - namespace Import + namespace Owns { void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); } - namespace Owns + namespace Cache { void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); } - namespace Cache + namespace Import { void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); } -- cgit v1.2.3 From 39772adbfe37b03f7302b3a0d974404519c643ce Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 15:53:18 -0800 Subject: Remove unused function --- toolsrc/include/vcpkg_cmd_arguments.h | 1 - 1 file changed, 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_cmd_arguments.h b/toolsrc/include/vcpkg_cmd_arguments.h index 58bc46098..91f7de8ac 100644 --- a/toolsrc/include/vcpkg_cmd_arguments.h +++ b/toolsrc/include/vcpkg_cmd_arguments.h @@ -20,7 +20,6 @@ namespace vcpkg std::string command; std::vector command_arguments; - void vcpkg_cmd_arguments::check_no_optional_command_arguments() const; std::unordered_set check_and_get_optional_command_arguments(const std::vector& valid_options) const; void check_max_arg_count(const size_t expected_arg_count) const; -- cgit v1.2.3 From ac2ec94129ae0bdbcb16c0c2333fbfc52844d6c6 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 20:08:29 -0800 Subject: Change Info::version() to Version::version() --- toolsrc/include/vcpkg_Commands.h | 1 + toolsrc/include/vcpkg_info.h | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 907190bfc..3c3ae03c6 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -121,6 +121,7 @@ namespace vcpkg::Commands namespace Version { + const std::string& version(); void perform_and_exit(const vcpkg_cmd_arguments& args); } diff --git a/toolsrc/include/vcpkg_info.h b/toolsrc/include/vcpkg_info.h index 5380e0158..ebd87fd86 100644 --- a/toolsrc/include/vcpkg_info.h +++ b/toolsrc/include/vcpkg_info.h @@ -4,7 +4,5 @@ namespace vcpkg::Info { - const std::string& version(); - const std::string& email(); } -- cgit v1.2.3 From 43eb772d9475b4e9ec06eb54dca078a4793ab9e4 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 20:13:36 -0800 Subject: Change Info::email() to Contact::email(). Remove vcpkg_info.h/cpp --- toolsrc/include/vcpkg_Commands.h | 1 + toolsrc/include/vcpkg_info.h | 8 -------- 2 files changed, 1 insertion(+), 8 deletions(-) delete mode 100644 toolsrc/include/vcpkg_info.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 3c3ae03c6..544dffe72 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -127,6 +127,7 @@ namespace vcpkg::Commands namespace Contact { + const std::string& email(); void perform_and_exit(const vcpkg_cmd_arguments& args); } diff --git a/toolsrc/include/vcpkg_info.h b/toolsrc/include/vcpkg_info.h deleted file mode 100644 index ebd87fd86..000000000 --- a/toolsrc/include/vcpkg_info.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -#include - -namespace vcpkg::Info -{ - const std::string& email(); -} -- cgit v1.2.3 From 33952d2dd29208b0a28d3e058e33222ef454f04d Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 27 Feb 2017 15:13:13 -0800 Subject: Introduce function: load_all_ports() --- toolsrc/include/vcpkglib.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkglib.h b/toolsrc/include/vcpkglib.h index 50635589a..69cde7ea2 100644 --- a/toolsrc/include/vcpkglib.h +++ b/toolsrc/include/vcpkglib.h @@ -23,4 +23,6 @@ namespace vcpkg expected try_load_port(const fs::path& control_path); expected try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec); + + std::vector load_all_ports(const fs::path& ports_dir); } // namespace vcpkg -- cgit v1.2.3 From c0ae9fee7e30cdd4898df22aecf5412b2d8f8ee6 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 27 Feb 2017 15:45:56 -0800 Subject: Move some functions from vcpkglib.h to Paragraphs.h --- toolsrc/include/Paragraphs.h | 9 +++++++++ toolsrc/include/vcpkglib.h | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/Paragraphs.h b/toolsrc/include/Paragraphs.h index 761b49759..9564d2290 100644 --- a/toolsrc/include/Paragraphs.h +++ b/toolsrc/include/Paragraphs.h @@ -2,9 +2,18 @@ #include "filesystem_fs.h" #include +#include "expected.h" +#include "BinaryParagraph.h" +#include "vcpkg_paths.h" namespace vcpkg::Paragraphs { std::vector> get_paragraphs(const fs::path& control_path); std::vector> parse_paragraphs(const std::string& str); + + expected try_load_port(const fs::path& control_path); + + expected try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec); + + std::vector load_all_ports(const fs::path& ports_dir); } diff --git a/toolsrc/include/vcpkglib.h b/toolsrc/include/vcpkglib.h index 69cde7ea2..1ce55bd8a 100644 --- a/toolsrc/include/vcpkglib.h +++ b/toolsrc/include/vcpkglib.h @@ -1,7 +1,5 @@ #pragma once -#include "package_spec.h" -#include "BinaryParagraph.h" #include "StatusParagraphs.h" #include "vcpkg_paths.h" #include "ImmutableSortedVector.h" @@ -19,10 +17,4 @@ namespace vcpkg }; std::vector get_installed_files(const vcpkg_paths& paths, const StatusParagraphs& status_db); - - expected try_load_port(const fs::path& control_path); - - expected try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec); - - std::vector load_all_ports(const fs::path& ports_dir); } // namespace vcpkg -- cgit v1.2.3 From b7bd8c3251dcb9ecf3f6c0201c2a513596ab09b1 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 27 Feb 2017 15:52:57 -0800 Subject: Fix #include of Paragraph.h --- toolsrc/include/PostBuildLint_BuildInfo.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/PostBuildLint_BuildInfo.h b/toolsrc/include/PostBuildLint_BuildInfo.h index 7dbadb147..bac024e01 100644 --- a/toolsrc/include/PostBuildLint_BuildInfo.h +++ b/toolsrc/include/PostBuildLint_BuildInfo.h @@ -1,7 +1,6 @@ #pragma once -#include -#include "Paragraphs.h" +#include "filesystem_fs.h" #include "PostBuildLint_BuildPolicies.h" #include "opt_bool.h" #include "PostBuildLint_LinkageType.h" -- cgit v1.2.3 From 54859c0f1f201dfcc78e783c77c3b477d0c86c92 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 27 Feb 2017 16:14:36 -0800 Subject: Introduce extract_port_names_and_versions() --- toolsrc/include/Paragraphs.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/Paragraphs.h b/toolsrc/include/Paragraphs.h index 9564d2290..79b66a67f 100644 --- a/toolsrc/include/Paragraphs.h +++ b/toolsrc/include/Paragraphs.h @@ -1,7 +1,7 @@ #pragma once #include "filesystem_fs.h" -#include +#include #include "expected.h" #include "BinaryParagraph.h" #include "vcpkg_paths.h" @@ -16,4 +16,6 @@ namespace vcpkg::Paragraphs expected try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec); std::vector load_all_ports(const fs::path& ports_dir); + + std::map extract_port_names_and_versions(const std::vector& source_paragraphs); } -- cgit v1.2.3 From c2a368976dcd42640290a6ef30c5a4fc8a4a825d Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 3 Mar 2017 19:00:48 -0800 Subject: Add policy: NoDebugBinaries --- toolsrc/include/PostBuildLint_BuildPolicies.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/PostBuildLint_BuildPolicies.h b/toolsrc/include/PostBuildLint_BuildPolicies.h index 082de31d0..42bd3d718 100644 --- a/toolsrc/include/PostBuildLint_BuildPolicies.h +++ b/toolsrc/include/PostBuildLint_BuildPolicies.h @@ -8,7 +8,8 @@ namespace vcpkg::PostBuildLint::BuildPolicies { NULLVALUE = 0, EMPTY_PACKAGE, - DLLS_WITHOUT_LIBS + DLLS_WITHOUT_LIBS, + NO_DEBUG_BINARIES }; struct type @@ -29,8 +30,9 @@ namespace vcpkg::PostBuildLint::BuildPolicies static constexpr type NULLVALUE(backing_enum_t::NULLVALUE); static constexpr type EMPTY_PACKAGE(backing_enum_t::EMPTY_PACKAGE); static constexpr type DLLS_WITHOUT_LIBS(backing_enum_t::DLLS_WITHOUT_LIBS); + static constexpr type NO_DEBUG_BINARIES(backing_enum_t::NO_DEBUG_BINARIES); - static constexpr std::array values = { EMPTY_PACKAGE, DLLS_WITHOUT_LIBS }; + static constexpr std::array values = { EMPTY_PACKAGE, DLLS_WITHOUT_LIBS, NO_DEBUG_BINARIES }; type parse(const std::string& s); } -- cgit v1.2.3 From b03b578ffc27a9f0d4d9c7a8edc8edeea487dce3 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 3 Mar 2017 19:09:24 -0800 Subject: Rename policy to OnlyReleaseCRT --- toolsrc/include/PostBuildLint_BuildPolicies.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/PostBuildLint_BuildPolicies.h b/toolsrc/include/PostBuildLint_BuildPolicies.h index 42bd3d718..d815c6d27 100644 --- a/toolsrc/include/PostBuildLint_BuildPolicies.h +++ b/toolsrc/include/PostBuildLint_BuildPolicies.h @@ -9,7 +9,7 @@ namespace vcpkg::PostBuildLint::BuildPolicies NULLVALUE = 0, EMPTY_PACKAGE, DLLS_WITHOUT_LIBS, - NO_DEBUG_BINARIES + ONLY_RELEASE_CRT }; struct type @@ -30,9 +30,9 @@ namespace vcpkg::PostBuildLint::BuildPolicies static constexpr type NULLVALUE(backing_enum_t::NULLVALUE); static constexpr type EMPTY_PACKAGE(backing_enum_t::EMPTY_PACKAGE); static constexpr type DLLS_WITHOUT_LIBS(backing_enum_t::DLLS_WITHOUT_LIBS); - static constexpr type NO_DEBUG_BINARIES(backing_enum_t::NO_DEBUG_BINARIES); + static constexpr type ONLY_RELEASE_CRT(backing_enum_t::ONLY_RELEASE_CRT); - static constexpr std::array values = { EMPTY_PACKAGE, DLLS_WITHOUT_LIBS, NO_DEBUG_BINARIES }; + static constexpr std::array values = { EMPTY_PACKAGE, DLLS_WITHOUT_LIBS, ONLY_RELEASE_CRT }; type parse(const std::string& s); } -- cgit v1.2.3 From 19695fc832f289e2e5ae08335d49bca568af8e27 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Sat, 4 Mar 2017 06:25:05 -0800 Subject: [vcpkg] Deduplicate all timer classes. --- toolsrc/include/vcpkg_Chrono.h | 36 ++++-------------------------------- toolsrc/include/vcpkg_System.h | 9 --------- 2 files changed, 4 insertions(+), 41 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Chrono.h b/toolsrc/include/vcpkg_Chrono.h index e4ae121b3..a9d1bbbed 100644 --- a/toolsrc/include/vcpkg_Chrono.h +++ b/toolsrc/include/vcpkg_Chrono.h @@ -10,7 +10,7 @@ namespace vcpkg public: static ElapsedTime createStarted(); - constexpr ElapsedTime() :m_startTick() {} + constexpr ElapsedTime() : m_startTick() {} template TimeUnit elapsed() const @@ -18,42 +18,14 @@ namespace vcpkg return std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - this->m_startTick); } - std::string toString() const; - - private: - std::chrono::steady_clock::time_point m_startTick; - }; - - class Stopwatch - { - public: - static Stopwatch createUnstarted(); - - static Stopwatch createStarted(); - - bool isRunning() const; - - const Stopwatch& start(); - - const Stopwatch& stop(); - - Stopwatch& reset(); - - template - TimeUnit elapsed() const + double microseconds() const { - return std::chrono::duration_cast(elapsedNanos()); + return elapsed>().count(); } std::string toString() const; private: - Stopwatch(); - - std::chrono::nanoseconds elapsedNanos() const; - - bool m_isRunning; - std::chrono::nanoseconds m_elapsedNanos; - std::chrono::steady_clock::time_point m_startTick; + std::chrono::high_resolution_clock::time_point m_startTick; }; } diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h index 7634034ab..a414ba0d4 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg_System.h @@ -84,15 +84,6 @@ namespace vcpkg::System return println(c, Strings::format(messageTemplate, messageArgs...).c_str()); } - struct Stopwatch2 - { - int64_t start_time, end_time, freq; - - void start(); - void stop(); - double microseconds() const; - }; - optional get_environmental_variable(const wchar_t* varname) noexcept; void set_environmental_variable(const wchar_t* varname, const wchar_t* varvalue) noexcept; -- cgit v1.2.3 From 914664bf27b7bd339d09e3243fdbe4e5d54ef785 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Sat, 4 Mar 2017 06:48:59 -0800 Subject: [vcpkg-ci] Display per-package timing information. --- toolsrc/include/vcpkg_Strings.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Strings.h b/toolsrc/include/vcpkg_Strings.h index 8d5d7135b..5b536e5e1 100644 --- a/toolsrc/include/vcpkg_Strings.h +++ b/toolsrc/include/vcpkg_Strings.h @@ -19,6 +19,11 @@ namespace vcpkg::Strings::details return s; } + inline long long to_printf_arg(const long long s) + { + return s; + } + inline double to_printf_arg(const double s) { return s; -- cgit v1.2.3 From 3eb0526468d07824900c462ccfacdeffd7fa1969 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 6 Mar 2017 16:16:56 -0800 Subject: Properly handle spaces in path when calling powershell script --- toolsrc/include/vcpkg_System.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h index a414ba0d4..14f39ca40 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg_System.h @@ -28,6 +28,10 @@ namespace vcpkg::System return cmd_execute_and_capture_output(cmd_line.c_str()); } + std::wstring create_powershell_script_cmd(const fs::path& script_path); + + std::wstring create_powershell_script_cmd(const fs::path& script_path, const std::wstring& args); + enum class color { success = 10, -- cgit v1.2.3 From 4d0abd5841b9639c20126a5a25e2b0d4a9eb98d2 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Fri, 10 Mar 2017 15:43:54 -0800 Subject: [vcpkg] Refactor RAII registry key manipulation --- toolsrc/include/vcpkg_System.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h index 14f39ca40..ecb98aba7 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg_System.h @@ -1,11 +1,14 @@ #pragma once +#include #include "vcpkg_Strings.h" #include "filesystem_fs.h" #include "vcpkg_optional.h" namespace vcpkg::System { + optional get_registry_string(HKEY base, const wchar_t* subkey, const wchar_t* valuename); + fs::path get_exe_path_of_current_process(); struct exit_code_and_output -- cgit v1.2.3 From 07e43a7cae217f91808402020e19da2147f5d72b Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 8 Mar 2017 22:33:28 -0800 Subject: Nuke Joiner. Add wjoin() --- toolsrc/include/vcpkg_Strings.h | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Strings.h b/toolsrc/include/vcpkg_Strings.h index 5b536e5e1..abf3651e5 100644 --- a/toolsrc/include/vcpkg_Strings.h +++ b/toolsrc/include/vcpkg_Strings.h @@ -74,7 +74,7 @@ namespace vcpkg::Strings std::string ascii_to_lowercase(const std::string& input); template - static std::string join(const std::vector& v, const std::string& prefix, const std::string& delimiter, const std::string& suffix, Transformer transformer) + std::string join(const std::string& delimiter, const std::vector& v, Transformer transformer) { if (v.empty()) { @@ -84,7 +84,6 @@ namespace vcpkg::Strings std::string output; size_t size = v.size(); - output.append(prefix); output.append(transformer(v.at(0))); for (size_t i = 1; i < size; ++i) @@ -93,35 +92,35 @@ namespace vcpkg::Strings output.append(transformer(v.at(i))); } - output.append(suffix); return output; } - static std::string join(const std::vector& v, const std::string& prefix, const std::string& delimiter, const std::string& suffix); + std::string join(const std::string& delimiter, const std::vector& v); - class Joiner + template + std::wstring wjoin(const std::wstring& delimiter, const std::vector& v, Transformer transformer) { - public: - static Joiner on(const std::string& delimiter); + if (v.empty()) + { + return std::wstring(); + } - Joiner& prefix(const std::string& prefix); - Joiner& suffix(const std::string& suffix); + std::wstring output; + size_t size = v.size(); - std::string join(const std::vector& v) const; + output.append(transformer(v.at(0))); - template - std::string join(const std::vector& v, Transformer transformer) const + for (size_t i = 1; i < size; ++i) { - return Strings::join(v, this->m_prefix, this->m_delimiter, this->m_suffix, transformer); + output.append(delimiter); + output.append(transformer(v.at(i))); } - private: - explicit Joiner(const std::string& delimiter); + return output; + } + + std::wstring wjoin(const std::wstring& delimiter, const std::vector& v); - std::string m_prefix; - std::string m_delimiter; - std::string m_suffix; - }; void trim(std::string* s); -- cgit v1.2.3 From 47b53b9015deaa2f569d788447254c8bc3de96a9 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 9 Mar 2017 18:24:04 -0800 Subject: Add lazy.h --- toolsrc/include/lazy.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 toolsrc/include/lazy.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/lazy.h b/toolsrc/include/lazy.h new file mode 100644 index 000000000..f9dbd8dc7 --- /dev/null +++ b/toolsrc/include/lazy.h @@ -0,0 +1,26 @@ +#pragma once + +namespace vcpkg +{ + template + class lazy + { + public: + lazy() : value(T()), initialized(false) {} + + template + T const& get_lazy(F& f) const + { + if (!initialized) + { + value = f(); + initialized = true; + } + return value; + } + + private: + mutable T value; + mutable bool initialized; + }; +} -- cgit v1.2.3 From 7b14894dc75b720434e0a7095c05a11cfa308cc4 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 10 Mar 2017 16:30:44 -0800 Subject: [vcpkg_paths] Add get_cmake/git/nuget_exe() functions --- toolsrc/include/vcpkg_paths.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_paths.h b/toolsrc/include/vcpkg_paths.h index ba6defb9f..99fd14905 100644 --- a/toolsrc/include/vcpkg_paths.h +++ b/toolsrc/include/vcpkg_paths.h @@ -3,6 +3,7 @@ #include "expected.h" #include "package_spec.h" #include "BinaryParagraph.h" +#include "lazy.h" namespace vcpkg { @@ -35,5 +36,14 @@ namespace vcpkg fs::path vcpkg_dir_updates; fs::path ports_cmake; + + const fs::path& get_cmake_exe() const; + const fs::path& get_git_exe() const; + const fs::path& get_nuget_exe() const; + + private: + lazy cmake_exe; + lazy git_exe; + lazy nuget_exe; }; } -- cgit v1.2.3 From f93b3ccc4fb85bb9ef3f3f15d240647b44769fc4 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 10 Mar 2017 16:39:04 -0800 Subject: Introduce make_cmake_cmd() helper function --- toolsrc/include/vcpkglib.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkglib.h b/toolsrc/include/vcpkglib.h index 1ce55bd8a..353bfb0a0 100644 --- a/toolsrc/include/vcpkglib.h +++ b/toolsrc/include/vcpkglib.h @@ -17,4 +17,18 @@ namespace vcpkg }; std::vector get_installed_files(const vcpkg_paths& paths, const StatusParagraphs& status_db); + + + struct CMakeVariable + { + CMakeVariable(const std::wstring& varname, const wchar_t* varvalue); + CMakeVariable(const std::wstring& varname, const std::string& varvalue); + CMakeVariable(const std::wstring& varname, const std::wstring& varvalue); + CMakeVariable(const std::wstring& varname, const fs::path& path); + + std::wstring s; + }; + + std::wstring make_cmake_cmd(const fs::path& cmake_exe, const fs::path& cmake_script, const std::vector& pass_variables); + } // namespace vcpkg -- cgit v1.2.3 From b364239d0711a9749a61f16f2b101801e863b5c2 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 10 Mar 2017 16:47:13 -0800 Subject: Remove all Environment::ensure_X_on_path() --- toolsrc/include/vcpkg_Environment.h | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Environment.h b/toolsrc/include/vcpkg_Environment.h index c2d2ed7ae..5d12c8f6c 100644 --- a/toolsrc/include/vcpkg_Environment.h +++ b/toolsrc/include/vcpkg_Environment.h @@ -3,18 +3,6 @@ namespace vcpkg::Environment { - void ensure_nuget_on_path(const vcpkg_paths& paths); - - void ensure_git_on_path(const vcpkg_paths& paths); - - void ensure_cmake_on_path(const vcpkg_paths& paths); - - inline void ensure_utilities_on_path(const vcpkg_paths& paths) - { - ensure_cmake_on_path(paths); - ensure_git_on_path(paths); - } - const fs::path& get_dumpbin_exe(const vcpkg_paths& paths); struct vcvarsall_and_platform_toolset -- cgit v1.2.3 From 6860b461a1fc3a910cb64b0b55402685043237dd Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 10 Mar 2017 16:55:59 -0800 Subject: Introduce System::cmd_execute_clean() for sanitized executions --- toolsrc/include/pch.h | 1 + toolsrc/include/vcpkg_System.h | 7 +++++++ 2 files changed, 8 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/pch.h b/toolsrc/include/pch.h index 56f24f161..e78f17237 100644 --- a/toolsrc/include/pch.h +++ b/toolsrc/include/pch.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h index ecb98aba7..71caeed5e 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg_System.h @@ -17,6 +17,13 @@ namespace vcpkg::System std::string output; }; + int cmd_execute_clean(const wchar_t* cmd_line); + + inline int cmd_execute_clean(const std::wstring& cmd_line) + { + return cmd_execute_clean(cmd_line.c_str()); + } + int cmd_execute(const wchar_t* cmd_line); inline int cmd_execute(const std::wstring& cmd_line) -- cgit v1.2.3