aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
authoryurybura <yurybura@gmail.com>2018-05-11 13:33:49 +0300
committerGitHub <noreply@github.com>2018-05-11 13:33:49 +0300
commit9535a5631ac212b1c657a02be3ed9398df30c96c (patch)
treea1124b7b5d81606c6d7413bb7075e8bdbc6afad3 /toolsrc/include
parent92eb878b3efdb780097178125066a6070869c954 (diff)
parent9a19dae13a0fa594245db2df45ec54a504bc82f3 (diff)
downloadvcpkg-9535a5631ac212b1c657a02be3ed9398df30c96c.tar.gz
vcpkg-9535a5631ac212b1c657a02be3ed9398df30c96c.zip
Merge pull request #1 from Microsoft/master
update
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/pch.h4
-rw-r--r--toolsrc/include/tests.utils.h40
-rw-r--r--toolsrc/include/vcpkg/base/cache.h21
-rw-r--r--toolsrc/include/vcpkg/base/checks.h4
-rw-r--r--toolsrc/include/vcpkg/base/chrono.h11
-rw-r--r--toolsrc/include/vcpkg/base/cstringview.h15
-rw-r--r--toolsrc/include/vcpkg/base/files.h3
-rw-r--r--toolsrc/include/vcpkg/base/lineinfo.h2
-rw-r--r--toolsrc/include/vcpkg/base/optional.h12
-rw-r--r--toolsrc/include/vcpkg/base/span.h7
-rw-r--r--toolsrc/include/vcpkg/base/strings.h8
-rw-r--r--toolsrc/include/vcpkg/base/system.h9
-rw-r--r--toolsrc/include/vcpkg/base/util.h30
-rw-r--r--toolsrc/include/vcpkg/build.h34
-rw-r--r--toolsrc/include/vcpkg/commands.h23
-rw-r--r--toolsrc/include/vcpkg/dependencies.h16
-rw-r--r--toolsrc/include/vcpkg/export.ifw.h2
-rw-r--r--toolsrc/include/vcpkg/install.h1
-rw-r--r--toolsrc/include/vcpkg/packagespecparseresult.h2
-rw-r--r--toolsrc/include/vcpkg/paragraphs.h5
-rw-r--r--toolsrc/include/vcpkg/sourceparagraph.h2
-rw-r--r--toolsrc/include/vcpkg/statusparagraph.h5
-rw-r--r--toolsrc/include/vcpkg/triplet.h4
-rw-r--r--toolsrc/include/vcpkg/userconfig.h2
-rw-r--r--toolsrc/include/vcpkg/vcpkgcmdarguments.h1
-rw-r--r--toolsrc/include/vcpkg/vcpkglib.h2
-rw-r--r--toolsrc/include/vcpkg/vcpkgpaths.h29
-rw-r--r--toolsrc/include/vcpkg/versiont.h4
28 files changed, 215 insertions, 83 deletions
diff --git a/toolsrc/include/pch.h b/toolsrc/include/pch.h
index 683bef171..9c9deeb3f 100644
--- a/toolsrc/include/pch.h
+++ b/toolsrc/include/pch.h
@@ -46,7 +46,11 @@
#include <set>
#include <stdexcept>
#include <string>
+#if defined(_WIN32)
#include <sys/timeb.h>
+#else
+#include <sys/time.h>
+#endif
#include <sys/types.h>
#include <system_error>
#include <thread>
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/cache.h b/toolsrc/include/vcpkg/base/cache.h
new file mode 100644
index 000000000..dfc7565b8
--- /dev/null
+++ b/toolsrc/include/vcpkg/base/cache.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#include <map>
+
+namespace vcpkg
+{
+ template<class Key, class Value>
+ struct Cache
+ {
+ template<class F>
+ Value const& get_lazy(const Key& k, const F& f) const
+ {
+ auto it = m_cache.find(k);
+ if (it != m_cache.end()) return it->second;
+ return m_cache.emplace(k, f()).first->second;
+ }
+
+ private:
+ mutable std::map<Key, Value> m_cache;
+ };
+}
diff --git a/toolsrc/include/vcpkg/base/checks.h b/toolsrc/include/vcpkg/base/checks.h
index fb162c897..bceee3428 100644
--- a/toolsrc/include/vcpkg/base/checks.h
+++ b/toolsrc/include/vcpkg/base/checks.h
@@ -27,7 +27,7 @@ namespace vcpkg::Checks
// Display an error message to the user and exit the tool.
[[noreturn]] void exit_with_message(const LineInfo& line_info,
const char* error_message_template,
- const Arg1 error_message_arg1,
+ const Arg1& error_message_arg1,
const Args&... error_message_args)
{
exit_with_message(line_info,
@@ -42,7 +42,7 @@ namespace vcpkg::Checks
void check_exit(const LineInfo& line_info,
Conditional&& expression,
const char* error_message_template,
- const Arg1 error_message_arg1,
+ const Arg1& error_message_arg1,
const Args&... error_message_args)
{
if (!expression)
diff --git a/toolsrc/include/vcpkg/base/chrono.h b/toolsrc/include/vcpkg/base/chrono.h
index 4291115f7..aa764a597 100644
--- a/toolsrc/include/vcpkg/base/chrono.h
+++ b/toolsrc/include/vcpkg/base/chrono.h
@@ -2,7 +2,6 @@
#include <chrono>
#include <string>
-#include <time.h>
#include <vcpkg/base/optional.h>
namespace vcpkg::Chrono
@@ -12,8 +11,8 @@ namespace vcpkg::Chrono
using duration = std::chrono::high_resolution_clock::time_point::duration;
public:
- constexpr ElapsedTime() : m_duration() {}
- constexpr ElapsedTime(duration d) : m_duration(d) {}
+ constexpr ElapsedTime() noexcept : m_duration() {}
+ constexpr ElapsedTime(duration d) noexcept : m_duration(d) {}
template<class TimeUnit>
TimeUnit as() const
@@ -32,7 +31,7 @@ namespace vcpkg::Chrono
public:
static ElapsedTimer create_started();
- constexpr ElapsedTimer() : m_start_tick() {}
+ constexpr ElapsedTimer() noexcept : m_start_tick() {}
ElapsedTime elapsed() const
{
@@ -53,8 +52,8 @@ namespace vcpkg::Chrono
static Optional<CTime> get_current_date_time();
static Optional<CTime> parse(CStringView str);
- constexpr CTime() : m_tm{0} {}
- explicit constexpr CTime(tm t) : m_tm{t} {}
+ constexpr CTime() noexcept : m_tm{0} {}
+ explicit constexpr CTime(tm t) noexcept : m_tm{t} {}
std::string to_string() const;
diff --git a/toolsrc/include/vcpkg/base/cstringview.h b/toolsrc/include/vcpkg/base/cstringview.h
index 0441bc573..f285aa36c 100644
--- a/toolsrc/include/vcpkg/base/cstringview.h
+++ b/toolsrc/include/vcpkg/base/cstringview.h
@@ -7,7 +7,7 @@ namespace vcpkg
{
struct CStringView
{
- constexpr CStringView() : cstr(nullptr) {}
+ constexpr CStringView() noexcept : cstr(nullptr) {}
constexpr CStringView(const char* cstr) : cstr(cstr) {}
constexpr CStringView(const CStringView&) = default;
CStringView(const std::string& str) : cstr(str.c_str()) {}
@@ -18,19 +18,6 @@ namespace vcpkg
const char* cstr;
};
- struct CWStringView
- {
- constexpr CWStringView() : cstr(nullptr) {}
- constexpr CWStringView(const wchar_t* cstr) : cstr(cstr) {}
- constexpr CWStringView(const CWStringView&) = default;
- CWStringView(const std::wstring& str) : cstr(str.c_str()) {}
-
- constexpr const wchar_t* c_str() const { return cstr; }
-
- private:
- const wchar_t* cstr;
- };
-
namespace details
{
inline bool vcpkg_strcmp(const char* l, const char* r) { return strcmp(l, r) == 0; }
diff --git a/toolsrc/include/vcpkg/base/files.h b/toolsrc/include/vcpkg/base/files.h
index 09393b9ee..f16805d0a 100644
--- a/toolsrc/include/vcpkg/base/files.h
+++ b/toolsrc/include/vcpkg/base/files.h
@@ -36,6 +36,7 @@ namespace vcpkg::Files
virtual void write_lines(const fs::path& file_path, const std::vector<std::string>& lines) = 0;
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 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;
@@ -63,7 +64,7 @@ namespace vcpkg::Files
Filesystem& get_real_filesystem();
- static const char* FILESYSTEM_INVALID_CHARACTERS = R"(\/:*?"<>|)";
+ static constexpr const char* FILESYSTEM_INVALID_CHARACTERS = R"(\/:*?"<>|)";
bool has_invalid_chars_for_filesystem(const std::string& s);
diff --git a/toolsrc/include/vcpkg/base/lineinfo.h b/toolsrc/include/vcpkg/base/lineinfo.h
index e7e8c3031..e0eb8bec9 100644
--- a/toolsrc/include/vcpkg/base/lineinfo.h
+++ b/toolsrc/include/vcpkg/base/lineinfo.h
@@ -9,7 +9,7 @@ namespace vcpkg
int line_number;
const char* file_name;
- constexpr LineInfo() : line_number(0), file_name("") {}
+ constexpr LineInfo() noexcept : line_number(0), file_name("") {}
constexpr LineInfo(const int lineno, const char* filename) : line_number(lineno), file_name(filename) {}
std::string to_string() const;
diff --git a/toolsrc/include/vcpkg/base/optional.h b/toolsrc/include/vcpkg/base/optional.h
index af2d297a6..6b84b10aa 100644
--- a/toolsrc/include/vcpkg/base/optional.h
+++ b/toolsrc/include/vcpkg/base/optional.h
@@ -16,7 +16,7 @@ namespace vcpkg
template<class T>
struct OptionalStorage
{
- constexpr OptionalStorage() : m_is_present(false), m_t() {}
+ constexpr OptionalStorage() noexcept : m_is_present(false), m_t() {}
constexpr OptionalStorage(const T& t) : m_is_present(true), m_t(t) {}
constexpr OptionalStorage(T&& t) : m_is_present(true), m_t(std::move(t)) {}
@@ -33,7 +33,7 @@ namespace vcpkg
template<class T>
struct OptionalStorage<T&>
{
- constexpr OptionalStorage() : m_t(nullptr) {}
+ constexpr OptionalStorage() noexcept : m_t(nullptr) {}
constexpr OptionalStorage(T& t) : m_t(&t) {}
constexpr bool has_value() const { return m_t != nullptr; }
@@ -48,7 +48,7 @@ namespace vcpkg
template<class T>
struct Optional
{
- constexpr Optional() {}
+ constexpr Optional() noexcept {}
// Constructors are intentionally implicit
constexpr Optional(NullOpt) {}
@@ -64,6 +64,12 @@ namespace vcpkg
return std::move(this->m_base.value());
}
+ T& value_or_exit(const LineInfo& line_info) &
+ {
+ this->exit_if_null(line_info);
+ return this->m_base.value();
+ }
+
const T& value_or_exit(const LineInfo& line_info) const&
{
this->exit_if_null(line_info);
diff --git a/toolsrc/include/vcpkg/base/span.h b/toolsrc/include/vcpkg/base/span.h
index c9ac18afe..2b067d0ac 100644
--- a/toolsrc/include/vcpkg/base/span.h
+++ b/toolsrc/include/vcpkg/base/span.h
@@ -19,18 +19,19 @@ namespace vcpkg
using iterator = pointer;
constexpr Span() noexcept : m_ptr(nullptr), m_count(0) {}
- constexpr Span(std::nullptr_t) noexcept : Span() {}
+ constexpr Span(std::nullptr_t) noexcept : m_ptr(nullptr), m_count(0) {}
constexpr Span(pointer ptr, size_t count) noexcept : m_ptr(ptr), m_count(count) {}
constexpr Span(pointer ptr_begin, pointer ptr_end) noexcept : m_ptr(ptr_begin), m_count(ptr_end - ptr_begin) {}
constexpr Span(std::initializer_list<T> l) noexcept : m_ptr(l.begin()), m_count(l.size()) {}
template<size_t N>
- constexpr Span(T (&arr)[N]) noexcept : Span(arr, N)
+ constexpr Span(T (&arr)[N]) noexcept : m_ptr(arr), m_count(N)
{
}
template<size_t N>
- constexpr Span(const std::array<std::remove_const_t<T>, N>& arr) noexcept : Span(arr.data(), arr.size())
+ constexpr Span(const std::array<std::remove_const_t<T>, N>& arr) noexcept
+ : m_ptr(arr.data()), m_count(arr.size())
{
}
diff --git a/toolsrc/include/vcpkg/base/strings.h b/toolsrc/include/vcpkg/base/strings.h
index 6ef840fb3..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 CWStringView& w);
+ std::string to_utf8(const wchar_t* w);
+#endif
std::string escape_string(const CStringView& s, char char_to_escape, char escape_char);
@@ -46,7 +48,9 @@ namespace vcpkg::Strings
bool case_insensitive_ascii_equals(const CStringView left, const CStringView right);
- std::string ascii_to_lowercase(const std::string& input);
+ std::string ascii_to_lowercase(std::string s);
+
+ std::string ascii_to_uppercase(std::string s);
bool case_insensitive_ascii_starts_with(const std::string& s, const std::string& pattern);
diff --git a/toolsrc/include/vcpkg/base/system.h b/toolsrc/include/vcpkg/base/system.h
index 31034f6b4..0d089276f 100644
--- a/toolsrc/include/vcpkg/base/system.h
+++ b/toolsrc/include/vcpkg/base/system.h
@@ -1,5 +1,7 @@
#pragma once
+#include <unordered_map>
+
#include <vcpkg/base/files.h>
#include <vcpkg/base/optional.h>
#include <vcpkg/base/strings.h>
@@ -38,7 +40,8 @@ namespace vcpkg::System
std::string output;
};
- int cmd_execute_clean(const CStringView cmd_line);
+ int cmd_execute_clean(const CStringView cmd_line,
+ const std::unordered_map<std::string, std::string>& extra_env = {});
int cmd_execute(const CStringView cmd_line);
@@ -107,9 +110,9 @@ namespace vcpkg::System
std::vector<CPUArchitecture> get_supported_host_architectures();
- const fs::path& get_program_files_32_bit();
+ const Optional<fs::path>& get_program_files_32_bit();
- const fs::path& get_program_files_platform_bitness();
+ const Optional<fs::path>& get_program_files_platform_bitness();
}
namespace vcpkg::Debug
diff --git a/toolsrc/include/vcpkg/base/util.h b/toolsrc/include/vcpkg/base/util.h
index 5e07b240a..7266fbbc6 100644
--- a/toolsrc/include/vcpkg/base/util.h
+++ b/toolsrc/include/vcpkg/base/util.h
@@ -3,11 +3,10 @@
#include <algorithm>
#include <map>
#include <mutex>
+#include <unordered_map>
#include <utility>
#include <vector>
-#include <vcpkg/base/optional.h>
-
namespace vcpkg::Util
{
template<class Container>
@@ -24,10 +23,21 @@ namespace vcpkg::Util
namespace Sets
{
- template<class Container>
- bool contains(const Container& container, const ElementT<Container>& item)
+ template<class Container, class Key>
+ bool contains(const Container& container, const Key& item)
+ {
+ return container.find(item) != container.end();
+ }
+ }
+
+ namespace Maps
+ {
+ template<class K, class V1, class V2, class Func>
+ void transform_values(const std::unordered_map<K, V1>& container, std::unordered_map<K, V2>& output, Func func)
{
- return container.find(item) != container.cend();
+ std::for_each(container.cbegin(), container.cend(), [&](const std::pair<const K, V1>& p) {
+ output[p.first] = func(p.second);
+ });
}
}
@@ -158,6 +168,8 @@ namespace vcpkg::Util
MoveOnlyBase& operator=(const MoveOnlyBase&) = delete;
MoveOnlyBase& operator=(MoveOnlyBase&&) = default;
+
+ ~MoveOnlyBase() = default;
};
struct ResourceBase
@@ -168,6 +180,8 @@ namespace vcpkg::Util
ResourceBase& operator=(const ResourceBase&) = delete;
ResourceBase& operator=(ResourceBase&&) = delete;
+
+ ~ResourceBase() = default;
};
template<class T>
@@ -214,4 +228,10 @@ namespace vcpkg::Util
return e == E::YES;
}
}
+
+ template<class T>
+ void unused(T&& param)
+ {
+ (void)param;
+ }
}
diff --git a/toolsrc/include/vcpkg/build.h b/toolsrc/include/vcpkg/build.h
index ea81c4dbe..c5e7e8d88 100644
--- a/toolsrc/include/vcpkg/build.h
+++ b/toolsrc/include/vcpkg/build.h
@@ -57,12 +57,20 @@ namespace vcpkg::Build
RELEASE,
};
+ enum class DownloadTool
+ {
+ BUILT_IN,
+ ARIA2,
+ };
+ const std::string& to_string(DownloadTool tool);
+
struct BuildPackageOptions
{
UseHeadVersion use_head_version;
AllowDownloads allow_downloads;
CleanBuildtrees clean_buildtrees;
CleanPackages clean_packages;
+ DownloadTool download_tool;
};
enum class BuildResult
@@ -195,8 +203,8 @@ namespace vcpkg::Build
struct BuildInfo
{
- LinkageType crt_linkage;
- LinkageType library_linkage;
+ LinkageType crt_linkage = LinkageType::DYNAMIC;
+ LinkageType library_linkage = LinkageType::DYNAMIC;
Optional<std::string> version;
@@ -204,4 +212,26 @@ namespace vcpkg::Build
};
BuildInfo read_build_info(const Files::Filesystem& fs, const fs::path& filepath);
+
+ struct AbiEntry
+ {
+ std::string key;
+ std::string value;
+
+ bool operator<(const AbiEntry& other) const
+ {
+ return key < other.key || (key == other.key && value < other.value);
+ }
+ };
+
+ struct AbiTagAndFile
+ {
+ std::string tag;
+ fs::path tag_file;
+ };
+
+ Optional<AbiTagAndFile> compute_abi_tag(const VcpkgPaths& paths,
+ const BuildPackageConfig& config,
+ const PreBuildInfo& pre_build_info,
+ Span<const AbiEntry> dependency_abis);
}
diff --git a/toolsrc/include/vcpkg/commands.h b/toolsrc/include/vcpkg/commands.h
index 4027e12f4..6d29b7960 100644
--- a/toolsrc/include/vcpkg/commands.h
+++ b/toolsrc/include/vcpkg/commands.h
@@ -7,6 +7,8 @@
#include <vcpkg/vcpkgpaths.h>
#include <array>
+#include <map>
+#include <vector>
namespace vcpkg::Commands
{
@@ -23,7 +25,17 @@ namespace vcpkg::Commands
namespace CI
{
+ struct UnknownCIPortsResults
+ {
+ std::vector<PackageSpec> unknown;
+ std::map<PackageSpec, Build::BuildResult> known;
+ };
+
extern const CommandStructure COMMAND_STRUCTURE;
+ UnknownCIPortsResults find_unknown_ports_for_ci(const VcpkgPaths& paths,
+ const std::set<std::string>& exclusions,
+ const Dependencies::PortFileProvider& provider,
+ const std::vector<FeatureSpec>& fspecs);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
}
@@ -119,8 +131,17 @@ 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);
+
+ void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
+ }
+
+ namespace Fetch
+ {
+ std::vector<Toolset> find_toolset_instances(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);
- std::string get_file_hash(fs::path const& cmake_exe_path, fs::path const& path, std::string const& hash_type);
}
template<class T>
diff --git a/toolsrc/include/vcpkg/dependencies.h b/toolsrc/include/vcpkg/dependencies.h
index fadb8cc7e..3c3b8f267 100644
--- a/toolsrc/include/vcpkg/dependencies.h
+++ b/toolsrc/include/vcpkg/dependencies.h
@@ -35,17 +35,17 @@ namespace vcpkg::Dependencies
{
static bool compare_by_name(const InstallPlanAction* left, const InstallPlanAction* right);
- InstallPlanAction();
+ InstallPlanAction() noexcept;
- InstallPlanAction(const PackageSpec& spec,
- InstalledPackageView&& spghs,
+ InstallPlanAction(InstalledPackageView&& spghs,
const std::set<std::string>& features,
const RequestType& request_type);
InstallPlanAction(const PackageSpec& spec,
const SourceControlFile& scf,
const std::set<std::string>& features,
- const RequestType& request_type);
+ const RequestType& request_type,
+ std::vector<PackageSpec>&& dependencies);
std::string displayname() const;
@@ -58,6 +58,8 @@ namespace vcpkg::Dependencies
RequestType request_type;
Build::BuildPackageOptions build_options;
std::set<std::string> feature_list;
+
+ std::vector<PackageSpec> computed_dependencies;
};
enum class RemovePlanType
@@ -71,7 +73,7 @@ namespace vcpkg::Dependencies
{
static bool compare_by_name(const RemovePlanAction* left, const RemovePlanAction* right);
- RemovePlanAction();
+ RemovePlanAction() noexcept;
RemovePlanAction(const PackageSpec& spec, const RemovePlanType& plan_type, const RequestType& request_type);
PackageSpec spec;
@@ -101,7 +103,7 @@ namespace vcpkg::Dependencies
{
static bool compare_by_name(const ExportPlanAction* left, const ExportPlanAction* right);
- ExportPlanAction();
+ ExportPlanAction() noexcept;
ExportPlanAction(const PackageSpec& spec,
InstalledPackageView&& installed_package,
const RequestType& request_type);
@@ -172,7 +174,7 @@ namespace vcpkg::Dependencies
const std::vector<FeatureSpec>& specs,
const StatusParagraphs& status_db);
- std::vector<AnyAction> create_feature_install_plan(const PortFileProvider& port_file_provider,
+ std::vector<AnyAction> create_feature_install_plan(const PortFileProvider& provider,
const std::vector<FeatureSpec>& specs,
const StatusParagraphs& status_db);
diff --git a/toolsrc/include/vcpkg/export.ifw.h b/toolsrc/include/vcpkg/export.ifw.h
index d28a4436d..b1573924e 100644
--- a/toolsrc/include/vcpkg/export.ifw.h
+++ b/toolsrc/include/vcpkg/export.ifw.h
@@ -3,8 +3,6 @@
#include <vcpkg/dependencies.h>
#include <vcpkg/vcpkgpaths.h>
-#include <vcpkg/base/files.h>
-
#include <string>
#include <vector>
diff --git a/toolsrc/include/vcpkg/install.h b/toolsrc/include/vcpkg/install.h
index 2e92764dc..b7acbf15f 100644
--- a/toolsrc/include/vcpkg/install.h
+++ b/toolsrc/include/vcpkg/install.h
@@ -37,6 +37,7 @@ namespace vcpkg::Install
std::string total_elapsed_time;
void print() const;
+ static std::string xunit_result(const PackageSpec& spec, Chrono::ElapsedTime time, Build::BuildResult code);
std::string xunit_results() const;
};
diff --git a/toolsrc/include/vcpkg/packagespecparseresult.h b/toolsrc/include/vcpkg/packagespecparseresult.h
index dd91c9a67..be3497152 100644
--- a/toolsrc/include/vcpkg/packagespecparseresult.h
+++ b/toolsrc/include/vcpkg/packagespecparseresult.h
@@ -17,7 +17,7 @@ namespace vcpkg
template<>
struct ErrorHolder<PackageSpecParseResult>
{
- ErrorHolder() : m_err(PackageSpecParseResult::SUCCESS) {}
+ ErrorHolder() noexcept : m_err(PackageSpecParseResult::SUCCESS) {}
ErrorHolder(PackageSpecParseResult err) : m_err(err) {}
bool has_error() const { return m_err != PackageSpecParseResult::SUCCESS; }
diff --git a/toolsrc/include/vcpkg/paragraphs.h b/toolsrc/include/vcpkg/paragraphs.h
index e2c7f2d99..56f09387a 100644
--- a/toolsrc/include/vcpkg/paragraphs.h
+++ b/toolsrc/include/vcpkg/paragraphs.h
@@ -3,12 +3,9 @@
#include <vcpkg/binaryparagraph.h>
#include <vcpkg/parse.h>
#include <vcpkg/vcpkgpaths.h>
-#include <vcpkg/versiont.h>
#include <vcpkg/base/expected.h>
-#include <map>
-
namespace vcpkg::Paragraphs
{
using RawParagraph = Parse::RawParagraph;
@@ -20,7 +17,7 @@ namespace vcpkg::Paragraphs
Parse::ParseExpected<SourceControlFile> try_load_port(const Files::Filesystem& fs, const fs::path& control_path);
- Expected<BinaryControlFile> try_load_cached_control_package(const VcpkgPaths& paths, const PackageSpec& spec);
+ Expected<BinaryControlFile> try_load_cached_package(const VcpkgPaths& paths, const PackageSpec& spec);
struct LoadResults
{
diff --git a/toolsrc/include/vcpkg/sourceparagraph.h b/toolsrc/include/vcpkg/sourceparagraph.h
index ea8e27a94..ae5812ea7 100644
--- a/toolsrc/include/vcpkg/sourceparagraph.h
+++ b/toolsrc/include/vcpkg/sourceparagraph.h
@@ -63,6 +63,8 @@ namespace vcpkg
std::unique_ptr<SourceParagraph> core_paragraph;
std::vector<std::unique_ptr<FeatureParagraph>> feature_paragraphs;
+
+ Optional<const FeatureParagraph&> find_feature(const std::string& featurename) const;
};
void print_error_message(Span<const std::unique_ptr<Parse::ParseControlErrorInfo>> error_info_list);
diff --git a/toolsrc/include/vcpkg/statusparagraph.h b/toolsrc/include/vcpkg/statusparagraph.h
index 0802de530..e79c946cc 100644
--- a/toolsrc/include/vcpkg/statusparagraph.h
+++ b/toolsrc/include/vcpkg/statusparagraph.h
@@ -29,7 +29,7 @@ namespace vcpkg
/// </summary>
struct StatusParagraph
{
- StatusParagraph();
+ StatusParagraph() noexcept;
explicit StatusParagraph(std::unordered_map<std::string, std::string>&& fields);
bool is_installed() const { return want == Want::INSTALL && state == InstallState::INSTALLED; }
@@ -47,13 +47,14 @@ namespace vcpkg
struct InstalledPackageView
{
- InstalledPackageView() : core(nullptr) {}
+ InstalledPackageView() noexcept : core(nullptr) {}
InstalledPackageView(const StatusParagraph* c, std::vector<const StatusParagraph*>&& fs)
: core(c), features(std::move(fs))
{
}
+ const PackageSpec& spec() const { return core->package.spec; }
std::vector<PackageSpec> dependencies() const;
const StatusParagraph* core;
diff --git a/toolsrc/include/vcpkg/triplet.h b/toolsrc/include/vcpkg/triplet.h
index 10464dc2c..334960e49 100644
--- a/toolsrc/include/vcpkg/triplet.h
+++ b/toolsrc/include/vcpkg/triplet.h
@@ -9,7 +9,7 @@ namespace vcpkg
struct Triplet
{
public:
- constexpr Triplet() : m_instance(&DEFAULT_INSTANCE) {}
+ constexpr Triplet() noexcept : m_instance(&DEFAULT_INSTANCE) {}
static Triplet from_canonical_name(const std::string& triplet_as_string);
@@ -47,4 +47,4 @@ namespace std
{
size_t operator()(const vcpkg::Triplet& t) const { return t.hash_code(); }
};
-} \ No newline at end of file
+}
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/vcpkgcmdarguments.h b/toolsrc/include/vcpkg/vcpkgcmdarguments.h
index f449887f1..de65eec28 100644
--- a/toolsrc/include/vcpkg/vcpkgcmdarguments.h
+++ b/toolsrc/include/vcpkg/vcpkgcmdarguments.h
@@ -1,6 +1,5 @@
#pragma once
-#include <vcpkg/base/cstringview.h>
#include <vcpkg/base/optional.h>
#include <vcpkg/base/span.h>
#include <vcpkg/base/stringliteral.h>
diff --git a/toolsrc/include/vcpkg/vcpkglib.h b/toolsrc/include/vcpkg/vcpkglib.h
index 3c8e676bf..5674d30db 100644
--- a/toolsrc/include/vcpkg/vcpkglib.h
+++ b/toolsrc/include/vcpkg/vcpkglib.h
@@ -16,7 +16,7 @@ namespace vcpkg
SortedVector<std::string> files;
};
- std::vector<StatusParagraph*> get_installed_ports(const StatusParagraphs& status_db);
+ std::vector<InstalledPackageView> get_installed_ports(const StatusParagraphs& status_db);
std::vector<StatusParagraphAndAssociatedFiles> get_installed_files(const VcpkgPaths& paths,
const StatusParagraphs& status_db);
diff --git a/toolsrc/include/vcpkg/vcpkgpaths.h b/toolsrc/include/vcpkg/vcpkgpaths.h
index 71f1bbba9..9c8f2911a 100644
--- a/toolsrc/include/vcpkg/vcpkgpaths.h
+++ b/toolsrc/include/vcpkg/vcpkgpaths.h
@@ -3,12 +3,25 @@
#include <vcpkg/binaryparagraph.h>
#include <vcpkg/packagespec.h>
+#include <vcpkg/base/cache.h>
#include <vcpkg/base/expected.h>
#include <vcpkg/base/files.h>
#include <vcpkg/base/lazy.h>
namespace vcpkg
{
+ namespace Tools
+ {
+ static const std::string SEVEN_ZIP = "7zip";
+ static const std::string CMAKE = "cmake";
+ static const std::string GIT = "git";
+ static const std::string NINJA = "ninja";
+ static const std::string NUGET = "nuget";
+ static const std::string IFW_INSTALLER_BASE = "ifw_installerbase";
+ static const std::string IFW_BINARYCREATOR = "ifw_binarycreator";
+ static const std::string IFW_REPOGEN = "ifw_repogen";
+ }
+
struct ToolsetArchOption
{
CStringView name;
@@ -63,13 +76,7 @@ namespace vcpkg
fs::path ports_cmake;
- const fs::path& get_7za_exe() const;
- const fs::path& get_cmake_exe() const;
- const fs::path& get_git_exe() const;
- const fs::path& get_nuget_exe() const;
- const fs::path& get_ifw_installerbase_exe() const;
- const fs::path& get_ifw_binarycreator_exe() const;
- const fs::path& get_ifw_repogen_exe() const;
+ const fs::path& get_tool_exe(const std::string& tool) const;
/// <summary>Retrieve a toolset matching a VS version</summary>
/// <remarks>
@@ -81,13 +88,7 @@ namespace vcpkg
private:
Lazy<std::vector<std::string>> available_triplets;
- Lazy<fs::path> _7za_exe;
- Lazy<fs::path> cmake_exe;
- Lazy<fs::path> git_exe;
- Lazy<fs::path> nuget_exe;
- Lazy<fs::path> ifw_installerbase_exe;
- Lazy<fs::path> ifw_binarycreator_exe;
- Lazy<fs::path> ifw_repogen_exe;
+ Cache<std::string, fs::path> tool_paths;
Lazy<std::vector<Toolset>> toolsets;
Lazy<std::vector<Toolset>> toolsets_vs2013;
diff --git a/toolsrc/include/vcpkg/versiont.h b/toolsrc/include/vcpkg/versiont.h
index 8427dfe3b..e893f1abc 100644
--- a/toolsrc/include/vcpkg/versiont.h
+++ b/toolsrc/include/vcpkg/versiont.h
@@ -5,7 +5,7 @@ namespace vcpkg
{
struct VersionT
{
- VersionT();
+ VersionT() noexcept;
VersionT(std::string&& value);
VersionT(const std::string& value);
@@ -23,7 +23,7 @@ namespace vcpkg
VersionT left;
VersionT right;
- VersionDiff();
+ VersionDiff() noexcept;
VersionDiff(const VersionT& left, const VersionT& right);
std::string to_string() const;