aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
authoreao197 <eao197@gmail.com>2018-05-30 19:25:16 +0300
committereao197 <eao197@gmail.com>2018-05-30 19:25:16 +0300
commit99eb78cf2dd8b000ac195dd9ebba4fb344dc5baa (patch)
tree18072db815a8f417c4d63a00ae95286642f0dff3 /toolsrc/include
parent34257a50ceda0bfa05e59b532f71223b70f39d52 (diff)
parent842252373992a9c7b74f041607b47754d61cc0c8 (diff)
downloadvcpkg-99eb78cf2dd8b000ac195dd9ebba4fb344dc5baa.tar.gz
vcpkg-99eb78cf2dd8b000ac195dd9ebba4fb344dc5baa.zip
Merge https://github.com/Microsoft/vcpkg
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/tests.utils.h40
-rw-r--r--toolsrc/include/vcpkg/base/stringliteral.h3
-rw-r--r--toolsrc/include/vcpkg/base/strings.h4
-rw-r--r--toolsrc/include/vcpkg/base/system.h17
-rw-r--r--toolsrc/include/vcpkg/binaryparagraph.h2
-rw-r--r--toolsrc/include/vcpkg/commands.h4
-rw-r--r--toolsrc/include/vcpkg/userconfig.h2
-rw-r--r--toolsrc/include/vcpkg/vcpkgpaths.h1
8 files changed, 48 insertions, 25 deletions
diff --git a/toolsrc/include/tests.utils.h b/toolsrc/include/tests.utils.h
index 970506663..7f7ec9e88 100644
--- a/toolsrc/include/tests.utils.h
+++ b/toolsrc/include/tests.utils.h
@@ -12,10 +12,42 @@
namespace Microsoft::VisualStudio::CppUnitTestFramework
{
- std::wstring ToString(const vcpkg::Dependencies::InstallPlanType& t);
- std::wstring ToString(const vcpkg::Dependencies::RequestType& t);
- std::wstring ToString(const vcpkg::PackageSpecParseResult& t);
- std::wstring ToString(const vcpkg::PackageSpec& t);
+ template<>
+ std::wstring ToString<vcpkg::Dependencies::InstallPlanType>(const vcpkg::Dependencies::InstallPlanType& t)
+ {
+ switch (t)
+ {
+ case vcpkg::Dependencies::InstallPlanType::ALREADY_INSTALLED: return L"ALREADY_INSTALLED";
+ case vcpkg::Dependencies::InstallPlanType::BUILD_AND_INSTALL: return L"BUILD_AND_INSTALL";
+ case vcpkg::Dependencies::InstallPlanType::EXCLUDED: return L"EXCLUDED";
+ case vcpkg::Dependencies::InstallPlanType::UNKNOWN: return L"UNKNOWN";
+ default: return ToString(static_cast<int>(t));
+ }
+ }
+
+ template<>
+ std::wstring ToString<vcpkg::Dependencies::RequestType>(const vcpkg::Dependencies::RequestType& t)
+ {
+ switch (t)
+ {
+ case vcpkg::Dependencies::RequestType::AUTO_SELECTED: return L"AUTO_SELECTED";
+ case vcpkg::Dependencies::RequestType::USER_REQUESTED: return L"USER_REQUESTED";
+ case vcpkg::Dependencies::RequestType::UNKNOWN: return L"UNKNOWN";
+ default: return ToString(static_cast<int>(t));
+ }
+ }
+
+ template<>
+ std::wstring ToString<vcpkg::PackageSpecParseResult>(const vcpkg::PackageSpecParseResult& t)
+ {
+ return ToString(static_cast<uint32_t>(t));
+ }
+
+ template<>
+ std::wstring ToString<vcpkg::PackageSpec>(const vcpkg::PackageSpec& t)
+ {
+ return ToString(t.to_string());
+ }
}
std::unique_ptr<vcpkg::StatusParagraph> make_status_pgh(const char* name,
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<int N>
- 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 4cc17bcf4..4b39b0a28 100644
--- a/toolsrc/include/vcpkg/base/strings.h
+++ b/toolsrc/include/vcpkg/base/strings.h
@@ -1,6 +1,7 @@
#pragma once
#include <vcpkg/base/cstringview.h>
+#include <vcpkg/base/stringliteral.h>
#include <vector>
@@ -34,9 +35,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);
@@ -51,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<class Container, class Transformer>
std::string join(const char* delimiter, const Container& v, Transformer transformer)
diff --git a/toolsrc/include/vcpkg/base/system.h b/toolsrc/include/vcpkg/base/system.h
index 0d089276f..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<CMakeVariable>& 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,14 +38,6 @@ namespace vcpkg::System
ExitCodeAndOutput cmd_execute_and_capture_output(const CStringView cmd_line);
- void powershell_execute(const std::string& title,
- const fs::path& script_path,
- const std::vector<PowershellParameter>& parameters = {});
-
- std::string powershell_execute_and_capture_output(const std::string& title,
- const fs::path& script_path,
- const std::vector<PowershellParameter>& parameters = {});
-
enum class Color
{
success = 10,
diff --git a/toolsrc/include/vcpkg/binaryparagraph.h b/toolsrc/include/vcpkg/binaryparagraph.h
index 5ba2fbde3..3315151c6 100644
--- a/toolsrc/include/vcpkg/binaryparagraph.h
+++ b/toolsrc/include/vcpkg/binaryparagraph.h
@@ -12,7 +12,7 @@ namespace vcpkg
/// </summary>
struct BinaryParagraph
{
- BinaryParagraph() noexcept;
+ BinaryParagraph();
explicit BinaryParagraph(std::unordered_map<std::string, std::string> fields);
BinaryParagraph(const SourceParagraph& spgh, const Triplet& triplet, const std::string& abi_tag);
BinaryParagraph(const SourceParagraph& spgh, const FeatureParagraph& fpgh, const Triplet& triplet);
diff --git a/toolsrc/include/vcpkg/commands.h b/toolsrc/include/vcpkg/commands.h
index 6d29b7960..21e77aa52 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<Toolset> find_toolset_instances(const VcpkgPaths& paths);
+ std::vector<Toolset> 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/userconfig.h b/toolsrc/include/vcpkg/userconfig.h
index 63b8e5481..d044f43ef 100644
--- a/toolsrc/include/vcpkg/userconfig.h
+++ b/toolsrc/include/vcpkg/userconfig.h
@@ -17,4 +17,6 @@ namespace vcpkg
void try_write_data(Files::Filesystem& fs) const;
};
+
+ fs::path get_user_dir();
}
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;