From 8f0ebdf8d561ef8402db44cd9abb2c912cff276d Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Thu, 3 May 2018 15:03:35 -0700 Subject: [vcpkg] Remove utf16 usage from non-Windows --- toolsrc/include/vcpkg/base/strings.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/base/strings.h b/toolsrc/include/vcpkg/base/strings.h index 4cc17bcf4..e165c69da 100644 --- a/toolsrc/include/vcpkg/base/strings.h +++ b/toolsrc/include/vcpkg/base/strings.h @@ -34,9 +34,11 @@ namespace vcpkg::Strings return details::format_internal(fmtstr, to_printf_arg(to_printf_arg(args))...); } +#if defined(_WIN32) std::wstring to_utf16(const CStringView& s); std::string to_utf8(const wchar_t* w); +#endif std::string escape_string(const CStringView& s, char char_to_escape, char escape_char); -- cgit v1.2.3 From 1b0682a39e1143660c3d5aa371f66591a64e8a5d Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Sat, 5 May 2018 04:23:19 -0700 Subject: [vcpkg] Significantly reduce usage of powershell. Reduce console font switching bug --- toolsrc/include/vcpkg/base/system.h | 2 ++ toolsrc/include/vcpkg/commands.h | 4 ++-- toolsrc/include/vcpkg/vcpkgpaths.h | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/base/system.h b/toolsrc/include/vcpkg/base/system.h index 0d089276f..cf9c78868 100644 --- a/toolsrc/include/vcpkg/base/system.h +++ b/toolsrc/include/vcpkg/base/system.h @@ -47,6 +47,7 @@ namespace vcpkg::System ExitCodeAndOutput cmd_execute_and_capture_output(const CStringView cmd_line); +#if defined(_WIN32) void powershell_execute(const std::string& title, const fs::path& script_path, const std::vector& parameters = {}); @@ -54,6 +55,7 @@ namespace vcpkg::System std::string powershell_execute_and_capture_output(const std::string& title, const fs::path& script_path, const std::vector& parameters = {}); +#endif enum class Color { diff --git a/toolsrc/include/vcpkg/commands.h b/toolsrc/include/vcpkg/commands.h index 6d29b7960..708151dce 100644 --- a/toolsrc/include/vcpkg/commands.h +++ b/toolsrc/include/vcpkg/commands.h @@ -132,14 +132,14 @@ namespace vcpkg::Commands namespace Hash { std::string get_string_hash(const std::string& s, const std::string& hash_type); - std::string get_file_hash(const VcpkgPaths& paths, const fs::path& path, const std::string& hash_type); + std::string get_file_hash(const Files::Filesystem& fs, const fs::path& path, const std::string& hash_type); void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); } namespace Fetch { - std::vector find_toolset_instances(const VcpkgPaths& paths); + std::vector find_toolset_instances_prefered_first(const VcpkgPaths& paths); fs::path get_tool_path(const VcpkgPaths& paths, const std::string& tool); void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); } diff --git a/toolsrc/include/vcpkg/vcpkgpaths.h b/toolsrc/include/vcpkg/vcpkgpaths.h index 9c8f2911a..a3c90fd33 100644 --- a/toolsrc/include/vcpkg/vcpkgpaths.h +++ b/toolsrc/include/vcpkg/vcpkgpaths.h @@ -66,6 +66,7 @@ namespace vcpkg fs::path triplets; fs::path scripts; + fs::path tools; fs::path buildsystems; fs::path buildsystems_msbuild_targets; -- cgit v1.2.3 From f69cce7051e4404e19fe8c049c23c4678fe8b3d4 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 16 May 2018 15:30:26 -0700 Subject: Fix typo --- 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 708151dce..21e77aa52 100644 --- a/toolsrc/include/vcpkg/commands.h +++ b/toolsrc/include/vcpkg/commands.h @@ -139,7 +139,7 @@ namespace vcpkg::Commands namespace Fetch { - std::vector find_toolset_instances_prefered_first(const VcpkgPaths& paths); + std::vector find_toolset_instances_preferred_first(const VcpkgPaths& paths); fs::path get_tool_path(const VcpkgPaths& paths, const std::string& tool); void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); } -- cgit v1.2.3 From 285c69b0faa220311f3ccc60febaa2e7c6d87bb1 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Sat, 19 May 2018 19:01:10 -0700 Subject: [c++] Condense powershell helper code into the remaining single usage `vcpkg integrate powershell` uses it --- toolsrc/include/vcpkg/base/system.h | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/base/system.h b/toolsrc/include/vcpkg/base/system.h index cf9c78868..813d600cd 100644 --- a/toolsrc/include/vcpkg/base/system.h +++ b/toolsrc/include/vcpkg/base/system.h @@ -25,15 +25,6 @@ namespace vcpkg::System const fs::path& cmake_script, const std::vector& pass_variables); - struct PowershellParameter - { - PowershellParameter(const CStringView varname, const char* varvalue); - PowershellParameter(const CStringView varname, const std::string& varvalue); - PowershellParameter(const CStringView varname, const fs::path& path); - - std::string s; - }; - struct ExitCodeAndOutput { int exit_code; @@ -47,16 +38,6 @@ namespace vcpkg::System ExitCodeAndOutput cmd_execute_and_capture_output(const CStringView cmd_line); -#if defined(_WIN32) - void powershell_execute(const std::string& title, - const fs::path& script_path, - const std::vector& parameters = {}); - - std::string powershell_execute_and_capture_output(const std::string& title, - const fs::path& script_path, - const std::vector& parameters = {}); -#endif - enum class Color { success = 10, -- cgit v1.2.3 From 78e4d07e84afc0f1ab23179534aa08bf6e194b98 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Tue, 22 May 2018 03:37:40 -0700 Subject: [vcpkg] Improve CMake messages to account for case-sensitive filesystems. Improve CMake messages to display shortest targets first (which are hopefully the "public" ones). Also, fix bug in StringLiteral. --- toolsrc/include/vcpkg/base/stringliteral.h | 3 ++- toolsrc/include/vcpkg/base/strings.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/base/stringliteral.h b/toolsrc/include/vcpkg/base/stringliteral.h index c07f04cec..9970adc2a 100644 --- a/toolsrc/include/vcpkg/base/stringliteral.h +++ b/toolsrc/include/vcpkg/base/stringliteral.h @@ -7,7 +7,8 @@ namespace vcpkg struct StringLiteral { template - constexpr StringLiteral(const char (&str)[N]) : m_size(N), m_cstr(str) + constexpr StringLiteral(const char (&str)[N]) + : m_size(N - 1) /* -1 here accounts for the null byte at the end*/, m_cstr(str) { } diff --git a/toolsrc/include/vcpkg/base/strings.h b/toolsrc/include/vcpkg/base/strings.h index e165c69da..4b39b0a28 100644 --- a/toolsrc/include/vcpkg/base/strings.h +++ b/toolsrc/include/vcpkg/base/strings.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include @@ -53,6 +54,7 @@ namespace vcpkg::Strings std::string ascii_to_uppercase(std::string s); bool case_insensitive_ascii_starts_with(const std::string& s, const std::string& pattern); + bool ends_with(const std::string& s, StringLiteral pattern); template std::string join(const char* delimiter, const Container& v, Transformer transformer) -- cgit v1.2.3 From 3e76baa163880f59fc344dcff58fd48e526b4a39 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 19 Jun 2018 16:59:27 -0700 Subject: Introduce downloads.h/cpp --- toolsrc/include/vcpkg/base/downloads.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 toolsrc/include/vcpkg/base/downloads.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/base/downloads.h b/toolsrc/include/vcpkg/base/downloads.h new file mode 100644 index 000000000..f30e865a6 --- /dev/null +++ b/toolsrc/include/vcpkg/base/downloads.h @@ -0,0 +1,16 @@ +#pragma once + +#include + +namespace vcpkg::Downloads +{ + void verify_downloaded_file_hash(const Files::Filesystem& fs, + const std::string& url, + const fs::path& path, + const std::string& sha512); + + void download_file(vcpkg::Files::Filesystem& fs, + const std::string& url, + const fs::path& download_path, + const std::string& sha512); +} -- cgit v1.2.3 From dbae3bfe566c4c2d949ca6b2f84c6867f15e46ac Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 19 Jun 2018 17:21:34 -0700 Subject: Introduce archives.h/cpp --- toolsrc/include/vcpkg/base/archives.h | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 toolsrc/include/vcpkg/base/archives.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/base/archives.h b/toolsrc/include/vcpkg/base/archives.h new file mode 100644 index 000000000..cfb9f84c0 --- /dev/null +++ b/toolsrc/include/vcpkg/base/archives.h @@ -0,0 +1,9 @@ +#pragma once + +#include +#include + +namespace vcpkg::Archives +{ + void extract_archive(const VcpkgPaths& paths, const fs::path& archive, const fs::path& to_path); +} -- cgit v1.2.3 From c256ccf4526decec0422d8fc9d91ceb8fcf6160b Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 19 Jun 2018 17:51:20 -0700 Subject: Introduce stringrange.h/cpp and visualstudio.h/cpp --- toolsrc/include/vcpkg/base/stringrange.h | 33 ++++++++++++++++++++++++++++++++ toolsrc/include/vcpkg/commands.h | 1 - toolsrc/include/vcpkg/visualstudio.h | 12 ++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 toolsrc/include/vcpkg/base/stringrange.h create mode 100644 toolsrc/include/vcpkg/visualstudio.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/base/stringrange.h b/toolsrc/include/vcpkg/base/stringrange.h new file mode 100644 index 000000000..94bd584af --- /dev/null +++ b/toolsrc/include/vcpkg/base/stringrange.h @@ -0,0 +1,33 @@ +#pragma once + +#include + +#include +#include + +namespace vcpkg +{ + struct VcpkgStringRange + { + static std::vector find_all_enclosed(const VcpkgStringRange& input, + const std::string& left_delim, + const std::string& right_delim); + + static VcpkgStringRange find_exactly_one_enclosed(const VcpkgStringRange& input, + const std::string& left_tag, + const std::string& right_tag); + + static Optional find_at_most_one_enclosed(const VcpkgStringRange& input, + const std::string& left_tag, + const std::string& right_tag); + + VcpkgStringRange() = default; + VcpkgStringRange(const std::string& s); // Implicit by design + VcpkgStringRange(const std::string::const_iterator begin, const std::string::const_iterator end); + + std::string::const_iterator begin; + std::string::const_iterator end; + + std::string to_string() const; + }; +} diff --git a/toolsrc/include/vcpkg/commands.h b/toolsrc/include/vcpkg/commands.h index 21e77aa52..e4ea44334 100644 --- a/toolsrc/include/vcpkg/commands.h +++ b/toolsrc/include/vcpkg/commands.h @@ -139,7 +139,6 @@ namespace vcpkg::Commands namespace Fetch { - std::vector find_toolset_instances_preferred_first(const VcpkgPaths& paths); fs::path get_tool_path(const VcpkgPaths& paths, const std::string& tool); void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); } diff --git a/toolsrc/include/vcpkg/visualstudio.h b/toolsrc/include/vcpkg/visualstudio.h new file mode 100644 index 000000000..b93b145d9 --- /dev/null +++ b/toolsrc/include/vcpkg/visualstudio.h @@ -0,0 +1,12 @@ +#pragma once + +#if defined(_WIN32) + +#include + +namespace vcpkg::VisualStudio +{ + std::vector find_toolset_instances_preferred_first(const VcpkgPaths& paths); +} + +#endif -- cgit v1.2.3 From 31374871f2011b419a0aed09ad16201037230b15 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 19 Jun 2018 17:52:20 -0700 Subject: Rename VcpkgStringRange -> StringRange --- toolsrc/include/vcpkg/base/stringrange.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/base/stringrange.h b/toolsrc/include/vcpkg/base/stringrange.h index 94bd584af..6126ec48f 100644 --- a/toolsrc/include/vcpkg/base/stringrange.h +++ b/toolsrc/include/vcpkg/base/stringrange.h @@ -7,23 +7,23 @@ namespace vcpkg { - struct VcpkgStringRange + struct StringRange { - static std::vector find_all_enclosed(const VcpkgStringRange& input, - const std::string& left_delim, - const std::string& right_delim); + static std::vector find_all_enclosed(const StringRange& input, + const std::string& left_delim, + const std::string& right_delim); - static VcpkgStringRange find_exactly_one_enclosed(const VcpkgStringRange& input, - const std::string& left_tag, - const std::string& right_tag); + static StringRange find_exactly_one_enclosed(const StringRange& input, + const std::string& left_tag, + const std::string& right_tag); - static Optional find_at_most_one_enclosed(const VcpkgStringRange& input, - const std::string& left_tag, - const std::string& right_tag); + static Optional find_at_most_one_enclosed(const StringRange& input, + const std::string& left_tag, + const std::string& right_tag); - VcpkgStringRange() = default; - VcpkgStringRange(const std::string& s); // Implicit by design - VcpkgStringRange(const std::string::const_iterator begin, const std::string::const_iterator end); + StringRange() = default; + StringRange(const std::string& s); // Implicit by design + StringRange(const std::string::const_iterator begin, const std::string::const_iterator end); std::string::const_iterator begin; std::string::const_iterator end; -- cgit v1.2.3 From 6b7b82c58ad0a52d38ed24ca8c932aaedbc14ae2 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 19 Jun 2018 16:46:19 -0700 Subject: [fetch] Refactor to allow getting the version along with the path --- 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 e4ea44334..c6310c340 100644 --- a/toolsrc/include/vcpkg/commands.h +++ b/toolsrc/include/vcpkg/commands.h @@ -140,6 +140,7 @@ namespace vcpkg::Commands namespace Fetch { fs::path get_tool_path(const VcpkgPaths& paths, const std::string& tool); + std::string get_tool_version(const VcpkgPaths& paths, const std::string& tool); void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); } -- cgit v1.2.3 From 0ad79a67c76a7fbb26142b319eef069d7ba71557 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Wed, 27 Jun 2018 17:40:51 -0700 Subject: [vcpkg] Enable storing archives across filesystems --- toolsrc/include/vcpkg/base/files.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/base/files.h b/toolsrc/include/vcpkg/base/files.h index f16805d0a..1518d2b5c 100644 --- a/toolsrc/include/vcpkg/base/files.h +++ b/toolsrc/include/vcpkg/base/files.h @@ -37,6 +37,10 @@ namespace vcpkg::Files virtual void write_contents(const fs::path& file_path, const std::string& data, std::error_code& ec) = 0; virtual void rename(const fs::path& oldpath, const fs::path& newpath) = 0; virtual void rename(const fs::path& oldpath, const fs::path& newpath, std::error_code& ec) = 0; + virtual void rename_or_copy(const fs::path& oldpath, + const fs::path& newpath, + StringLiteral temp_suffix, + std::error_code& ec) = 0; virtual bool remove(const fs::path& path) = 0; virtual bool remove(const fs::path& path, std::error_code& ec) = 0; virtual std::uintmax_t remove_all(const fs::path& path, std::error_code& ec) = 0; -- cgit v1.2.3 From 3314845a92852d3461a86d15ca5d6b2a6ca859eb Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Wed, 27 Jun 2018 16:29:16 -0700 Subject: [vcpkg] Remove calls to where.exe to improve startup performance --- toolsrc/include/vcpkg/base/files.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/base/files.h b/toolsrc/include/vcpkg/base/files.h index 1518d2b5c..eee910841 100644 --- a/toolsrc/include/vcpkg/base/files.h +++ b/toolsrc/include/vcpkg/base/files.h @@ -57,13 +57,9 @@ namespace vcpkg::Files std::error_code& ec) = 0; virtual fs::file_status status(const fs::path& path, std::error_code& ec) const = 0; - inline void write_contents(const fs::path& file_path, const std::string& data) - { - std::error_code ec; - write_contents(file_path, data, ec); - Checks::check_exit( - VCPKG_LINE_INFO, !ec, "error while writing file: %s: %s", file_path.u8string(), ec.message()); - } + virtual std::vector find_from_PATH(const std::string& name) const = 0; + + void write_contents(const fs::path& file_path, const std::string& data); }; Filesystem& get_real_filesystem(); @@ -73,6 +69,4 @@ namespace vcpkg::Files bool has_invalid_chars_for_filesystem(const std::string& s); void print_paths(const std::vector& paths); - - std::vector find_from_PATH(const std::string& name); } -- cgit v1.2.3 From 3ff69f138bd4e9d364cf95731e95213b45473084 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Fri, 29 Jun 2018 01:33:54 -0700 Subject: [vcpkg] Warn instead of fail on tombstone --- toolsrc/include/vcpkg/build.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/build.h b/toolsrc/include/vcpkg/build.h index c5e7e8d88..f27e9d67b 100644 --- a/toolsrc/include/vcpkg/build.h +++ b/toolsrc/include/vcpkg/build.h @@ -64,6 +64,18 @@ namespace vcpkg::Build }; const std::string& to_string(DownloadTool tool); + enum class BinaryCaching + { + NO = 0, + YES + }; + + enum class FailOnTombstone + { + NO = 0, + YES + }; + struct BuildPackageOptions { UseHeadVersion use_head_version; @@ -71,6 +83,8 @@ namespace vcpkg::Build CleanBuildtrees clean_buildtrees; CleanPackages clean_packages; DownloadTool download_tool; + BinaryCaching binary_caching; + FailOnTombstone fail_on_tombstone; }; enum class BuildResult -- cgit v1.2.3 From 03a038cb8656ef70b86b215511d15bb8b956c207 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Fri, 29 Jun 2018 02:14:30 -0700 Subject: [vcpkg] Improve metrics performance on Windows --- toolsrc/include/vcpkg/base/system.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/base/system.h b/toolsrc/include/vcpkg/base/system.h index 813d600cd..3c4326ade 100644 --- a/toolsrc/include/vcpkg/base/system.h +++ b/toolsrc/include/vcpkg/base/system.h @@ -36,6 +36,10 @@ namespace vcpkg::System int cmd_execute(const CStringView cmd_line); +#if defined(_WIN32) + void cmd_execute_no_wait(const CStringView cmd_line); +#endif + ExitCodeAndOutput cmd_execute_and_capture_output(const CStringView cmd_line); enum class Color -- cgit v1.2.3 From 802f51a142283a117bf5bfa3f456493d8a20017d Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Mon, 9 Jul 2018 06:29:37 -0700 Subject: [vcpkg] Split vcpkg::Commands::Fetch into backend and frontend --- toolsrc/include/vcpkg/commands.h | 2 -- toolsrc/include/vcpkg/tools.h | 21 +++++++++++++++++++++ toolsrc/include/vcpkg/vcpkgpaths.h | 5 ++++- 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 toolsrc/include/vcpkg/tools.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/commands.h b/toolsrc/include/vcpkg/commands.h index c6310c340..78b4dda50 100644 --- a/toolsrc/include/vcpkg/commands.h +++ b/toolsrc/include/vcpkg/commands.h @@ -139,8 +139,6 @@ namespace vcpkg::Commands namespace Fetch { - fs::path get_tool_path(const VcpkgPaths& paths, const std::string& tool); - std::string get_tool_version(const VcpkgPaths& paths, const std::string& tool); void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); } diff --git a/toolsrc/include/vcpkg/tools.h b/toolsrc/include/vcpkg/tools.h new file mode 100644 index 000000000..6a096c321 --- /dev/null +++ b/toolsrc/include/vcpkg/tools.h @@ -0,0 +1,21 @@ +#pragma once + +#include + +#include +#include + +namespace vcpkg +{ + struct VcpkgPaths; + + struct ToolCache + { + virtual ~ToolCache() {} + + virtual const fs::path& get_tool_path(const VcpkgPaths& paths, const std::string& tool) const = 0; + virtual const std::string& get_tool_version(const VcpkgPaths& paths, const std::string& tool) const = 0; + }; + + std::unique_ptr get_tool_cache(); +} diff --git a/toolsrc/include/vcpkg/vcpkgpaths.h b/toolsrc/include/vcpkg/vcpkgpaths.h index a3c90fd33..42de40d9c 100644 --- a/toolsrc/include/vcpkg/vcpkgpaths.h +++ b/toolsrc/include/vcpkg/vcpkgpaths.h @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -78,6 +79,7 @@ namespace vcpkg fs::path ports_cmake; const fs::path& get_tool_exe(const std::string& tool) const; + const std::string& get_tool_version(const std::string& tool) const; /// Retrieve a toolset matching a VS version /// @@ -89,10 +91,11 @@ namespace vcpkg private: Lazy> available_triplets; - Cache tool_paths; Lazy> toolsets; Lazy> toolsets_vs2013; fs::path default_vs_path; + + mutable std::unique_ptr m_tool_cache; }; } -- cgit v1.2.3 From d977ac231e995250c169ac1778b7de34f7f57ead Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Sat, 7 Jul 2018 02:55:03 -0700 Subject: [vcpkg] Remove vcpkg::Archives from vcpkg::base. Add vcpkg::Hash. --- toolsrc/include/vcpkg/archives.h | 9 +++++++++ toolsrc/include/vcpkg/base/archives.h | 9 --------- toolsrc/include/vcpkg/base/downloads.h | 32 ++++++++++++++++---------------- toolsrc/include/vcpkg/base/hash.h | 11 +++++++++++ toolsrc/include/vcpkg/commands.h | 3 --- 5 files changed, 36 insertions(+), 28 deletions(-) create mode 100644 toolsrc/include/vcpkg/archives.h delete mode 100644 toolsrc/include/vcpkg/base/archives.h create mode 100644 toolsrc/include/vcpkg/base/hash.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/archives.h b/toolsrc/include/vcpkg/archives.h new file mode 100644 index 000000000..2298f9e1e --- /dev/null +++ b/toolsrc/include/vcpkg/archives.h @@ -0,0 +1,9 @@ +#pragma once + +#include +#include + +namespace vcpkg::Archives +{ + void extract_archive(const VcpkgPaths& paths, const fs::path& archive, const fs::path& to_path); +} diff --git a/toolsrc/include/vcpkg/base/archives.h b/toolsrc/include/vcpkg/base/archives.h deleted file mode 100644 index cfb9f84c0..000000000 --- a/toolsrc/include/vcpkg/base/archives.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include -#include - -namespace vcpkg::Archives -{ - void extract_archive(const VcpkgPaths& paths, const fs::path& archive, const fs::path& to_path); -} diff --git a/toolsrc/include/vcpkg/base/downloads.h b/toolsrc/include/vcpkg/base/downloads.h index f30e865a6..61c792488 100644 --- a/toolsrc/include/vcpkg/base/downloads.h +++ b/toolsrc/include/vcpkg/base/downloads.h @@ -1,16 +1,16 @@ -#pragma once - -#include - -namespace vcpkg::Downloads -{ - void verify_downloaded_file_hash(const Files::Filesystem& fs, - const std::string& url, - const fs::path& path, - const std::string& sha512); - - void download_file(vcpkg::Files::Filesystem& fs, - const std::string& url, - const fs::path& download_path, - const std::string& sha512); -} +#pragma once + +#include + +namespace vcpkg::Downloads +{ + void verify_downloaded_file_hash(const Files::Filesystem& fs, + const std::string& url, + const fs::path& path, + const std::string& sha512); + + void download_file(Files::Filesystem& fs, + const std::string& url, + const fs::path& download_path, + const std::string& sha512); +} diff --git a/toolsrc/include/vcpkg/base/hash.h b/toolsrc/include/vcpkg/base/hash.h new file mode 100644 index 000000000..9e6f118c0 --- /dev/null +++ b/toolsrc/include/vcpkg/base/hash.h @@ -0,0 +1,11 @@ +#pragma once + +#include + +#include + +namespace vcpkg::Hash +{ + std::string get_string_hash(const std::string& s, const std::string& hash_type); + std::string get_file_hash(const Files::Filesystem& fs, const fs::path& path, const std::string& hash_type); +} diff --git a/toolsrc/include/vcpkg/commands.h b/toolsrc/include/vcpkg/commands.h index 78b4dda50..57bd83db9 100644 --- a/toolsrc/include/vcpkg/commands.h +++ b/toolsrc/include/vcpkg/commands.h @@ -131,9 +131,6 @@ namespace vcpkg::Commands namespace Hash { - std::string get_string_hash(const std::string& s, const std::string& hash_type); - std::string get_file_hash(const Files::Filesystem& fs, const fs::path& path, const std::string& hash_type); - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); } -- cgit v1.2.3 From da9850efc76bac723afed1caf17072fcac65273d Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Mon, 9 Jul 2018 10:02:37 -0700 Subject: [vcpkg-ci] Fix bug in "vcpkg ci" which results in different features being installed than originally desired. --- toolsrc/include/vcpkg/commands.h | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/commands.h b/toolsrc/include/vcpkg/commands.h index 57bd83db9..1858a320f 100644 --- a/toolsrc/include/vcpkg/commands.h +++ b/toolsrc/include/vcpkg/commands.h @@ -25,17 +25,7 @@ namespace vcpkg::Commands namespace CI { - struct UnknownCIPortsResults - { - std::vector unknown; - std::map known; - }; - extern const CommandStructure COMMAND_STRUCTURE; - UnknownCIPortsResults find_unknown_ports_for_ci(const VcpkgPaths& paths, - const std::set& exclusions, - const Dependencies::PortFileProvider& provider, - const std::vector& fspecs); void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); } -- cgit v1.2.3 From 1f79c92eb099de356a5cb1e42234bb227e09d543 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 18 Sep 2018 20:55:35 -0700 Subject: Add command x-vsinstances --- toolsrc/include/vcpkg/commands.h | 6 ++++++ toolsrc/include/vcpkg/visualstudio.h | 2 ++ 2 files changed, 8 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/commands.h b/toolsrc/include/vcpkg/commands.h index 1858a320f..fd7d832b3 100644 --- a/toolsrc/include/vcpkg/commands.h +++ b/toolsrc/include/vcpkg/commands.h @@ -119,6 +119,12 @@ namespace vcpkg::Commands void perform_and_exit(const VcpkgCmdArguments& args); } + namespace X_VSInstances + { + extern const CommandStructure COMMAND_STRUCTURE; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + namespace Hash { void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); diff --git a/toolsrc/include/vcpkg/visualstudio.h b/toolsrc/include/vcpkg/visualstudio.h index b93b145d9..cd99db352 100644 --- a/toolsrc/include/vcpkg/visualstudio.h +++ b/toolsrc/include/vcpkg/visualstudio.h @@ -6,6 +6,8 @@ namespace vcpkg::VisualStudio { + std::vector get_visual_studio_instances(const VcpkgPaths& paths); + std::vector find_toolset_instances_preferred_first(const VcpkgPaths& paths); } -- cgit v1.2.3 From 276da906c51d5ddccd9c282fdcb75db36944dc62 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 8 Oct 2018 17:14:28 -0700 Subject: Remove status_known() --- toolsrc/include/vcpkg/base/files.h | 1 - 1 file changed, 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/base/files.h b/toolsrc/include/vcpkg/base/files.h index eee910841..ed12ffd74 100644 --- a/toolsrc/include/vcpkg/base/files.h +++ b/toolsrc/include/vcpkg/base/files.h @@ -20,7 +20,6 @@ namespace fs inline bool is_regular_file(file_status s) { return stdfs::is_regular_file(s); } inline bool is_directory(file_status s) { return stdfs::is_directory(s); } - inline bool status_known(file_status s) { return stdfs::status_known(s); } } namespace vcpkg::Files -- cgit v1.2.3 From 56e1d2f6961693b45f2b61b6e6985229be56e674 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Tue, 16 Oct 2018 00:35:47 -0700 Subject: [vcpkg] Wrap all external process spawning in a Ctrl-C catcher to avoid corrupted consoles --- toolsrc/include/vcpkg/base/system.h | 8 ++++---- toolsrc/include/vcpkg/globalstate.h | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/base/system.h b/toolsrc/include/vcpkg/base/system.h index 3c4326ade..005e09a3f 100644 --- a/toolsrc/include/vcpkg/base/system.h +++ b/toolsrc/include/vcpkg/base/system.h @@ -32,15 +32,15 @@ namespace vcpkg::System }; int cmd_execute_clean(const CStringView cmd_line, - const std::unordered_map& extra_env = {}); + const std::unordered_map& extra_env = {}) noexcept; - int cmd_execute(const CStringView cmd_line); + int cmd_execute(const CStringView cmd_line) noexcept; #if defined(_WIN32) - void cmd_execute_no_wait(const CStringView cmd_line); + void cmd_execute_no_wait(const CStringView cmd_line) noexcept; #endif - ExitCodeAndOutput cmd_execute_and_capture_output(const CStringView cmd_line); + ExitCodeAndOutput cmd_execute_and_capture_output(const CStringView cmd_line) noexcept; enum class Color { diff --git a/toolsrc/include/vcpkg/globalstate.h b/toolsrc/include/vcpkg/globalstate.h index bc28e3ff8..2a76c8741 100644 --- a/toolsrc/include/vcpkg/globalstate.h +++ b/toolsrc/include/vcpkg/globalstate.h @@ -18,5 +18,25 @@ namespace vcpkg static std::atomic g_init_console_cp; static std::atomic g_init_console_output_cp; + static std::atomic g_init_console_initialized; + + struct CtrlCStateMachine + { + void transition_to_spawn_process() noexcept; + void transition_from_spawn_process() noexcept; + void transition_handle_ctrl_c() noexcept; + + private: + enum class CtrlCState + { + normal, + blocked_on_child, + exit_requested, + }; + + std::atomic m_state = CtrlCState::normal; + }; + + static CtrlCStateMachine g_ctrl_c_state; }; } -- cgit v1.2.3 From df82d21f320285a8f4cbf16756d8e035cdc74e7c Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Tue, 16 Oct 2018 05:53:57 -0700 Subject: [vcpkg] Fix OSX build for old GCC versions --- toolsrc/include/vcpkg/globalstate.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/globalstate.h b/toolsrc/include/vcpkg/globalstate.h index 2a76c8741..ae66ca355 100644 --- a/toolsrc/include/vcpkg/globalstate.h +++ b/toolsrc/include/vcpkg/globalstate.h @@ -22,6 +22,8 @@ namespace vcpkg struct CtrlCStateMachine { + CtrlCStateMachine(); + void transition_to_spawn_process() noexcept; void transition_from_spawn_process() noexcept; void transition_handle_ctrl_c() noexcept; @@ -34,7 +36,7 @@ namespace vcpkg exit_requested, }; - std::atomic m_state = CtrlCState::normal; + std::atomic m_state; }; static CtrlCStateMachine g_ctrl_c_state; -- cgit v1.2.3 From 3d12e5ca72d948121463beec6e48290877684471 Mon Sep 17 00:00:00 2001 From: LRFLEW Date: Wed, 17 Oct 2018 12:46:27 -0600 Subject: Handle symlink when installing or removing a library (#4479) --- toolsrc/include/vcpkg/base/files.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/base/files.h b/toolsrc/include/vcpkg/base/files.h index ed12ffd74..b07ff25b3 100644 --- a/toolsrc/include/vcpkg/base/files.h +++ b/toolsrc/include/vcpkg/base/files.h @@ -20,6 +20,7 @@ namespace fs inline bool is_regular_file(file_status s) { return stdfs::is_regular_file(s); } inline bool is_directory(file_status s) { return stdfs::is_directory(s); } + inline bool is_symlink(file_status s) { return stdfs::is_symlink(s); } } namespace vcpkg::Files @@ -54,7 +55,9 @@ namespace vcpkg::Files const fs::path& newpath, fs::copy_options opts, std::error_code& ec) = 0; + virtual void copy_symlink(const fs::path& oldpath, const fs::path& newpath, std::error_code& ec) = 0; virtual fs::file_status status(const fs::path& path, std::error_code& ec) const = 0; + virtual fs::file_status symlink_status(const fs::path& path, std::error_code& ec) const = 0; virtual std::vector find_from_PATH(const std::string& name) const = 0; -- cgit v1.2.3 From f19df646a09d68856c5c4575174831f0d0a295e1 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 17 Oct 2018 19:05:24 -0700 Subject: Survey times. Refactor Chrono stuff. All times UTC, unless explicitly mentioned Survey is set to be every 6 months, but you also get one in the first 10 days. --- toolsrc/include/vcpkg/base/chrono.h | 8 ++++++-- toolsrc/include/vcpkg/base/system.h | 2 -- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/base/chrono.h b/toolsrc/include/vcpkg/base/chrono.h index aa764a597..6f6e2b317 100644 --- a/toolsrc/include/vcpkg/base/chrono.h +++ b/toolsrc/include/vcpkg/base/chrono.h @@ -52,8 +52,10 @@ namespace vcpkg::Chrono static Optional get_current_date_time(); static Optional parse(CStringView str); - constexpr CTime() noexcept : m_tm{0} {} - explicit constexpr CTime(tm t) noexcept : m_tm{t} {} + constexpr CTime() noexcept : m_tm {0} {} + explicit constexpr CTime(tm t) noexcept : m_tm {t} {} + + CTime add_hours(const int hours) const; std::string to_string() const; @@ -62,4 +64,6 @@ namespace vcpkg::Chrono private: mutable tm m_tm; }; + + tm get_current_date_time_local(); } diff --git a/toolsrc/include/vcpkg/base/system.h b/toolsrc/include/vcpkg/base/system.h index 005e09a3f..af56e45c1 100644 --- a/toolsrc/include/vcpkg/base/system.h +++ b/toolsrc/include/vcpkg/base/system.h @@ -8,8 +8,6 @@ namespace vcpkg::System { - tm get_current_date_time(); - fs::path get_exe_path_of_current_process(); struct CMakeVariable -- cgit v1.2.3 From 02839ae4a83d505bae17d5856ce851af29c89c65 Mon Sep 17 00:00:00 2001 From: "Billy O'Neal (VC LIBS)" Date: Thu, 15 Nov 2018 11:24:24 -0800 Subject: vcpkg was going out of its way to use partition before calling the container erase function which is slower than just using remove_if. remove_if is already stable, so separate stable and unstable versions are unnecessary. https://iterator.wordpress.com/2016/01/31/algorithms_0/ Unstable remove_if algorithms are possible that might win, as indicated in that article; but plain remove_if provides the most consistent behavior. --- toolsrc/include/vcpkg/base/util.h | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/base/util.h b/toolsrc/include/vcpkg/base/util.h index 7266fbbc6..65ce02b99 100644 --- a/toolsrc/include/vcpkg/base/util.h +++ b/toolsrc/include/vcpkg/base/util.h @@ -71,18 +71,6 @@ namespace vcpkg::Util return ret; } - template - void stable_keep_if(Container& cont, Pred pred) - { - cont.erase(std::stable_partition(cont.begin(), cont.end(), pred), cont.end()); - } - - template - void unstable_keep_if(Container& cont, Pred pred) - { - cont.erase(std::partition(cont.begin(), cont.end(), pred), cont.end()); - } - template void erase_remove_if(Container& cont, Pred pred) { -- cgit v1.2.3