mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-12 18:17:53 +08:00
425d07ef7f
* [vcpkg] Add Default-Feature to make_status_pgh utility function Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Parse "Default-Features" as dependencies and add test for parsing Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Document some methods and structures Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Add install_default_features_test Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Change install_default_features_test to not have preinstalled package * [vcpkg] Test install behaviour of default features Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Implement default features Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Test default features upgrade behavior Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Implement upgrade with default features Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Test behaviour of upgrade with default features in dependencies Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Make upgrade install new default features Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Move collecting of packages for which to prevent defaults Further down the line to create_feature_install_plan. Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Fix core missing from default features and potential inf loop Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Rename, fix and move some tests Signed-off-by: Squareys <squareys@googlemail.com>
105 lines
2.9 KiB
C++
105 lines
2.9 KiB
C++
#pragma once
|
|
|
|
#include <vcpkg/packagespec.h>
|
|
#include <vcpkg/parse.h>
|
|
|
|
#include <vcpkg/base/expected.h>
|
|
#include <vcpkg/base/span.h>
|
|
#include <vcpkg/base/system.h>
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace vcpkg
|
|
{
|
|
struct Dependency
|
|
{
|
|
Features depend;
|
|
std::string qualifier;
|
|
|
|
std::string name() const;
|
|
static Dependency parse_dependency(std::string name, std::string qualifier);
|
|
};
|
|
|
|
std::vector<std::string> filter_dependencies(const std::vector<Dependency>& deps, const Triplet& t);
|
|
std::vector<FeatureSpec> filter_dependencies_to_specs(const std::vector<Dependency>& deps, const Triplet& t);
|
|
|
|
// zlib[uwp] becomes Dependency{"zlib", "uwp"}
|
|
std::vector<Dependency> expand_qualified_dependencies(const std::vector<std::string>& depends);
|
|
|
|
std::string to_string(const Dependency& dep);
|
|
|
|
/// <summary>
|
|
/// Port metadata of additional feature in a package (part of CONTROL file)
|
|
/// </summary>
|
|
struct FeatureParagraph
|
|
{
|
|
std::string name;
|
|
std::string description;
|
|
std::vector<Dependency> depends;
|
|
};
|
|
|
|
/// <summary>
|
|
/// Port metadata of the core feature of a package (part of CONTROL file)
|
|
/// </summary>
|
|
struct SourceParagraph
|
|
{
|
|
std::string name;
|
|
std::string version;
|
|
std::string description;
|
|
std::string maintainer;
|
|
std::vector<std::string> supports;
|
|
std::vector<Dependency> depends;
|
|
std::vector<std::string> default_features;
|
|
};
|
|
|
|
/// <summary>
|
|
/// Full metadata of a package: core and other features.
|
|
/// </summary>
|
|
struct SourceControlFile
|
|
{
|
|
static Parse::ParseExpected<SourceControlFile> parse_control_file(
|
|
std::vector<Parse::RawParagraph>&& control_paragraphs);
|
|
|
|
std::unique_ptr<SourceParagraph> core_paragraph;
|
|
std::vector<std::unique_ptr<FeatureParagraph>> feature_paragraphs;
|
|
};
|
|
|
|
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)
|
|
{
|
|
return print_error_message({&error_info_list, 1});
|
|
}
|
|
|
|
struct Supports
|
|
{
|
|
static ExpectedT<Supports, std::vector<std::string>> parse(const std::vector<std::string>& strs);
|
|
|
|
using Architecture = System::CPUArchitecture;
|
|
|
|
enum class Platform
|
|
{
|
|
WINDOWS,
|
|
UWP,
|
|
};
|
|
enum class Linkage
|
|
{
|
|
DYNAMIC,
|
|
STATIC,
|
|
};
|
|
enum class ToolsetVersion
|
|
{
|
|
V140,
|
|
V141,
|
|
};
|
|
|
|
bool is_supported(Architecture arch, Platform plat, Linkage crt, ToolsetVersion tools);
|
|
|
|
private:
|
|
std::vector<Architecture> architectures;
|
|
std::vector<Platform> platforms;
|
|
std::vector<Linkage> crt_linkages;
|
|
std::vector<ToolsetVersion> toolsets;
|
|
};
|
|
}
|