From d2de7d3e7d1a0bea3dba9a0a7f6cfff68ae513a0 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 7 Sep 2017 16:16:30 -0700 Subject: [vcpkg_Build.h] Naming scheme, unneeded #include, unneeded inline --- toolsrc/include/vcpkg_Build.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Build.h b/toolsrc/include/vcpkg_Build.h index fc6f28e24..78e89d4de 100644 --- a/toolsrc/include/vcpkg_Build.h +++ b/toolsrc/include/vcpkg_Build.h @@ -9,7 +9,6 @@ #include #include -#include #include namespace vcpkg::Build @@ -56,7 +55,7 @@ namespace vcpkg::Build CASCADED_DUE_TO_MISSING_DEPENDENCIES }; - static constexpr std::array BuildResult_values = { + static constexpr std::array BUILD_RESULT_VALUES = { BuildResult::SUCCEEDED, BuildResult::BUILD_FAILED, BuildResult::POST_BUILD_CHECKS_FAILED, @@ -143,7 +142,7 @@ namespace vcpkg::Build COUNT, }; - constexpr std::array g_all_policies = { + constexpr std::array G_ALL_POLICIES = { BuildPolicy::EMPTY_PACKAGE, BuildPolicy::DLLS_WITHOUT_LIBS, BuildPolicy::ONLY_RELEASE_CRT, @@ -159,7 +158,7 @@ namespace vcpkg::Build BuildPolicies() = default; BuildPolicies(std::map&& map) : m_policies(std::move(map)) {} - inline bool is_enabled(BuildPolicy policy) const + bool is_enabled(BuildPolicy policy) const { const auto it = m_policies.find(policy); if (it != m_policies.cend()) return it->second; -- cgit v1.2.3 From 43dde3f4892be55558b012b845d864e7be95c7b9 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 13 Sep 2017 16:10:25 -0700 Subject: Refactor package removal code to eliminate its duplication --- toolsrc/include/vcpkg_Commands.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 756a12f01..079388587 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -82,6 +82,19 @@ namespace vcpkg::Commands namespace Remove { + enum class Purge + { + NO = 0, + YES + }; + + inline Purge to_purge(const bool value) { return value ? Purge::YES : Purge::NO; } + + void perform_remove_plan_action(const VcpkgPaths& paths, + const Dependencies::RemovePlanAction& action, + const Purge purge, + StatusParagraphs& status_db); + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); void remove_package(const VcpkgPaths& paths, const PackageSpec& spec, StatusParagraphs* status_db); } -- cgit v1.2.3 From d521d366b278e9e963c18d34a7c5f41f42ea9ec7 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 13 Sep 2017 17:23:04 -0700 Subject: Rework vcpkg install (and vcpkg ci) - Refactor install-plan-execution code to reduce duplication - Add `vcpkg install --keep-going` option - Add elapsed time to each invidial package and total time - Add a counter to the install (e.g. Starting package 3/12: ) --- toolsrc/include/vcpkg_Commands.h | 24 ++++++++++++++++++++++++ toolsrc/include/vcpkg_Dependencies.h | 2 ++ 2 files changed, 26 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 079388587..070a8ec49 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -33,6 +33,22 @@ namespace vcpkg::Commands namespace Install { + enum class KeepGoing + { + NO = 0, + YES + }; + + inline KeepGoing to_keep_going(const bool value) { return value ? KeepGoing::YES : KeepGoing::NO; } + + enum class PrintSummary + { + NO = 0, + YES + }; + + inline PrintSummary to_print_summary(const bool value) { return value ? PrintSummary::YES : PrintSummary::NO; } + struct InstallDir { static InstallDir from_destination_root(const fs::path& destination_root, @@ -67,6 +83,14 @@ namespace vcpkg::Commands InstallResult install_package(const VcpkgPaths& paths, const BinaryControlFile& binary_paragraph, StatusParagraphs* status_db); + + void perform_and_exit(const std::vector& action_plan, + const Build::BuildPackageOptions& install_plan_options, + const KeepGoing keep_going, + const PrintSummary print_summary, + const VcpkgPaths& paths, + StatusParagraphs& status_db); + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); } diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h index 235abb839..d67122e48 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -89,6 +89,8 @@ namespace vcpkg::Dependencies Optional install_plan; Optional remove_plan; + + const PackageSpec& spec() const; }; enum class ExportPlanType -- cgit v1.2.3 From 2d6029e41c68fd44b22f8cef1b13fbaa44c8fad9 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 14 Sep 2017 04:04:15 -0700 Subject: Introduce Version::warn_if_vcpkg_version_mismatch() --- 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 070a8ec49..590f0208c 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -210,6 +210,7 @@ namespace vcpkg::Commands namespace Version { const std::string& version(); + void warn_if_vcpkg_version_mismatch(const VcpkgPaths& paths); void perform_and_exit(const VcpkgCmdArguments& args); } -- cgit v1.2.3 From 0ccea4f3677d92a20935e03c2cb301d8300b43d1 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 27 Sep 2017 18:55:09 -0700 Subject: [Toolset selection] Use VS2017 vcvarsall for v140 if available --- toolsrc/include/VcpkgPaths.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/VcpkgPaths.h b/toolsrc/include/VcpkgPaths.h index d55c95fe1..3c1955204 100644 --- a/toolsrc/include/VcpkgPaths.h +++ b/toolsrc/include/VcpkgPaths.h @@ -19,6 +19,7 @@ namespace vcpkg { fs::path dumpbin; fs::path vcvarsall; + std::vector vcvarsall_options; CWStringView version; std::vector supported_architectures; }; @@ -71,5 +72,6 @@ namespace vcpkg Lazy git_exe; Lazy nuget_exe; Lazy> toolsets; + Lazy> toolsets_vs2017_v140; }; } -- cgit v1.2.3 From 2de9f83ff22774d0f70e3ee8158b26c494f5ea30 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Sun, 1 Oct 2017 13:22:29 -0700 Subject: Introduce Strings::case_insensitive_ascii_starts_with(); --- 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 61f6fab61..c44ce2b99 100644 --- a/toolsrc/include/vcpkg_Strings.h +++ b/toolsrc/include/vcpkg_Strings.h @@ -65,6 +65,8 @@ namespace vcpkg::Strings std::string ascii_to_lowercase(const std::string& input); + bool case_insensitive_ascii_starts_with(const std::string& s, const std::string& pattern); + template std::basic_string join(const CharType* delimiter, const Container& v, Transformer transformer) { -- cgit v1.2.3 From e25a31eca8550780ce96586ef27063728441b2e2 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 2 Oct 2017 16:55:06 -0700 Subject: Suppress 4768 warning from shlobj.h --- toolsrc/include/pch.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/pch.h b/toolsrc/include/pch.h index 770bcf07a..0f34063f8 100644 --- a/toolsrc/include/pch.h +++ b/toolsrc/include/pch.h @@ -2,7 +2,7 @@ #define NOMINMAX #define WIN32_LEAN_AND_MEAN - +#pragma warning(suppress : 4768) #include #include @@ -28,7 +28,10 @@ #include #include #include -#include +#pragma warning(push) +#pragma warning(disable : 4768) +#include +#pragma warning(pop) #include #include #include -- cgit v1.2.3 From 3838d5880470fdc884f035ed3d1c67d3bdd1e16e Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Tue, 3 Oct 2017 15:51:04 -0700 Subject: [vcpkg] Add more operator== to CStringView. Uppercase Span to follow naming convention. --- toolsrc/include/CStringView.h | 44 ++++++++++++++++++++++++++++++++++++++- toolsrc/include/SourceParagraph.h | 2 +- toolsrc/include/Span.h | 28 ++++++++++++++++++------- 3 files changed, 64 insertions(+), 10 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/CStringView.h b/toolsrc/include/CStringView.h index 282caad3a..c1810b4f1 100644 --- a/toolsrc/include/CStringView.h +++ b/toolsrc/include/CStringView.h @@ -11,13 +11,36 @@ namespace vcpkg constexpr BasicCStringView(const BasicCStringView&) = default; BasicCStringView(const std::basic_string& str) : cstr(str.c_str()) {} - constexpr operator const CharType*() const { return cstr; } constexpr const CharType* c_str() const { return cstr; } private: const CharType* cstr; }; + namespace details + { + inline bool vcpkg_strcmp(const char* l, const char* r) { return strcmp(l, r) == 0; } + inline bool vcpkg_strcmp(const wchar_t* l, const wchar_t* r) { return wcscmp(l, r) == 0; } + } + + template + bool operator==(const BasicCStringView& l, const BasicCStringView& r) + { + return details::vcpkg_strcmp(l.c_str(), r.c_str()); + } + + template + bool operator==(const CharType* l, const BasicCStringView& r) + { + return details::vcpkg_strcmp(l, r.c_str()); + } + + template + bool operator==(const BasicCStringView& r, const CharType* l) + { + return details::vcpkg_strcmp(l, r.c_str()); + } + template bool operator==(const std::basic_string& l, const BasicCStringView& r) { @@ -30,6 +53,25 @@ namespace vcpkg return l == r.c_str(); } + // notequals + template + bool operator!=(const BasicCStringView& l, const BasicCStringView& r) + { + return !details::vcpkg_strcmp(l.c_str(), r.c_str()); + } + + template + bool operator!=(const CharType* l, const BasicCStringView& r) + { + return !details::vcpkg_strcmp(l, r.c_str()); + } + + template + bool operator!=(const BasicCStringView& r, const CharType* l) + { + return !details::vcpkg_strcmp(l, r.c_str()); + } + template bool operator!=(const BasicCStringView& r, const std::basic_string& l) { diff --git a/toolsrc/include/SourceParagraph.h b/toolsrc/include/SourceParagraph.h index 1357b3769..ccf9faf4f 100644 --- a/toolsrc/include/SourceParagraph.h +++ b/toolsrc/include/SourceParagraph.h @@ -57,7 +57,7 @@ namespace vcpkg std::vector> feature_paragraphs; }; - void print_error_message(span> error_info_list); + void print_error_message(Span> error_info_list); inline void print_error_message(const std::unique_ptr& error_info_list) { return print_error_message({&error_info_list, 1}); diff --git a/toolsrc/include/Span.h b/toolsrc/include/Span.h index b16af2cef..b2c9acdbc 100644 --- a/toolsrc/include/Span.h +++ b/toolsrc/include/Span.h @@ -5,7 +5,7 @@ #include template -struct span +struct Span { public: using element_type = T; @@ -13,18 +13,18 @@ public: using reference = T&; using iterator = T*; - constexpr span() noexcept : m_ptr(nullptr), m_count(0) {} - constexpr span(std::nullptr_t) noexcept : span() {} - constexpr span(T* ptr, size_t count) noexcept : m_ptr(ptr), m_count(count) {} - constexpr span(T* ptr_begin, T* ptr_end) noexcept : m_ptr(ptr_begin), m_count(ptr_end - ptr_begin) {} + constexpr Span() noexcept : m_ptr(nullptr), m_count(0) {} + constexpr Span(std::nullptr_t) noexcept : Span() {} + constexpr Span(T* ptr, size_t count) noexcept : m_ptr(ptr), m_count(count) {} + constexpr Span(T* ptr_begin, T* ptr_end) noexcept : m_ptr(ptr_begin), m_count(ptr_end - ptr_begin) {} template - constexpr span(T (&arr)[N]) noexcept : span(arr, N) + constexpr Span(T (&arr)[N]) noexcept : Span(arr, N) { } - span(std::vector& v) noexcept : span(v.data(), v.size()) {} - span(const std::vector>& v) noexcept : span(v.data(), v.size()) {} + Span(std::vector& v) noexcept : Span(v.data(), v.size()) {} + Span(const std::vector>& v) noexcept : Span(v.data(), v.size()) {} constexpr iterator begin() const { return m_ptr; } constexpr iterator end() const { return m_ptr + m_count; } @@ -36,3 +36,15 @@ private: pointer m_ptr; size_t m_count; }; + +template +Span make_span(std::vector& v) +{ + return {v.data(), v.size()}; +} + +template +Span make_span(const std::vector& v) +{ + return {v.data(), v.size()}; +} -- cgit v1.2.3