cemu-vcpkg/toolsrc/include/vcpkg/binarycaching.private.h
ras0219 91e798afd8
[vcpkg] Implementation of --x-binarysource=nuget (and friends) (#12058)
* [vcpkg] Initial implementation of --x-binarysource=nuget

* [vcpkg] Remove double-double quoting of CMake arguments

* [vcpkg] Update nuget.exe to 5.5.1 to support Azure DevOps Artifacts

* [vcpkg] Enable batching of NuGet server calls with prefetch(). Add `interactive` binarysource.

* [vcpkg] Add `nugetconfig` binary source

* [vcpkg] Short circuit querying remote NuGet servers once all refs are found

* [vcpkg] Add experimental help for binary caching

* [vcpkg] Improved NuGet cache package descriptions and version formatting

* [vcpkg] Rename `CmdLineBuilder::build()` to extract()

* [vcpkg-help] Ascii-betize help topics

* [vcpkg] Add tests for cmdlinebuilder. Improve handling of quotes and slashes.

* [vcpkg] Addressing code review comments

* [vcpkg] Add tests for vcpkg::reformat_version()

* [vcpkg] Added test for vcpkg::generate_nuspec()

* [vcpkg] Add tests for vcpkg::XmlSerializer

* [vcpkg] Addressed code review comment

* [vcpkg] Add test for vcpkg::Strings::find_first_of

* [vcpkg] Fix machine-specific paths in test for vcpkg::generate_nuspec()

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
2020-06-26 12:16:02 -07:00

54 lines
1.9 KiB
C++

#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();
};
}