aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-10-03 15:52:29 -0700
committerRobert Schumacher <roschuma@microsoft.com>2017-10-03 15:52:29 -0700
commitd5705e87c42784607bf462159bebe14044a88eca (patch)
treeaded4a5806480ad3e6980b8c5f4dacd61a004614 /toolsrc/include
parentc167c70c272a417779e601fffcbdb72278da1848 (diff)
parent3838d5880470fdc884f035ed3d1c67d3bdd1e16e (diff)
downloadvcpkg-d5705e87c42784607bf462159bebe14044a88eca.tar.gz
vcpkg-d5705e87c42784607bf462159bebe14044a88eca.zip
Merge branch 'master' into martin-s-patch-vs2013
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/CStringView.h44
-rw-r--r--toolsrc/include/SourceParagraph.h2
-rw-r--r--toolsrc/include/Span.h28
-rw-r--r--toolsrc/include/VcpkgPaths.h2
-rw-r--r--toolsrc/include/pch.h7
-rw-r--r--toolsrc/include/vcpkg_Build.h7
-rw-r--r--toolsrc/include/vcpkg_Commands.h38
-rw-r--r--toolsrc/include/vcpkg_Dependencies.h2
-rw-r--r--toolsrc/include/vcpkg_Strings.h2
9 files changed, 116 insertions, 16 deletions
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<CharType>& 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<class CharType>
+ bool operator==(const BasicCStringView<CharType>& l, const BasicCStringView<CharType>& r)
+ {
+ return details::vcpkg_strcmp(l.c_str(), r.c_str());
+ }
+
+ template<class CharType>
+ bool operator==(const CharType* l, const BasicCStringView<CharType>& r)
+ {
+ return details::vcpkg_strcmp(l, r.c_str());
+ }
+
+ template<class CharType>
+ bool operator==(const BasicCStringView<CharType>& r, const CharType* l)
+ {
+ return details::vcpkg_strcmp(l, r.c_str());
+ }
+
template<class CharType>
bool operator==(const std::basic_string<CharType>& l, const BasicCStringView<CharType>& r)
{
@@ -30,6 +53,25 @@ namespace vcpkg
return l == r.c_str();
}
+ // notequals
+ template<class CharType>
+ bool operator!=(const BasicCStringView<CharType>& l, const BasicCStringView<CharType>& r)
+ {
+ return !details::vcpkg_strcmp(l.c_str(), r.c_str());
+ }
+
+ template<class CharType>
+ bool operator!=(const CharType* l, const BasicCStringView<CharType>& r)
+ {
+ return !details::vcpkg_strcmp(l, r.c_str());
+ }
+
+ template<class CharType>
+ bool operator!=(const BasicCStringView<CharType>& r, const CharType* l)
+ {
+ return !details::vcpkg_strcmp(l, r.c_str());
+ }
+
template<class CharType>
bool operator!=(const BasicCStringView<CharType>& r, const std::basic_string<CharType>& 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<std::unique_ptr<FeatureParagraph>> feature_paragraphs;
};
- void print_error_message(span<const std::unique_ptr<Parse::ParseControlErrorInfo>> error_info_list);
+ void print_error_message(Span<const std::unique_ptr<Parse::ParseControlErrorInfo>> error_info_list);
inline void print_error_message(const std::unique_ptr<Parse::ParseControlErrorInfo>& 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 <vector>
template<class T>
-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<size_t N>
- constexpr span(T (&arr)[N]) noexcept : span(arr, N)
+ constexpr Span(T (&arr)[N]) noexcept : Span(arr, N)
{
}
- span(std::vector<T>& v) noexcept : span(v.data(), v.size()) {}
- span(const std::vector<std::remove_const_t<T>>& v) noexcept : span(v.data(), v.size()) {}
+ Span(std::vector<T>& v) noexcept : Span(v.data(), v.size()) {}
+ Span(const std::vector<std::remove_const_t<T>>& 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<class T>
+Span<T> make_span(std::vector<T>& v)
+{
+ return {v.data(), v.size()};
+}
+
+template<class T>
+Span<const T> make_span(const std::vector<T>& v)
+{
+ return {v.data(), v.size()};
+}
diff --git a/toolsrc/include/VcpkgPaths.h b/toolsrc/include/VcpkgPaths.h
index 9b650bb6d..9914c6f35 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<std::wstring> vcvarsall_options;
CWStringView version;
std::vector<ToolsetArchOption> supported_architectures;
};
@@ -71,5 +72,6 @@ namespace vcpkg
Lazy<fs::path> git_exe;
Lazy<fs::path> nuget_exe;
Lazy<std::vector<Toolset>> toolsets;
+ Lazy<std::vector<Toolset>> toolsets_vs2017_v140;
};
}
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 <windows.h>
#include <algorithm>
@@ -28,7 +28,10 @@
#include <regex>
#include <set>
#include <shellapi.h>
-#include <shlobj.h>
+#pragma warning(push)
+#pragma warning(disable : 4768)
+#include <Shlobj.h>
+#pragma warning(pop)
#include <stdexcept>
#include <string>
#include <sys/timeb.h>
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 <array>
#include <map>
-#include <unordered_map>
#include <vector>
namespace vcpkg::Build
@@ -56,7 +55,7 @@ namespace vcpkg::Build
CASCADED_DUE_TO_MISSING_DEPENDENCIES
};
- static constexpr std::array<BuildResult, 5> BuildResult_values = {
+ static constexpr std::array<BuildResult, 5> BUILD_RESULT_VALUES = {
BuildResult::SUCCEEDED,
BuildResult::BUILD_FAILED,
BuildResult::POST_BUILD_CHECKS_FAILED,
@@ -143,7 +142,7 @@ namespace vcpkg::Build
COUNT,
};
- constexpr std::array<BuildPolicy, size_t(BuildPolicy::COUNT)> g_all_policies = {
+ constexpr std::array<BuildPolicy, size_t(BuildPolicy::COUNT)> 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<BuildPolicy, bool>&& 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;
diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h
index 756a12f01..590f0208c 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<Dependencies::AnyAction>& 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);
}
@@ -82,6 +106,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);
}
@@ -173,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);
}
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<InstallPlanAction> install_plan;
Optional<RemovePlanAction> remove_plan;
+
+ const PackageSpec& spec() const;
};
enum class ExportPlanType
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<class Container, class Transformer, class CharType>
std::basic_string<CharType> join(const CharType* delimiter, const Container& v, Transformer transformer)
{