2016-09-22 23:28:50 -07:00
|
|
|
#pragma once
|
2017-10-13 18:37:41 -07:00
|
|
|
|
|
|
|
#include <vcpkg/base/optional.h>
|
|
|
|
#include <vcpkg/base/util.h>
|
2017-10-31 03:04:28 -07:00
|
|
|
#include <vcpkg/build.h>
|
2020-02-03 14:22:52 -08:00
|
|
|
#include <vcpkg/cmakevars.h>
|
2017-10-13 18:37:41 -07:00
|
|
|
#include <vcpkg/packagespec.h>
|
2020-02-03 14:22:52 -08:00
|
|
|
#include <vcpkg/portfileprovider.h>
|
2017-10-13 18:37:41 -07:00
|
|
|
#include <vcpkg/statusparagraphs.h>
|
|
|
|
#include <vcpkg/vcpkgpaths.h>
|
|
|
|
|
2019-01-18 19:03:37 -08:00
|
|
|
#include <functional>
|
2020-05-14 12:49:31 -07:00
|
|
|
#include <map>
|
2017-04-27 17:56:06 -07:00
|
|
|
#include <vector>
|
2016-09-22 23:28:50 -07:00
|
|
|
|
2019-01-18 19:03:37 -08:00
|
|
|
namespace vcpkg::Graphs
|
|
|
|
{
|
|
|
|
struct Randomizer;
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:14:11 -08:00
|
|
|
namespace vcpkg::Dependencies
|
2016-09-22 23:28:50 -07:00
|
|
|
{
|
2017-04-03 16:21:46 -07:00
|
|
|
enum class RequestType
|
2017-01-30 13:57:43 -08:00
|
|
|
{
|
2017-01-30 17:52:53 -08:00
|
|
|
UNKNOWN,
|
2017-01-30 13:57:43 -08:00
|
|
|
USER_REQUESTED,
|
|
|
|
AUTO_SELECTED
|
|
|
|
};
|
|
|
|
|
2017-10-31 03:04:28 -07:00
|
|
|
std::string to_output_string(RequestType request_type,
|
|
|
|
const CStringView s,
|
|
|
|
const Build::BuildPackageOptions& options);
|
2017-04-06 18:57:17 -07:00
|
|
|
std::string to_output_string(RequestType request_type, const CStringView s);
|
|
|
|
|
2017-04-03 16:22:32 -07:00
|
|
|
enum class InstallPlanType
|
2016-11-15 11:56:46 -08:00
|
|
|
{
|
2017-01-30 17:52:53 -08:00
|
|
|
UNKNOWN,
|
2016-11-15 11:56:46 -08:00
|
|
|
BUILD_AND_INSTALL,
|
2017-10-26 19:00:30 -07:00
|
|
|
ALREADY_INSTALLED,
|
|
|
|
EXCLUDED
|
2016-11-15 11:56:46 -08:00
|
|
|
};
|
2016-09-22 23:28:50 -07:00
|
|
|
|
2017-08-21 20:06:47 -07:00
|
|
|
struct InstallPlanAction : Util::MoveOnlyBase
|
2016-11-15 11:56:46 -08:00
|
|
|
{
|
2017-04-12 21:28:49 -07:00
|
|
|
static bool compare_by_name(const InstallPlanAction* left, const InstallPlanAction* right);
|
|
|
|
|
2018-04-12 00:47:17 -07:00
|
|
|
InstallPlanAction() noexcept;
|
2017-08-21 20:06:47 -07:00
|
|
|
|
2020-02-03 14:22:52 -08:00
|
|
|
InstallPlanAction(InstalledPackageView&& spghs, const RequestType& request_type);
|
2018-01-23 02:21:47 -08:00
|
|
|
|
2017-07-12 17:40:41 -07:00
|
|
|
InstallPlanAction(const PackageSpec& spec,
|
2019-06-21 23:50:05 -07:00
|
|
|
const SourceControlFileLocation& scfl,
|
2018-03-14 10:30:27 -07:00
|
|
|
const RequestType& request_type,
|
2020-05-14 12:49:31 -07:00
|
|
|
std::map<std::string, std::vector<FeatureSpec>>&& dependencies);
|
2017-08-21 20:06:47 -07:00
|
|
|
|
2017-07-25 21:29:31 -07:00
|
|
|
std::string displayname() const;
|
2020-02-11 23:52:56 -08:00
|
|
|
const std::string& public_abi() const;
|
2020-06-22 14:14:36 -07:00
|
|
|
const Build::PreBuildInfo& pre_build_info(LineInfo linfo) const;
|
2017-01-30 17:52:53 -08:00
|
|
|
|
2017-04-12 21:28:49 -07:00
|
|
|
PackageSpec spec;
|
2018-01-23 02:21:47 -08:00
|
|
|
|
2019-06-21 23:50:05 -07:00
|
|
|
Optional<const SourceControlFileLocation&> source_control_file_location;
|
2018-01-23 06:50:24 -08:00
|
|
|
Optional<InstalledPackageView> installed_package;
|
2018-01-23 02:21:47 -08:00
|
|
|
|
2017-04-03 16:22:32 -07:00
|
|
|
InstallPlanType plan_type;
|
2017-04-07 13:03:11 -07:00
|
|
|
RequestType request_type;
|
2017-10-31 03:04:28 -07:00
|
|
|
Build::BuildPackageOptions build_options;
|
2018-03-14 10:30:27 -07:00
|
|
|
|
2020-05-14 12:49:31 -07:00
|
|
|
std::map<std::string, std::vector<FeatureSpec>> feature_dependencies;
|
2020-02-03 14:22:52 -08:00
|
|
|
std::vector<PackageSpec> package_dependencies;
|
|
|
|
std::vector<std::string> feature_list;
|
2020-02-11 23:52:56 -08:00
|
|
|
|
2020-06-22 14:14:36 -07:00
|
|
|
Optional<Build::AbiInfo> abi_info;
|
2016-11-15 11:56:46 -08:00
|
|
|
};
|
|
|
|
|
2017-04-03 16:23:46 -07:00
|
|
|
enum class RemovePlanType
|
2017-01-26 14:25:36 -08:00
|
|
|
{
|
2017-01-30 17:52:53 -08:00
|
|
|
UNKNOWN,
|
2017-01-26 14:25:36 -08:00
|
|
|
NOT_INSTALLED,
|
2017-01-30 13:57:43 -08:00
|
|
|
REMOVE
|
2017-01-26 14:25:36 -08:00
|
|
|
};
|
|
|
|
|
2017-08-22 15:14:15 -07:00
|
|
|
struct RemovePlanAction : Util::MoveOnlyBase
|
2017-01-26 17:53:45 -08:00
|
|
|
{
|
2017-04-12 21:37:55 -07:00
|
|
|
static bool compare_by_name(const RemovePlanAction* left, const RemovePlanAction* right);
|
|
|
|
|
2018-04-12 00:47:17 -07:00
|
|
|
RemovePlanAction() noexcept;
|
2017-04-12 21:37:55 -07:00
|
|
|
RemovePlanAction(const PackageSpec& spec, const RemovePlanType& plan_type, const RequestType& request_type);
|
2017-01-30 17:52:53 -08:00
|
|
|
|
2017-04-12 21:37:55 -07:00
|
|
|
PackageSpec spec;
|
2017-04-03 16:23:46 -07:00
|
|
|
RemovePlanType plan_type;
|
2017-04-03 16:21:46 -07:00
|
|
|
RequestType request_type;
|
2017-01-26 17:53:45 -08:00
|
|
|
};
|
|
|
|
|
2020-02-03 14:22:52 -08:00
|
|
|
struct ActionPlan
|
2017-07-12 17:40:41 -07:00
|
|
|
{
|
2020-02-03 14:22:52 -08:00
|
|
|
bool empty() const { return remove_actions.empty() && already_installed.empty() && install_actions.empty(); }
|
|
|
|
size_t size() const { return remove_actions.size() + already_installed.size() + install_actions.size(); }
|
2017-09-13 17:23:04 -07:00
|
|
|
|
2020-02-03 14:22:52 -08:00
|
|
|
std::vector<RemovePlanAction> remove_actions;
|
|
|
|
std::vector<InstallPlanAction> already_installed;
|
|
|
|
std::vector<InstallPlanAction> install_actions;
|
2017-07-12 17:40:41 -07:00
|
|
|
};
|
|
|
|
|
2017-04-10 12:57:49 -07:00
|
|
|
enum class ExportPlanType
|
|
|
|
{
|
|
|
|
UNKNOWN,
|
2018-02-28 12:15:16 -08:00
|
|
|
NOT_BUILT,
|
2017-04-10 12:57:49 -07:00
|
|
|
ALREADY_BUILT
|
|
|
|
};
|
|
|
|
|
2017-08-22 15:14:15 -07:00
|
|
|
struct ExportPlanAction : Util::MoveOnlyBase
|
2017-04-10 12:57:49 -07:00
|
|
|
{
|
|
|
|
static bool compare_by_name(const ExportPlanAction* left, const ExportPlanAction* right);
|
|
|
|
|
2018-04-12 00:47:17 -07:00
|
|
|
ExportPlanAction() noexcept;
|
2018-01-23 02:21:47 -08:00
|
|
|
ExportPlanAction(const PackageSpec& spec,
|
2018-01-23 06:50:24 -08:00
|
|
|
InstalledPackageView&& installed_package,
|
2018-01-23 02:21:47 -08:00
|
|
|
const RequestType& request_type);
|
|
|
|
|
|
|
|
ExportPlanAction(const PackageSpec& spec, const RequestType& request_type);
|
2017-04-10 12:57:49 -07:00
|
|
|
|
|
|
|
PackageSpec spec;
|
|
|
|
ExportPlanType plan_type;
|
|
|
|
RequestType request_type;
|
2018-01-23 02:21:47 -08:00
|
|
|
|
|
|
|
Optional<const BinaryParagraph&> core_paragraph() const;
|
2020-02-07 11:24:35 -08:00
|
|
|
std::vector<PackageSpec> dependencies(Triplet triplet) const;
|
2018-01-23 02:21:47 -08:00
|
|
|
|
|
|
|
private:
|
2018-01-23 06:50:24 -08:00
|
|
|
Optional<InstalledPackageView> m_installed_package;
|
2017-04-10 12:57:49 -07:00
|
|
|
};
|
|
|
|
|
2017-12-13 05:43:00 -08:00
|
|
|
struct ClusterGraph;
|
|
|
|
|
2019-01-18 19:03:37 -08:00
|
|
|
struct CreateInstallPlanOptions
|
|
|
|
{
|
|
|
|
Graphs::Randomizer* randomizer = nullptr;
|
|
|
|
};
|
|
|
|
|
2017-04-27 17:56:06 -07:00
|
|
|
std::vector<RemovePlanAction> create_remove_plan(const std::vector<PackageSpec>& specs,
|
|
|
|
const StatusParagraphs& status_db);
|
2017-04-10 12:57:49 -07:00
|
|
|
|
2018-02-28 12:15:16 -08:00
|
|
|
std::vector<ExportPlanAction> create_export_plan(const std::vector<PackageSpec>& specs,
|
2017-04-27 17:56:06 -07:00
|
|
|
const StatusParagraphs& status_db);
|
2017-07-12 17:40:41 -07:00
|
|
|
|
2019-01-18 19:03:37 -08:00
|
|
|
/// <summary>Figure out which actions are required to install features specifications in `specs`.</summary>
|
|
|
|
/// <param name="provider">Contains the ports of the current environment.</param>
|
|
|
|
/// <param name="specs">Feature specifications to resolve dependencies for.</param>
|
|
|
|
/// <param name="status_db">Status of installed packages in the current environment.</param>
|
2020-02-03 14:22:52 -08:00
|
|
|
ActionPlan create_feature_install_plan(const PortFileProvider::PortFileProvider& provider,
|
|
|
|
const CMakeVars::CMakeVarProvider& var_provider,
|
|
|
|
const std::vector<FullPackageSpec>& specs,
|
|
|
|
const StatusParagraphs& status_db,
|
|
|
|
const CreateInstallPlanOptions& options = {});
|
|
|
|
|
|
|
|
ActionPlan create_upgrade_plan(const PortFileProvider::PortFileProvider& provider,
|
|
|
|
const CMakeVars::CMakeVarProvider& var_provider,
|
|
|
|
const std::vector<PackageSpec>& specs,
|
|
|
|
const StatusParagraphs& status_db,
|
|
|
|
const CreateInstallPlanOptions& options = {});
|
|
|
|
|
|
|
|
void print_plan(const ActionPlan& action_plan,
|
2019-06-24 12:09:48 -07:00
|
|
|
const bool is_recursive = true,
|
[vcpkg manifest] Manifest Implementation (#11757)
==== Changes Related to manifests ====
* Add the `manifests` feature flag
* This only says whether we look for a `vcpkg.json` in the cwd, not
whether we support parsing manifests (for ports, for example)
* Changes to the manifests RFC
* `"authors"` -> `"maintainers"`
* `--x-classic-mode` -> `-manifests` \in `vcpkg_feature_flags`
* reserve `"core"` in addition to `"default"`, since that's already
reserved for features
* Add a small helper note about what identifiers must look like
* `<license-string>`: SPDX v3.8 -> v3.9
* `"feature"."description"` is allowed to be an array of strings as well
* `"version"` -> `"version-string"` for forward-compat with versions
RFC
* Add the `--feature-flags` option
* Add the ability to turn off feature flags via passing
`-<feature-flag>` to `VCPKG_FEATURE_FLAGS` or `--feature-flags`
* Add CMake toolchain support for manifests
* Requires either:
* a feature flag of `manifests` in either `Env{VCPKG_FEATURE_FLAGS}`
or `VCPKG_FEATURE_FLAGS`
* Passing the `VCPKG_ENABLE_MANIFESTS` option
* The toolchain will install your packages to
`${VCPKG_MANIFEST_DIR}/vcpkg_installed`.
* Add MSBuild `vcpkg integrate install` support for manifests
* Requires `VcpkgEnableManifest` to be true
* `vcpkg create` creates a port that has a `vcpkg.json` instead of a
`CONTROL`
* argparse, abseil, 3fd, and avisynthplus ports switched to manifest
from CONTROL
* Add support for `--x-manifest-root`, as well as code for finding it if
not passed
* Add support for parsing manifests!
* Add a filesystem lock!
==== Important Changes which are somewhat unrelated to manifests ====
* Rename `logicexpression.{h,cpp}` to `platform-expression.{h,cpp}`
* Add `PlatformExpression` type which takes the place of the old logic
expression
* Split the parsing of platform expressions from checking whether
they're true or not
* Eagerly parse PlatformExpressions as opposed to leaving them as
strings
* Add checking for feature flag consistency
* i.e., if `-binarycaching` is passed, you shouldn't be passing
`--binarysource`
* Add the `Json::Reader` type which, with the help of user-defined
visitors, converts JSON to your internal type
* VcpkgArgParser: place the switch names into a constant as opposed to
using magic constants
* In general update the parsing code so that this ^ works
* Add `Port-Version` fields to CONTROL files
* This replaces the existing practice of
`Version: <my-version>-<port-version>`
==== Smaller changes ====
* small drive-by cleanups to some CMake
* `${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}` ->
`${CURRENT_INSTALLED_DIR}`
* Remove `-analyze` when compiling with clang-cl, since that's not a
supported flag (vcpkg's build system)
* Add a message about which compiler is detected by vcpkg's build
system machinery
* Fix `Expected::then`
* Convert `""` to `{}` for `std::string` and `fs::path`, to avoid a
`strlen` (additionally, `.empty()` instead of `== ""`, and `.clear()`)
* Add `Strings::strto` which converts strings to numeric types
* Support built-in arrays and `StringView` for `Strings::join`
* Add `operator<` and friends to `StringView`
* Add `substr` to `StringView`
* SourceParagraphParser gets some new errors
2020-06-30 10:40:18 -07:00
|
|
|
const fs::path& default_ports_dir = {});
|
2017-07-12 17:40:41 -07:00
|
|
|
}
|