2016-09-18 20:50:08 -07:00
|
|
|
#pragma once
|
2017-10-13 18:37:41 -07:00
|
|
|
|
|
|
|
#include <vcpkg/binaryparagraph.h>
|
|
|
|
#include <vcpkg/packagespec.h>
|
2018-07-09 06:29:37 -07:00
|
|
|
#include <vcpkg/tools.h>
|
2020-06-03 19:31:28 -07:00
|
|
|
#include <vcpkg/vcpkgcmdarguments.h>
|
2017-10-13 18:37:41 -07:00
|
|
|
|
2018-04-06 14:51:53 -07:00
|
|
|
#include <vcpkg/base/cache.h>
|
2017-10-13 18:37:41 -07:00
|
|
|
#include <vcpkg/base/files.h>
|
2017-10-16 11:44:04 -07:00
|
|
|
#include <vcpkg/base/lazy.h>
|
2020-06-22 14:14:36 -07:00
|
|
|
#include <vcpkg/base/optional.h>
|
|
|
|
#include <vcpkg/base/util.h>
|
2016-09-18 20:50:08 -07:00
|
|
|
|
|
|
|
namespace vcpkg
|
|
|
|
{
|
2018-04-04 01:45:45 -07:00
|
|
|
namespace Tools
|
|
|
|
{
|
|
|
|
static const std::string SEVEN_ZIP = "7zip";
|
2020-04-06 23:36:17 +02:00
|
|
|
static const std::string SEVEN_ZIP_ALT = "7z";
|
|
|
|
static const std::string MAVEN = "mvn";
|
2018-04-04 01:45:45 -07:00
|
|
|
static const std::string CMAKE = "cmake";
|
|
|
|
static const std::string GIT = "git";
|
2020-07-01 12:18:37 -07:00
|
|
|
static const std::string MONO = "mono";
|
2018-04-04 01:45:45 -07:00
|
|
|
static const std::string NINJA = "ninja";
|
|
|
|
static const std::string NUGET = "nuget";
|
|
|
|
static const std::string IFW_INSTALLER_BASE = "ifw_installerbase";
|
|
|
|
static const std::string IFW_BINARYCREATOR = "ifw_binarycreator";
|
|
|
|
static const std::string IFW_REPOGEN = "ifw_repogen";
|
|
|
|
}
|
|
|
|
|
2017-08-24 13:26:42 +03:00
|
|
|
struct ToolsetArchOption
|
|
|
|
{
|
2017-10-16 11:44:04 -07:00
|
|
|
CStringView name;
|
2017-08-24 13:26:42 +03:00
|
|
|
System::CPUArchitecture host_arch;
|
|
|
|
System::CPUArchitecture target_arch;
|
|
|
|
};
|
|
|
|
|
2017-04-03 16:28:18 -07:00
|
|
|
struct Toolset
|
2017-03-31 17:40:08 -07:00
|
|
|
{
|
2017-10-05 13:51:28 -07:00
|
|
|
fs::path visual_studio_root_path;
|
2017-04-01 02:08:48 -07:00
|
|
|
fs::path dumpbin;
|
|
|
|
fs::path vcvarsall;
|
2017-10-16 11:44:04 -07:00
|
|
|
std::vector<std::string> vcvarsall_options;
|
|
|
|
CStringView version;
|
2017-08-24 13:26:42 +03:00
|
|
|
std::vector<ToolsetArchOption> supported_architectures;
|
2017-03-31 17:40:08 -07:00
|
|
|
};
|
|
|
|
|
2017-11-25 11:49:15 -08:00
|
|
|
namespace Build
|
|
|
|
{
|
|
|
|
struct PreBuildInfo;
|
2020-06-22 14:14:36 -07:00
|
|
|
struct AbiInfo;
|
2017-11-25 11:49:15 -08:00
|
|
|
}
|
|
|
|
|
2020-06-22 14:14:36 -07:00
|
|
|
namespace System
|
|
|
|
{
|
|
|
|
struct Environment;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace details
|
|
|
|
{
|
|
|
|
struct VcpkgPathsImpl;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct VcpkgPaths : Util::MoveOnlyBase
|
2016-09-18 20:50:08 -07:00
|
|
|
{
|
2020-01-17 14:21:19 -08:00
|
|
|
struct TripletFile
|
|
|
|
{
|
|
|
|
std::string name;
|
|
|
|
fs::path location;
|
|
|
|
|
[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
|
|
|
TripletFile(const std::string& name, const fs::path& location) : name(name), location(location) { }
|
2020-01-17 14:21:19 -08:00
|
|
|
};
|
|
|
|
|
2020-06-03 19:31:28 -07:00
|
|
|
VcpkgPaths(Files::Filesystem& filesystem, const VcpkgCmdArguments& args);
|
[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
|
|
|
~VcpkgPaths();
|
2016-09-18 20:50:08 -07:00
|
|
|
|
2017-04-03 14:45:00 -07:00
|
|
|
fs::path package_dir(const PackageSpec& spec) const;
|
2020-07-02 20:20:07 -07:00
|
|
|
fs::path build_dir(const PackageSpec& spec) const;
|
|
|
|
fs::path build_dir(const std::string& package_name) const;
|
2017-04-03 14:45:00 -07:00
|
|
|
fs::path build_info_file_path(const PackageSpec& spec) const;
|
2016-11-07 17:54:23 -08:00
|
|
|
fs::path listfile_path(const BinaryParagraph& pgh) const;
|
[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
|
|
|
|
2020-02-07 11:24:35 -08:00
|
|
|
bool is_valid_triplet(Triplet t) const;
|
2020-01-17 14:21:19 -08:00
|
|
|
const std::vector<std::string> get_available_triplets_names() const;
|
|
|
|
const std::vector<TripletFile>& get_available_triplets() const;
|
2020-02-07 11:24:35 -08:00
|
|
|
const fs::path get_triplet_file_path(Triplet triplet) const;
|
2016-09-23 14:25:17 -07:00
|
|
|
|
2020-05-08 12:41:44 -07:00
|
|
|
fs::path original_cwd;
|
2016-09-30 16:34:55 -07:00
|
|
|
fs::path root;
|
[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
|
|
|
fs::path manifest_root_dir;
|
2016-09-30 16:34:55 -07:00
|
|
|
fs::path buildtrees;
|
|
|
|
fs::path downloads;
|
2020-06-03 19:31:28 -07:00
|
|
|
fs::path packages;
|
2016-09-30 16:34:55 -07:00
|
|
|
fs::path ports;
|
|
|
|
fs::path installed;
|
|
|
|
fs::path triplets;
|
2020-01-17 14:21:19 -08:00
|
|
|
fs::path community_triplets;
|
2017-01-23 15:12:43 -08:00
|
|
|
fs::path scripts;
|
2020-06-03 19:31:28 -07:00
|
|
|
fs::path prefab;
|
2016-09-18 20:50:08 -07:00
|
|
|
|
2018-05-05 04:23:19 -07:00
|
|
|
fs::path tools;
|
2016-09-30 16:34:55 -07:00
|
|
|
fs::path buildsystems;
|
|
|
|
fs::path buildsystems_msbuild_targets;
|
2020-06-15 23:24:14 +02:00
|
|
|
fs::path buildsystems_msbuild_props;
|
2016-09-18 20:50:08 -07:00
|
|
|
|
2016-09-30 16:34:55 -07:00
|
|
|
fs::path vcpkg_dir;
|
|
|
|
fs::path vcpkg_dir_status_file;
|
|
|
|
fs::path vcpkg_dir_info;
|
|
|
|
fs::path vcpkg_dir_updates;
|
2016-09-18 20:50:08 -07:00
|
|
|
|
2016-09-30 16:34:55 -07:00
|
|
|
fs::path ports_cmake;
|
2017-03-10 16:30:44 -08:00
|
|
|
|
2018-04-04 01:45:45 -07:00
|
|
|
const fs::path& get_tool_exe(const std::string& tool) const;
|
2018-07-09 06:29:37 -07:00
|
|
|
const std::string& get_tool_version(const std::string& tool) const;
|
2017-06-02 18:13:12 +02:00
|
|
|
|
2017-06-05 22:01:41 -07:00
|
|
|
/// <summary>Retrieve a toolset matching a VS version</summary>
|
|
|
|
/// <remarks>
|
2017-09-02 16:48:29 +02:00
|
|
|
/// Valid version strings are "v120", "v140", "v141", and "". Empty string gets the latest.
|
2017-06-05 22:01:41 -07:00
|
|
|
/// </remarks>
|
2017-11-25 11:49:15 -08:00
|
|
|
const Toolset& get_toolset(const Build::PreBuildInfo& prebuildinfo) const;
|
2017-03-10 16:30:44 -08:00
|
|
|
|
2017-04-08 16:26:26 -07:00
|
|
|
Files::Filesystem& get_filesystem() const;
|
|
|
|
|
2020-06-22 14:14:36 -07:00
|
|
|
const System::Environment& get_action_env(const Build::AbiInfo& abi_info) const;
|
|
|
|
const std::string& get_triplet_info(const Build::AbiInfo& abi_info) const;
|
[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
|
|
|
bool manifest_mode_enabled() const { return !manifest_root_dir.empty(); }
|
|
|
|
|
|
|
|
void track_feature_flag_metrics() const;
|
2018-07-09 06:29:37 -07:00
|
|
|
|
2020-06-22 14:14:36 -07:00
|
|
|
private:
|
|
|
|
std::unique_ptr<details::VcpkgPathsImpl> m_pimpl;
|
2016-09-18 20:50:08 -07:00
|
|
|
};
|
|
|
|
}
|