2016-09-18 20:50:08 -07:00
|
|
|
#pragma once
|
|
|
|
|
2017-10-13 18:37:41 -07:00
|
|
|
#include <vcpkg/packagespec.h>
|
|
|
|
#include <vcpkg/parse.h>
|
|
|
|
|
|
|
|
#include <vcpkg/base/expected.h>
|
2017-10-16 11:44:04 -07:00
|
|
|
#include <vcpkg/base/span.h>
|
2017-10-13 18:37:41 -07:00
|
|
|
#include <vcpkg/base/system.h>
|
2017-06-06 16:08:36 -07:00
|
|
|
|
|
|
|
#include <string>
|
2017-04-27 17:56:06 -07:00
|
|
|
#include <vector>
|
2016-09-18 20:50:08 -07:00
|
|
|
|
|
|
|
namespace vcpkg
|
|
|
|
{
|
2017-07-25 21:29:31 -07:00
|
|
|
struct Dependency
|
|
|
|
{
|
|
|
|
Features depend;
|
2016-11-05 01:02:15 -07:00
|
|
|
std::string qualifier;
|
2017-07-25 21:29:31 -07:00
|
|
|
|
|
|
|
std::string name() const;
|
2017-12-23 07:29:12 -08:00
|
|
|
static Dependency parse_dependency(std::string name, std::string qualifier);
|
2016-11-05 01:02:15 -07:00
|
|
|
};
|
|
|
|
|
2017-08-20 19:36:43 -07:00
|
|
|
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);
|
[vcpkg] Make Filesystem::remove_all faster #7570
I added benchmarks to measure how fast the parallel remove_all code was
-- it turns out, about 3x slower than stdfs::remove_all. Since this was
the case, I removed all of the parallelism and rewrote it serially, and
ended up about 30% faster than stdfs::remove_all (in addition to
supporting symlinks).
In addition, I did the following three orthogonal changes:
- simplified the work queue, basing it on Billy O'Neal's idea
- Fix warnings on older versions of compilers in tests, by splitting
the pragmas out of pch.h.
- Ran clang-format on some files
In fixing up remove_all, the following changes were made:
- On Windows, regular symlinks and directory symlinks are distinct;
as an example, to remove directory symlinks (and junctions, for that
matter), one must use RemoveDirectory. Only on Windows, I added new
`file_type` and `file_status` types, with `file_type` including a new
`directory_symlink` enumerator, and `file_status` being exactly the
same as the old one except using the new `file_type`. On Unix, I
didn't make that change since they don't make a distinction.
- I added new `symlink_status` and `status` functions which use the
new `file_status` on Windows.
- I made `Filesystem::exists` call `fs::exists(status(p))`, as opposed
to the old version which called `stdfs::exists` directly.
- Added benchmarks to `vcpkg-test/files.cpp`. They test the
performance of `remove_all` on small directories (~20 files), with
symlinks and without, and on large directories (~2000 files), with
symlinks and without.
2019-08-02 16:49:45 -07:00
|
|
|
std::vector<Features> filter_dependencies_to_features(const std::vector<vcpkg::Dependency>& deps, const Triplet& t);
|
2017-08-20 19:36:43 -07:00
|
|
|
|
|
|
|
// zlib[uwp] becomes Dependency{"zlib", "uwp"}
|
|
|
|
std::vector<Dependency> expand_qualified_dependencies(const std::vector<std::string>& depends);
|
|
|
|
|
2017-09-01 17:13:45 -07:00
|
|
|
std::string to_string(const Dependency& dep);
|
2016-11-05 01:02:15 -07:00
|
|
|
|
2018-02-15 01:18:25 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Port metadata of additional feature in a package (part of CONTROL file)
|
|
|
|
/// </summary>
|
2017-06-19 15:06:15 -07:00
|
|
|
struct FeatureParagraph
|
|
|
|
{
|
|
|
|
std::string name;
|
|
|
|
std::string description;
|
|
|
|
std::vector<Dependency> depends;
|
|
|
|
};
|
|
|
|
|
2017-05-24 15:54:12 -07:00
|
|
|
/// <summary>
|
2018-02-15 01:18:25 +01:00
|
|
|
/// Port metadata of the core feature of a package (part of CONTROL file)
|
2017-05-24 15:54:12 -07:00
|
|
|
/// </summary>
|
2016-09-18 20:50:08 -07:00
|
|
|
struct SourceParagraph
|
|
|
|
{
|
|
|
|
std::string name;
|
|
|
|
std::string version;
|
|
|
|
std::string description;
|
|
|
|
std::string maintainer;
|
2019-06-10 16:35:22 -07:00
|
|
|
std::string homepage;
|
2017-06-06 16:08:36 -07:00
|
|
|
std::vector<std::string> supports;
|
2017-04-03 15:12:42 -07:00
|
|
|
std::vector<Dependency> depends;
|
2017-06-17 02:39:14 -07:00
|
|
|
std::vector<std::string> default_features;
|
2016-09-18 20:50:08 -07:00
|
|
|
};
|
2018-02-15 01:18:25 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Full metadata of a package: core and other features.
|
|
|
|
/// </summary>
|
2017-06-19 15:06:15 -07:00
|
|
|
struct SourceControlFile
|
|
|
|
{
|
2017-06-17 02:39:14 -07:00
|
|
|
static Parse::ParseExpected<SourceControlFile> parse_control_file(
|
|
|
|
std::vector<Parse::RawParagraph>&& control_paragraphs);
|
2017-06-19 15:06:15 -07:00
|
|
|
|
2017-06-17 02:39:14 -07:00
|
|
|
std::unique_ptr<SourceParagraph> core_paragraph;
|
2017-06-19 15:06:15 -07:00
|
|
|
std::vector<std::unique_ptr<FeatureParagraph>> feature_paragraphs;
|
2018-03-14 10:30:27 -07:00
|
|
|
|
|
|
|
Optional<const FeatureParagraph&> find_feature(const std::string& featurename) const;
|
2017-06-19 15:06:15 -07:00
|
|
|
};
|
|
|
|
|
2019-06-21 23:50:05 -07:00
|
|
|
/// <summary>
|
[vcpkg] Make Filesystem::remove_all faster #7570
I added benchmarks to measure how fast the parallel remove_all code was
-- it turns out, about 3x slower than stdfs::remove_all. Since this was
the case, I removed all of the parallelism and rewrote it serially, and
ended up about 30% faster than stdfs::remove_all (in addition to
supporting symlinks).
In addition, I did the following three orthogonal changes:
- simplified the work queue, basing it on Billy O'Neal's idea
- Fix warnings on older versions of compilers in tests, by splitting
the pragmas out of pch.h.
- Ran clang-format on some files
In fixing up remove_all, the following changes were made:
- On Windows, regular symlinks and directory symlinks are distinct;
as an example, to remove directory symlinks (and junctions, for that
matter), one must use RemoveDirectory. Only on Windows, I added new
`file_type` and `file_status` types, with `file_type` including a new
`directory_symlink` enumerator, and `file_status` being exactly the
same as the old one except using the new `file_type`. On Unix, I
didn't make that change since they don't make a distinction.
- I added new `symlink_status` and `status` functions which use the
new `file_status` on Windows.
- I made `Filesystem::exists` call `fs::exists(status(p))`, as opposed
to the old version which called `stdfs::exists` directly.
- Added benchmarks to `vcpkg-test/files.cpp`. They test the
performance of `remove_all` on small directories (~20 files), with
symlinks and without, and on large directories (~2000 files), with
symlinks and without.
2019-08-02 16:49:45 -07:00
|
|
|
/// Full metadata of a package: core and other features. As well as the location the SourceControlFile was loaded
|
|
|
|
/// from.
|
2019-06-21 23:50:05 -07:00
|
|
|
/// </summary>
|
|
|
|
struct SourceControlFileLocation
|
|
|
|
{
|
|
|
|
std::unique_ptr<SourceControlFile> source_control_file;
|
|
|
|
fs::path source_location;
|
|
|
|
};
|
|
|
|
|
2017-10-03 15:51:04 -07:00
|
|
|
void print_error_message(Span<const std::unique_ptr<Parse::ParseControlErrorInfo>> error_info_list);
|
2017-06-17 02:39:14 -07:00
|
|
|
inline void print_error_message(const std::unique_ptr<Parse::ParseControlErrorInfo>& error_info_list)
|
2017-06-08 00:36:17 -07:00
|
|
|
{
|
|
|
|
return print_error_message({&error_info_list, 1});
|
|
|
|
}
|
2017-06-05 15:58:47 -07:00
|
|
|
|
2017-06-06 16:08:36 -07:00
|
|
|
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,
|
|
|
|
};
|
|
|
|
|
2017-06-08 04:36:11 -07:00
|
|
|
bool is_supported(Architecture arch, Platform plat, Linkage crt, ToolsetVersion tools);
|
2017-06-06 16:08:36 -07:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<Architecture> architectures;
|
|
|
|
std::vector<Platform> platforms;
|
|
|
|
std::vector<Linkage> crt_linkages;
|
|
|
|
std::vector<ToolsetVersion> toolsets;
|
|
|
|
};
|
2016-09-18 20:50:08 -07:00
|
|
|
}
|