121 lines
3.6 KiB
C
Raw Normal View History

2016-09-18 20:50:08 -07:00
#pragma once
#include <vcpkg/binaryparagraph.h>
#include <vcpkg/packagespec.h>
#include <vcpkg/tools.h>
#include <vcpkg/vcpkgcmdarguments.h>
2018-04-06 14:51:53 -07:00
#include <vcpkg/base/cache.h>
#include <vcpkg/base/expected.h>
#include <vcpkg/base/files.h>
#include <vcpkg/base/lazy.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";
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";
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";
}
struct ToolsetArchOption
{
CStringView name;
System::CPUArchitecture host_arch;
System::CPUArchitecture target_arch;
};
2017-04-03 16:28:18 -07:00
struct Toolset
{
fs::path visual_studio_root_path;
fs::path dumpbin;
fs::path vcvarsall;
std::vector<std::string> vcvarsall_options;
CStringView version;
std::vector<ToolsetArchOption> supported_architectures;
};
namespace Build
{
struct PreBuildInfo;
}
2017-04-03 16:29:11 -07:00
struct VcpkgPaths
2016-09-18 20:50:08 -07:00
{
struct TripletFile
{
std::string name;
fs::path location;
TripletFile(const std::string& name, const fs::path& location) : name(name), location(location) {}
};
VcpkgPaths(Files::Filesystem& filesystem, const VcpkgCmdArguments& args);
2016-09-18 20:50:08 -07:00
2017-04-03 14:45:00 -07:00
fs::path package_dir(const PackageSpec& spec) const;
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
bool is_valid_triplet(Triplet t) const;
const std::vector<std::string> get_available_triplets_names() const;
const std::vector<TripletFile>& get_available_triplets() const;
const fs::path get_triplet_file_path(Triplet triplet) const;
fs::path original_cwd;
fs::path root;
fs::path buildtrees;
fs::path downloads;
fs::path packages;
fs::path ports;
fs::path installed;
fs::path triplets;
fs::path community_triplets;
2017-01-23 15:12:43 -08:00
fs::path scripts;
fs::path prefab;
2016-09-18 20:50:08 -07:00
fs::path tools;
fs::path buildsystems;
fs::path buildsystems_msbuild_targets;
2016-09-18 20:50:08 -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
fs::path ports_cmake;
2018-04-04 01:45:45 -07:00
const fs::path& get_tool_exe(const std::string& tool) const;
const std::string& get_tool_version(const std::string& tool) const;
/// <summary>Retrieve a toolset matching a VS version</summary>
/// <remarks>
/// Valid version strings are "v120", "v140", "v141", and "". Empty string gets the latest.
/// </remarks>
const Toolset& get_toolset(const Build::PreBuildInfo& prebuildinfo) const;
Files::Filesystem& get_filesystem() const;
private:
Lazy<std::vector<TripletFile>> available_triplets;
Lazy<std::vector<Toolset>> toolsets;
Lazy<std::vector<Toolset>> toolsets_vs2013;
fs::path default_vs_path;
std::vector<fs::path> triplets_dirs;
Files::Filesystem* fsPtr;
mutable std::unique_ptr<ToolCache> m_tool_cache;
mutable vcpkg::Cache<Triplet, fs::path> m_triplets_cache;
2016-09-18 20:50:08 -07:00
};
}