aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/pch.h5
-rw-r--r--toolsrc/include/tests.utils.h8
-rw-r--r--toolsrc/include/vcpkg/base/chrono.h4
-rw-r--r--toolsrc/include/vcpkg/base/files.h19
-rw-r--r--toolsrc/include/vcpkg/base/graphs.h4
-rw-r--r--toolsrc/include/vcpkg/base/optional.h23
-rw-r--r--toolsrc/include/vcpkg/base/strings.h13
-rw-r--r--toolsrc/include/vcpkg/base/system.h2
-rw-r--r--toolsrc/include/vcpkg/build.h9
-rw-r--r--toolsrc/include/vcpkg/dependencies.h27
-rw-r--r--toolsrc/include/vcpkg/globalstate.h2
-rw-r--r--toolsrc/include/vcpkg/postbuildlint.h3
-rw-r--r--toolsrc/include/vcpkg/sourceparagraph.h10
-rw-r--r--toolsrc/include/vcpkg/vcpkgcmdarguments.h16
-rw-r--r--toolsrc/include/vcpkg/vcpkgpaths.h2
15 files changed, 96 insertions, 51 deletions
diff --git a/toolsrc/include/pch.h b/toolsrc/include/pch.h
index fa2c2bb72..15ec25e76 100644
--- a/toolsrc/include/pch.h
+++ b/toolsrc/include/pch.h
@@ -37,11 +37,8 @@
#include <cstdarg>
#include <cstddef>
#include <cstdint>
-#if defined(_WIN32)
-#include <filesystem>
-#else
+#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
#include <experimental/filesystem>
-#endif
#include <cstring>
#include <fstream>
#include <functional>
diff --git a/toolsrc/include/tests.utils.h b/toolsrc/include/tests.utils.h
index 7f7ec9e88..3e8514e67 100644
--- a/toolsrc/include/tests.utils.h
+++ b/toolsrc/include/tests.utils.h
@@ -13,7 +13,7 @@
namespace Microsoft::VisualStudio::CppUnitTestFramework
{
template<>
- std::wstring ToString<vcpkg::Dependencies::InstallPlanType>(const vcpkg::Dependencies::InstallPlanType& t)
+ inline std::wstring ToString<vcpkg::Dependencies::InstallPlanType>(const vcpkg::Dependencies::InstallPlanType& t)
{
switch (t)
{
@@ -26,7 +26,7 @@ namespace Microsoft::VisualStudio::CppUnitTestFramework
}
template<>
- std::wstring ToString<vcpkg::Dependencies::RequestType>(const vcpkg::Dependencies::RequestType& t)
+ inline std::wstring ToString<vcpkg::Dependencies::RequestType>(const vcpkg::Dependencies::RequestType& t)
{
switch (t)
{
@@ -38,13 +38,13 @@ namespace Microsoft::VisualStudio::CppUnitTestFramework
}
template<>
- std::wstring ToString<vcpkg::PackageSpecParseResult>(const vcpkg::PackageSpecParseResult& t)
+ inline 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)
+ inline std::wstring ToString<vcpkg::PackageSpec>(const vcpkg::PackageSpec& t)
{
return ToString(t.to_string());
}
diff --git a/toolsrc/include/vcpkg/base/chrono.h b/toolsrc/include/vcpkg/base/chrono.h
index 26294fdf8..89cd15273 100644
--- a/toolsrc/include/vcpkg/base/chrono.h
+++ b/toolsrc/include/vcpkg/base/chrono.h
@@ -56,8 +56,8 @@ namespace vcpkg::Chrono
static Optional<CTime> get_current_date_time();
static Optional<CTime> 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;
diff --git a/toolsrc/include/vcpkg/base/files.h b/toolsrc/include/vcpkg/base/files.h
index b07ff25b3..3ea0d6036 100644
--- a/toolsrc/include/vcpkg/base/files.h
+++ b/toolsrc/include/vcpkg/base/files.h
@@ -2,11 +2,8 @@
#include <vcpkg/base/expected.h>
-#if defined(_WIN32)
-#include <filesystem>
-#else
+#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
#include <experimental/filesystem>
-#endif
namespace fs
{
@@ -27,21 +24,25 @@ namespace vcpkg::Files
{
struct Filesystem
{
+ std::string read_contents(const fs::path& file_path, LineInfo linfo) const;
virtual Expected<std::string> read_contents(const fs::path& file_path) const = 0;
virtual Expected<std::vector<std::string>> read_lines(const fs::path& file_path) const = 0;
virtual fs::path find_file_recursively_up(const fs::path& starting_dir, const std::string& filename) const = 0;
virtual std::vector<fs::path> get_files_recursive(const fs::path& dir) const = 0;
virtual std::vector<fs::path> get_files_non_recursive(const fs::path& dir) const = 0;
-
- virtual void write_lines(const fs::path& file_path, const std::vector<std::string>& lines) = 0;
+ void write_lines(const fs::path& file_path, const std::vector<std::string>& lines, LineInfo linfo);
+ virtual void write_lines(const fs::path& file_path,
+ const std::vector<std::string>& lines,
+ std::error_code& ec) = 0;
+ void write_contents(const fs::path& path, const std::string& data, LineInfo linfo);
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;
+ void rename(const fs::path& oldpath, const fs::path& newpath, LineInfo linfo);
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;
+ bool remove(const fs::path& path, LineInfo linfo);
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;
virtual bool exists(const fs::path& path) const = 0;
@@ -60,8 +61,6 @@ namespace vcpkg::Files
virtual fs::file_status symlink_status(const fs::path& path, std::error_code& ec) const = 0;
virtual std::vector<fs::path> 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();
diff --git a/toolsrc/include/vcpkg/base/graphs.h b/toolsrc/include/vcpkg/base/graphs.h
index 46831a911..9901a49a0 100644
--- a/toolsrc/include/vcpkg/base/graphs.h
+++ b/toolsrc/include/vcpkg/base/graphs.h
@@ -44,9 +44,9 @@ namespace vcpkg::Graphs
void shuffle(Container& c, Randomizer* r)
{
if (!r) return;
- for (int i = static_cast<int>(c.size()); i > 1; --i)
+ for (auto i = c.size(); i > 1; --i)
{
- auto j = r->random(i);
+ auto j = r->random(static_cast<int>(i));
if (j != i - 1)
{
std::swap(c[i - 1], c[j]);
diff --git a/toolsrc/include/vcpkg/base/optional.h b/toolsrc/include/vcpkg/base/optional.h
index 4d386a961..2d8c126c6 100644
--- a/toolsrc/include/vcpkg/base/optional.h
+++ b/toolsrc/include/vcpkg/base/optional.h
@@ -19,6 +19,9 @@ namespace vcpkg
template<class T, bool B = std::is_copy_constructible<T>::value>
struct OptionalStorage
{
+#if defined(_WIN32)
+#pragma warning(suppress : 26495)
+#endif
constexpr OptionalStorage() noexcept : m_is_present(false), m_inactive() {}
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)) {}
@@ -28,12 +31,18 @@ namespace vcpkg
if (m_is_present) m_t.~T();
}
+#if defined(_WIN32)
+#pragma warning(suppress : 26495)
+#endif
OptionalStorage(const OptionalStorage& o) : m_is_present(o.m_is_present), m_inactive()
{
if (m_is_present) new (&m_t) T(o.m_t);
}
- OptionalStorage(OptionalStorage&& o) : m_is_present(o.m_is_present), m_inactive()
+#if defined(_WIN32)
+#pragma warning(suppress : 26495)
+#endif
+ OptionalStorage(OptionalStorage&& o) noexcept : m_is_present(o.m_is_present), m_inactive()
{
if (m_is_present)
{
@@ -59,7 +68,7 @@ namespace vcpkg
return *this;
}
- OptionalStorage& operator=(OptionalStorage&& o)
+ OptionalStorage& operator=(OptionalStorage&& o) noexcept
{
if (m_is_present && o.m_is_present)
{
@@ -100,6 +109,9 @@ namespace vcpkg
template<class T>
struct OptionalStorage<T, false>
{
+#if defined(_WIN32)
+#pragma warning(suppress : 26495)
+#endif
constexpr OptionalStorage() noexcept : m_is_present(false), m_inactive() {}
constexpr OptionalStorage(T&& t) : m_is_present(true), m_t(std::move(t)) {}
@@ -108,7 +120,10 @@ namespace vcpkg
if (m_is_present) m_t.~T();
}
- OptionalStorage(OptionalStorage&& o) : m_is_present(o.m_is_present), m_inactive()
+#if defined(_WIN32)
+#pragma warning(suppress : 26495)
+#endif
+ OptionalStorage(OptionalStorage&& o) noexcept : m_is_present(o.m_is_present), m_inactive()
{
if (m_is_present)
{
@@ -116,7 +131,7 @@ namespace vcpkg
}
}
- OptionalStorage& operator=(OptionalStorage&& o)
+ OptionalStorage& operator=(OptionalStorage&& o) noexcept
{
if (m_is_present && o.m_is_present)
{
diff --git a/toolsrc/include/vcpkg/base/strings.h b/toolsrc/include/vcpkg/base/strings.h
index 3165dc8ee..d553d1d41 100644
--- a/toolsrc/include/vcpkg/base/strings.h
+++ b/toolsrc/include/vcpkg/base/strings.h
@@ -43,7 +43,7 @@ namespace vcpkg::Strings::details
t.to_string(into);
}
- template<class T, class=void, class = decltype(to_string(std::declval<std::string&>(), std::declval<const T&>()))>
+ template<class T, class = void, class = decltype(to_string(std::declval<std::string&>(), std::declval<const T&>()))>
void append_internal(std::string& into, const T& t)
{
to_string(into, t);
@@ -66,7 +66,8 @@ namespace vcpkg::Strings
}
template<class... Args>
- [[nodiscard]] std::string concat(const Args&... args) {
+ [[nodiscard]] std::string concat(const Args&... args)
+ {
std::string ret;
append(ret, args...);
return ret;
@@ -113,8 +114,7 @@ namespace vcpkg::Strings
bool starts_with(StringView s, StringView pattern);
template<class InputIterator, class Transformer>
- std::string join(const char* delimiter, InputIterator begin, InputIterator end,
- Transformer transformer)
+ std::string join(const char* delimiter, InputIterator begin, InputIterator end, Transformer transformer)
{
if (begin == end)
{
@@ -145,8 +145,7 @@ namespace vcpkg::Strings
std::string join(const char* delimiter, InputIterator begin, InputIterator end)
{
using Element = decltype(*begin);
- return join(delimiter, begin, end,
- [](const Element& x) -> const Element& { return x; });
+ return join(delimiter, begin, end, [](const Element& x) -> const Element& { return x; });
}
template<class Container>
@@ -164,7 +163,7 @@ namespace vcpkg::Strings
std::vector<std::string> split(const std::string& s, const std::string& delimiter);
- std::vector<std::string> split(const std::string& s, const std::string& delimiter, int max_count);
+ std::vector<std::string> split(const std::string& s, const std::string& delimiter, size_t max_count);
std::vector<StringView> find_all_enclosed(StringView input, StringView left_delim, StringView right_delim);
diff --git a/toolsrc/include/vcpkg/base/system.h b/toolsrc/include/vcpkg/base/system.h
index 0245b684a..907a692a2 100644
--- a/toolsrc/include/vcpkg/base/system.h
+++ b/toolsrc/include/vcpkg/base/system.h
@@ -28,4 +28,6 @@ namespace vcpkg::System
const Optional<fs::path>& get_program_files_32_bit();
const Optional<fs::path>& get_program_files_platform_bitness();
+
+ int get_num_logical_cores();
}
diff --git a/toolsrc/include/vcpkg/build.h b/toolsrc/include/vcpkg/build.h
index f27e9d67b..04cd7cf87 100644
--- a/toolsrc/include/vcpkg/build.h
+++ b/toolsrc/include/vcpkg/build.h
@@ -20,7 +20,7 @@ namespace vcpkg::Build
namespace Command
{
void perform_and_exit_ex(const FullPackageSpec& full_spec,
- const fs::path& port_dir,
+ const SourceControlFileLocation& scfl,
const ParsedArguments& options,
const VcpkgPaths& paths);
@@ -51,6 +51,12 @@ namespace vcpkg::Build
YES
};
+ enum class CleanDownloads
+ {
+ NO = 0,
+ YES
+ };
+
enum class ConfigurationType
{
DEBUG,
@@ -82,6 +88,7 @@ namespace vcpkg::Build
AllowDownloads allow_downloads;
CleanBuildtrees clean_buildtrees;
CleanPackages clean_packages;
+ CleanDownloads clean_downloads;
DownloadTool download_tool;
BinaryCaching binary_caching;
FailOnTombstone fail_on_tombstone;
diff --git a/toolsrc/include/vcpkg/dependencies.h b/toolsrc/include/vcpkg/dependencies.h
index 16fdb3f73..8c2050b3d 100644
--- a/toolsrc/include/vcpkg/dependencies.h
+++ b/toolsrc/include/vcpkg/dependencies.h
@@ -48,7 +48,7 @@ namespace vcpkg::Dependencies
const RequestType& request_type);
InstallPlanAction(const PackageSpec& spec,
- const SourceControlFile& scf,
+ const SourceControlFileLocation& scfl,
const std::set<std::string>& features,
const RequestType& request_type,
std::vector<PackageSpec>&& dependencies);
@@ -57,7 +57,7 @@ namespace vcpkg::Dependencies
PackageSpec spec;
- Optional<const SourceControlFile&> source_control_file;
+ Optional<const SourceControlFileLocation&> source_control_file_location;
Optional<InstalledPackageView> installed_package;
InstallPlanType plan_type;
@@ -129,26 +129,31 @@ namespace vcpkg::Dependencies
struct PortFileProvider
{
- virtual Optional<const SourceControlFile&> get_control_file(const std::string& src_name) const = 0;
+ virtual Optional<const SourceControlFileLocation&> get_control_file(const std::string& src_name) const = 0;
+ virtual std::vector<const SourceControlFileLocation*> load_all_control_files() const = 0;
};
struct MapPortFileProvider : Util::ResourceBase, PortFileProvider
{
- explicit MapPortFileProvider(const std::unordered_map<std::string, SourceControlFile>& map);
- Optional<const SourceControlFile&> get_control_file(const std::string& src_name) const override;
+ explicit MapPortFileProvider(const std::unordered_map<std::string, SourceControlFileLocation>& map);
+ Optional<const SourceControlFileLocation&> get_control_file(const std::string& src_name) const override;
+ std::vector<const SourceControlFileLocation*> load_all_control_files() const override;
private:
- const std::unordered_map<std::string, SourceControlFile>& ports;
+ const std::unordered_map<std::string, SourceControlFileLocation>& ports;
};
struct PathsPortFileProvider : Util::ResourceBase, PortFileProvider
{
- explicit PathsPortFileProvider(const VcpkgPaths& paths);
- Optional<const SourceControlFile&> get_control_file(const std::string& src_name) const override;
+ explicit PathsPortFileProvider(const vcpkg::VcpkgPaths& paths,
+ const std::vector<std::string>* ports_dirs_paths);
+ Optional<const SourceControlFileLocation&> get_control_file(const std::string& src_name) const override;
+ std::vector<const SourceControlFileLocation*> load_all_control_files() const override;
private:
- const VcpkgPaths& ports;
- mutable std::unordered_map<std::string, SourceControlFile> cache;
+ Files::Filesystem& filesystem;
+ std::vector<fs::path> ports_dirs;
+ mutable std::unordered_map<std::string, SourceControlFileLocation> cache;
};
struct ClusterGraph;
@@ -181,7 +186,7 @@ namespace vcpkg::Dependencies
std::vector<ExportPlanAction> create_export_plan(const std::vector<PackageSpec>& specs,
const StatusParagraphs& status_db);
- std::vector<AnyAction> create_feature_install_plan(const std::unordered_map<std::string, SourceControlFile>& map,
+ std::vector<AnyAction> create_feature_install_plan(const std::unordered_map<std::string, SourceControlFileLocation>& map,
const std::vector<FeatureSpec>& specs,
const StatusParagraphs& status_db);
diff --git a/toolsrc/include/vcpkg/globalstate.h b/toolsrc/include/vcpkg/globalstate.h
index 2026ea369..263b5f80c 100644
--- a/toolsrc/include/vcpkg/globalstate.h
+++ b/toolsrc/include/vcpkg/globalstate.h
@@ -13,8 +13,6 @@ namespace vcpkg
static Util::LockGuarded<Chrono::ElapsedTimer> timer;
static Util::LockGuarded<std::string> g_surveydate;
- static std::atomic<bool> debugging;
- static std::atomic<bool> feature_packages;
static std::atomic<bool> g_binary_caching;
static std::atomic<int> g_init_console_cp;
diff --git a/toolsrc/include/vcpkg/postbuildlint.h b/toolsrc/include/vcpkg/postbuildlint.h
index 5dcfeb8df..027619eb8 100644
--- a/toolsrc/include/vcpkg/postbuildlint.h
+++ b/toolsrc/include/vcpkg/postbuildlint.h
@@ -9,5 +9,6 @@ namespace vcpkg::PostBuildLint
size_t perform_all_checks(const PackageSpec& spec,
const VcpkgPaths& paths,
const Build::PreBuildInfo& pre_build_info,
- const Build::BuildInfo& build_info);
+ const Build::BuildInfo& build_info,
+ const fs::path& port_dir);
}
diff --git a/toolsrc/include/vcpkg/sourceparagraph.h b/toolsrc/include/vcpkg/sourceparagraph.h
index ae5812ea7..6232a3fd2 100644
--- a/toolsrc/include/vcpkg/sourceparagraph.h
+++ b/toolsrc/include/vcpkg/sourceparagraph.h
@@ -48,6 +48,7 @@ namespace vcpkg
std::string version;
std::string description;
std::string maintainer;
+ std::string homepage;
std::vector<std::string> supports;
std::vector<Dependency> depends;
std::vector<std::string> default_features;
@@ -67,6 +68,15 @@ namespace vcpkg
Optional<const FeatureParagraph&> find_feature(const std::string& featurename) const;
};
+ /// <summary>
+ /// Full metadata of a package: core and other features. As well as the location the SourceControlFile was loaded from.
+ /// </summary>
+ struct SourceControlFileLocation
+ {
+ std::unique_ptr<SourceControlFile> source_control_file;
+ fs::path source_location;
+ };
+
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)
{
diff --git a/toolsrc/include/vcpkg/vcpkgcmdarguments.h b/toolsrc/include/vcpkg/vcpkgcmdarguments.h
index de65eec28..cad013eb8 100644
--- a/toolsrc/include/vcpkg/vcpkgcmdarguments.h
+++ b/toolsrc/include/vcpkg/vcpkgcmdarguments.h
@@ -15,6 +15,7 @@ namespace vcpkg
{
std::unordered_set<std::string> switches;
std::unordered_map<std::string, std::string> settings;
+ std::unordered_map<std::string, std::vector<std::string>> multisettings;
};
struct VcpkgPaths;
@@ -41,10 +42,22 @@ namespace vcpkg
StringLiteral short_help_text;
};
+ struct CommandMultiSetting
+ {
+ constexpr CommandMultiSetting(const StringLiteral& name, const StringLiteral& short_help_text)
+ : name(name), short_help_text(short_help_text)
+ {
+ }
+
+ StringLiteral name;
+ StringLiteral short_help_text;
+ };
+
struct CommandOptionsStructure
{
Span<const CommandSwitch> switches;
Span<const CommandSetting> settings;
+ Span<const CommandMultiSetting> multisettings;
};
struct CommandStructure
@@ -74,6 +87,7 @@ namespace vcpkg
std::unique_ptr<std::string> vcpkg_root_dir;
std::unique_ptr<std::string> triplet;
+ std::unique_ptr<std::vector<std::string>> overlay_ports;
Optional<bool> debug = nullopt;
Optional<bool> sendmetrics = nullopt;
Optional<bool> printmetrics = nullopt;
@@ -88,6 +102,6 @@ namespace vcpkg
ParsedArguments parse_arguments(const CommandStructure& command_structure) const;
private:
- std::unordered_map<std::string, Optional<std::string>> optional_command_arguments;
+ std::unordered_map<std::string, Optional<std::vector<std::string>>> optional_command_arguments;
};
}
diff --git a/toolsrc/include/vcpkg/vcpkgpaths.h b/toolsrc/include/vcpkg/vcpkgpaths.h
index 42de40d9c..b09169b02 100644
--- a/toolsrc/include/vcpkg/vcpkgpaths.h
+++ b/toolsrc/include/vcpkg/vcpkgpaths.h
@@ -50,8 +50,6 @@ namespace vcpkg
static Expected<VcpkgPaths> create(const fs::path& vcpkg_root_dir, const std::string& default_vs_path);
fs::path package_dir(const PackageSpec& spec) const;
- fs::path port_dir(const PackageSpec& spec) const;
- fs::path port_dir(const std::string& name) const;
fs::path build_info_file_path(const PackageSpec& spec) const;
fs::path listfile_path(const BinaryParagraph& pgh) const;