aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/vcpkg/base/strings.h2
-rw-r--r--toolsrc/include/vcpkg/base/system.process.h12
-rw-r--r--toolsrc/include/vcpkg/base/util.h13
-rw-r--r--toolsrc/include/vcpkg/binarycaching.h12
-rw-r--r--toolsrc/include/vcpkg/binarycaching.private.h54
-rw-r--r--toolsrc/include/vcpkg/build.h3
-rw-r--r--toolsrc/include/vcpkg/vcpkgcmdarguments.h1
7 files changed, 95 insertions, 2 deletions
diff --git a/toolsrc/include/vcpkg/base/strings.h b/toolsrc/include/vcpkg/base/strings.h
index 425d846df..17bef7675 100644
--- a/toolsrc/include/vcpkg/base/strings.h
+++ b/toolsrc/include/vcpkg/base/strings.h
@@ -175,6 +175,8 @@ namespace vcpkg::Strings
std::vector<std::string> split(const std::string& s, const char delimiter);
+ const char* find_first_of(StringView searched, StringView candidates);
+
std::vector<StringView> find_all_enclosed(StringView input, StringView left_delim, StringView right_delim);
StringView find_exactly_one_enclosed(StringView input, StringView left_tag, StringView right_tag);
diff --git a/toolsrc/include/vcpkg/base/system.process.h b/toolsrc/include/vcpkg/base/system.process.h
index 0e6a92444..91faa5985 100644
--- a/toolsrc/include/vcpkg/base/system.process.h
+++ b/toolsrc/include/vcpkg/base/system.process.h
@@ -23,6 +23,18 @@ namespace vcpkg::System
const fs::path& cmake_script,
const std::vector<CMakeVariable>& pass_variables);
+ struct CmdLineBuilder
+ {
+ CmdLineBuilder& path_arg(const fs::path& p) { return string_arg(p.u8string()); }
+ CmdLineBuilder& string_arg(StringView s);
+ std::string extract() noexcept { return std::move(buf); }
+
+ operator ZStringView() const { return buf; }
+
+ private:
+ std::string buf;
+ };
+
fs::path get_exe_path_of_current_process();
struct ExitCodeAndOutput
diff --git a/toolsrc/include/vcpkg/base/util.h b/toolsrc/include/vcpkg/base/util.h
index 89f2c51d6..a5b56028b 100644
--- a/toolsrc/include/vcpkg/base/util.h
+++ b/toolsrc/include/vcpkg/base/util.h
@@ -49,6 +49,19 @@ namespace vcpkg::Util
}
}
+ template<class Range, class Pred, class E = ElementT<Range>>
+ std::vector<E> filter(const Range& xs, Pred&& f)
+ {
+ std::vector<E> ret;
+
+ for (auto&& x : xs)
+ {
+ if (f(x)) ret.push_back(x);
+ }
+
+ return ret;
+ }
+
template<class Range, class Func>
using FmapOut = std::remove_reference_t<decltype(std::declval<Func&>()(*std::declval<Range>().begin()))>;
diff --git a/toolsrc/include/vcpkg/binarycaching.h b/toolsrc/include/vcpkg/binarycaching.h
index 88f529c22..d343d6c42 100644
--- a/toolsrc/include/vcpkg/binarycaching.h
+++ b/toolsrc/include/vcpkg/binarycaching.h
@@ -8,6 +8,7 @@
namespace vcpkg::Dependencies
{
struct InstallPlanAction;
+ struct ActionPlan;
}
namespace vcpkg::Build
{
@@ -27,10 +28,17 @@ namespace vcpkg
struct IBinaryProvider
{
virtual ~IBinaryProvider() = default;
- virtual void prefetch() = 0;
+ /// Gives the BinaryProvider an opportunity to batch any downloading or server communication for executing
+ /// `plan`.
+ virtual void prefetch(const VcpkgPaths& paths, const Dependencies::ActionPlan& plan) = 0;
+ /// Attempts to restore the package referenced by `action` into the packages directory.
virtual RestoreResult try_restore(const VcpkgPaths& paths, const Dependencies::InstallPlanAction& action) = 0;
+ /// Called upon a successful build of `action`
virtual void push_success(const VcpkgPaths& paths, const Dependencies::InstallPlanAction& action) = 0;
+ /// Called upon a failure during the build of `action`
virtual void push_failure(const VcpkgPaths& paths, const std::string& abi_tag, const PackageSpec& spec) = 0;
+ /// Requests the result of `try_restore()` without actually downloading the package. Used by CI to determine
+ /// missing packages.
virtual RestoreResult precheck(const VcpkgPaths& paths,
const Dependencies::InstallPlanAction& action,
bool purge_tombstones) = 0;
@@ -42,4 +50,6 @@ namespace vcpkg
View<std::string> args);
ExpectedS<std::unique_ptr<IBinaryProvider>> create_binary_provider_from_configs_pure(const std::string& env_string,
View<std::string> args);
+
+ void help_topic_binary_caching(const VcpkgPaths& paths);
}
diff --git a/toolsrc/include/vcpkg/binarycaching.private.h b/toolsrc/include/vcpkg/binarycaching.private.h
new file mode 100644
index 000000000..f1fd046de
--- /dev/null
+++ b/toolsrc/include/vcpkg/binarycaching.private.h
@@ -0,0 +1,54 @@
+#pragma once
+
+#include <string>
+#include <vcpkg/dependencies.h>
+#include <vcpkg/packagespec.h>
+#include <vcpkg/vcpkgpaths.h>
+
+namespace vcpkg
+{
+ std::string reformat_version(const std::string& version, const std::string& abi_tag);
+
+ struct NugetReference
+ {
+ explicit NugetReference(const Dependencies::InstallPlanAction& action)
+ : NugetReference(action.spec,
+ action.source_control_file_location.value_or_exit(VCPKG_LINE_INFO)
+ .source_control_file->core_paragraph->version,
+ action.abi_info.value_or_exit(VCPKG_LINE_INFO).package_abi)
+ {
+ }
+
+ NugetReference(const PackageSpec& spec, const std::string& raw_version, const std::string& abi_tag)
+ : id(spec.dir()), version(reformat_version(raw_version, abi_tag))
+ {
+ }
+
+ std::string id;
+ std::string version;
+
+ std::string nupkg_filename() const { return Strings::concat(id, '.', version, ".nupkg"); }
+ };
+
+ std::string generate_nuspec(const VcpkgPaths& paths,
+ const Dependencies::InstallPlanAction& action,
+ const NugetReference& ref);
+
+ struct XmlSerializer
+ {
+ std::string buf;
+ int indent = 0;
+
+ XmlSerializer& emit_declaration();
+ XmlSerializer& open_tag(StringLiteral sl);
+ XmlSerializer& start_complex_open_tag(StringLiteral sl);
+ XmlSerializer& text_attr(StringLiteral name, StringView content);
+ XmlSerializer& finish_complex_open_tag();
+ XmlSerializer& finish_self_closing_complex_tag();
+ XmlSerializer& close_tag(StringLiteral sl);
+ XmlSerializer& text(StringView sv);
+ XmlSerializer& simple_tag(StringLiteral tag, StringView content);
+ XmlSerializer& line_break();
+ };
+
+} \ No newline at end of file
diff --git a/toolsrc/include/vcpkg/build.h b/toolsrc/include/vcpkg/build.h
index e2e28b08a..804cb6673 100644
--- a/toolsrc/include/vcpkg/build.h
+++ b/toolsrc/include/vcpkg/build.h
@@ -284,7 +284,8 @@ namespace vcpkg::Build
struct AbiInfo
{
std::unique_ptr<PreBuildInfo> pre_build_info;
- const Toolset* toolset;
+ Optional<const Toolset&> toolset;
+ Optional<const std::string&> triplet_abi;
std::string package_abi;
Optional<fs::path> abi_tag_file;
};
diff --git a/toolsrc/include/vcpkg/vcpkgcmdarguments.h b/toolsrc/include/vcpkg/vcpkgcmdarguments.h
index 378aa9703..690245d08 100644
--- a/toolsrc/include/vcpkg/vcpkgcmdarguments.h
+++ b/toolsrc/include/vcpkg/vcpkgcmdarguments.h
@@ -92,6 +92,7 @@ namespace vcpkg
void example(StringView example_text);
void header(StringView name);
void blank();
+ void text(StringView text, int indent = 0);
std::string m_str;
};