diff options
Diffstat (limited to 'toolsrc/include')
| -rw-r--r-- | toolsrc/include/pch.h | 4 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/cache.h | 21 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/files.h | 1 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/strings.h | 4 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/system.h | 9 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/util.h | 18 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/build.h | 22 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/commands.h | 14 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/dependencies.h | 5 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/install.h | 1 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/paragraphs.h | 2 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/sourceparagraph.h | 2 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/vcpkgpaths.h | 4 |
13 files changed, 94 insertions, 13 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/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/files.h b/toolsrc/include/vcpkg/base/files.h index 09393b9ee..ac1f192ae 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; diff --git a/toolsrc/include/vcpkg/base/strings.h b/toolsrc/include/vcpkg/base/strings.h index 6ef840fb3..c32e81ac2 100644 --- a/toolsrc/include/vcpkg/base/strings.h +++ b/toolsrc/include/vcpkg/base/strings.h @@ -46,7 +46,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..c73345719 100644 --- a/toolsrc/include/vcpkg/base/util.h +++ b/toolsrc/include/vcpkg/base/util.h @@ -6,8 +6,6 @@ #include <utility> #include <vector> -#include <vcpkg/base/optional.h> - namespace vcpkg::Util { template<class Container> @@ -24,10 +22,10 @@ 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.cend(); + return container.find(item) != container.end(); } } @@ -158,6 +156,8 @@ namespace vcpkg::Util MoveOnlyBase& operator=(const MoveOnlyBase&) = delete; MoveOnlyBase& operator=(MoveOnlyBase&&) = default; + + ~MoveOnlyBase() = default; }; struct ResourceBase @@ -168,6 +168,8 @@ namespace vcpkg::Util ResourceBase& operator=(const ResourceBase&) = delete; ResourceBase& operator=(ResourceBase&&) = delete; + + ~ResourceBase() = default; }; template<class T> @@ -214,4 +216,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..1c22d39d8 100644 --- a/toolsrc/include/vcpkg/build.h +++ b/toolsrc/include/vcpkg/build.h @@ -204,4 +204,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..7369b8206 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); } @@ -120,7 +132,7 @@ namespace vcpkg::Commands namespace Hash { 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); + std::string get_file_hash(const VcpkgPaths& paths, 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..33af6c4f5 100644 --- a/toolsrc/include/vcpkg/dependencies.h +++ b/toolsrc/include/vcpkg/dependencies.h @@ -45,7 +45,8 @@ namespace vcpkg::Dependencies 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 +59,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 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/paragraphs.h b/toolsrc/include/vcpkg/paragraphs.h index e2c7f2d99..fa0265b75 100644 --- a/toolsrc/include/vcpkg/paragraphs.h +++ b/toolsrc/include/vcpkg/paragraphs.h @@ -20,7 +20,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/vcpkgpaths.h b/toolsrc/include/vcpkg/vcpkgpaths.h index 84e8110ec..71f1bbba9 100644 --- a/toolsrc/include/vcpkg/vcpkgpaths.h +++ b/toolsrc/include/vcpkg/vcpkgpaths.h @@ -33,7 +33,7 @@ namespace vcpkg struct VcpkgPaths { - static Expected<VcpkgPaths> create(const fs::path& vcpkg_root_dir); + 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; @@ -90,5 +90,7 @@ namespace vcpkg Lazy<fs::path> ifw_repogen_exe; Lazy<std::vector<Toolset>> toolsets; Lazy<std::vector<Toolset>> toolsets_vs2013; + + fs::path default_vs_path; }; } |
