aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
authorVictor Romero <romerosanchezv@gmail.com>2019-06-21 23:50:05 -0700
committerGitHub <noreply@github.com>2019-06-21 23:50:05 -0700
commitf3db66b403840b24ea2612d09cca30a5285f5ea3 (patch)
treeeb3504205b87fa7ae5b7ccdba4820469c9e856c0 /toolsrc/include
parentd1b4e88d3c1bd714069f10009c6f9cef172cc822 (diff)
downloadvcpkg-f3db66b403840b24ea2612d09cca30a5285f5ea3.tar.gz
vcpkg-f3db66b403840b24ea2612d09cca30a5285f5ea3.zip
Ports Overlay partial implementation (#6981)
* Ports Overlay feature spec * Ports Overlay implementation * [--overlay-ports] Refactor handling of additional paths * Code cleanup * [--overlay-ports] Add help * [depend-info] Support --overlay-ports * Add method to load all ports using PathsPortFileProvider * Make PortFileProvider::load_all_control_files() const * Remove unused code * [vcpkg] Avoid double-load of source control file between Build::perform_and_exit and Build::perform_and_exit_ex * [vcpkg] Clang format * [vcpkg] Fixup build failure introduced in b069ceb2f231 * Report errors from Paragraphs::try_load_port()
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/vcpkg/build.h2
-rw-r--r--toolsrc/include/vcpkg/dependencies.h27
-rw-r--r--toolsrc/include/vcpkg/postbuildlint.h3
-rw-r--r--toolsrc/include/vcpkg/sourceparagraph.h9
-rw-r--r--toolsrc/include/vcpkg/vcpkgcmdarguments.h16
-rw-r--r--toolsrc/include/vcpkg/vcpkgpaths.h2
6 files changed, 43 insertions, 16 deletions
diff --git a/toolsrc/include/vcpkg/build.h b/toolsrc/include/vcpkg/build.h
index 9044cb556..04cd7cf87 100644
--- a/toolsrc/include/vcpkg/build.h
+++ b/toolsrc/include/vcpkg/build.h
@@ -20,7 +20,7 @@ namespace vcpkg::Build
namespace Command
{
void perform_and_exit_ex(const FullPackageSpec& full_spec,
- const fs::path& port_dir,
+ const SourceControlFileLocation& scfl,
const ParsedArguments& options,
const VcpkgPaths& paths);
diff --git a/toolsrc/include/vcpkg/dependencies.h b/toolsrc/include/vcpkg/dependencies.h
index 16fdb3f73..8c2050b3d 100644
--- a/toolsrc/include/vcpkg/dependencies.h
+++ b/toolsrc/include/vcpkg/dependencies.h
@@ -48,7 +48,7 @@ namespace vcpkg::Dependencies
const RequestType& request_type);
InstallPlanAction(const PackageSpec& spec,
- const SourceControlFile& scf,
+ const SourceControlFileLocation& scfl,
const std::set<std::string>& features,
const RequestType& request_type,
std::vector<PackageSpec>&& dependencies);
@@ -57,7 +57,7 @@ namespace vcpkg::Dependencies
PackageSpec spec;
- Optional<const SourceControlFile&> source_control_file;
+ Optional<const SourceControlFileLocation&> source_control_file_location;
Optional<InstalledPackageView> installed_package;
InstallPlanType plan_type;
@@ -129,26 +129,31 @@ namespace vcpkg::Dependencies
struct PortFileProvider
{
- virtual Optional<const SourceControlFile&> get_control_file(const std::string& src_name) const = 0;
+ virtual Optional<const SourceControlFileLocation&> get_control_file(const std::string& src_name) const = 0;
+ virtual std::vector<const SourceControlFileLocation*> load_all_control_files() const = 0;
};
struct MapPortFileProvider : Util::ResourceBase, PortFileProvider
{
- explicit MapPortFileProvider(const std::unordered_map<std::string, SourceControlFile>& map);
- Optional<const SourceControlFile&> get_control_file(const std::string& src_name) const override;
+ explicit MapPortFileProvider(const std::unordered_map<std::string, SourceControlFileLocation>& map);
+ Optional<const SourceControlFileLocation&> get_control_file(const std::string& src_name) const override;
+ std::vector<const SourceControlFileLocation*> load_all_control_files() const override;
private:
- const std::unordered_map<std::string, SourceControlFile>& ports;
+ const std::unordered_map<std::string, SourceControlFileLocation>& ports;
};
struct PathsPortFileProvider : Util::ResourceBase, PortFileProvider
{
- explicit PathsPortFileProvider(const VcpkgPaths& paths);
- Optional<const SourceControlFile&> get_control_file(const std::string& src_name) const override;
+ explicit PathsPortFileProvider(const vcpkg::VcpkgPaths& paths,
+ const std::vector<std::string>* ports_dirs_paths);
+ Optional<const SourceControlFileLocation&> get_control_file(const std::string& src_name) const override;
+ std::vector<const SourceControlFileLocation*> load_all_control_files() const override;
private:
- const VcpkgPaths& ports;
- mutable std::unordered_map<std::string, SourceControlFile> cache;
+ Files::Filesystem& filesystem;
+ std::vector<fs::path> ports_dirs;
+ mutable std::unordered_map<std::string, SourceControlFileLocation> cache;
};
struct ClusterGraph;
@@ -181,7 +186,7 @@ namespace vcpkg::Dependencies
std::vector<ExportPlanAction> create_export_plan(const std::vector<PackageSpec>& specs,
const StatusParagraphs& status_db);
- std::vector<AnyAction> create_feature_install_plan(const std::unordered_map<std::string, SourceControlFile>& map,
+ std::vector<AnyAction> create_feature_install_plan(const std::unordered_map<std::string, SourceControlFileLocation>& map,
const std::vector<FeatureSpec>& specs,
const StatusParagraphs& status_db);
diff --git a/toolsrc/include/vcpkg/postbuildlint.h b/toolsrc/include/vcpkg/postbuildlint.h
index 5dcfeb8df..027619eb8 100644
--- a/toolsrc/include/vcpkg/postbuildlint.h
+++ b/toolsrc/include/vcpkg/postbuildlint.h
@@ -9,5 +9,6 @@ namespace vcpkg::PostBuildLint
size_t perform_all_checks(const PackageSpec& spec,
const VcpkgPaths& paths,
const Build::PreBuildInfo& pre_build_info,
- const Build::BuildInfo& build_info);
+ const Build::BuildInfo& build_info,
+ const fs::path& port_dir);
}
diff --git a/toolsrc/include/vcpkg/sourceparagraph.h b/toolsrc/include/vcpkg/sourceparagraph.h
index d70fd4337..6232a3fd2 100644
--- a/toolsrc/include/vcpkg/sourceparagraph.h
+++ b/toolsrc/include/vcpkg/sourceparagraph.h
@@ -68,6 +68,15 @@ namespace vcpkg
Optional<const FeatureParagraph&> find_feature(const std::string& featurename) const;
};
+ /// <summary>
+ /// Full metadata of a package: core and other features. As well as the location the SourceControlFile was loaded from.
+ /// </summary>
+ struct SourceControlFileLocation
+ {
+ std::unique_ptr<SourceControlFile> source_control_file;
+ fs::path source_location;
+ };
+
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)
{
diff --git a/toolsrc/include/vcpkg/vcpkgcmdarguments.h b/toolsrc/include/vcpkg/vcpkgcmdarguments.h
index de65eec28..cad013eb8 100644
--- a/toolsrc/include/vcpkg/vcpkgcmdarguments.h
+++ b/toolsrc/include/vcpkg/vcpkgcmdarguments.h
@@ -15,6 +15,7 @@ namespace vcpkg
{
std::unordered_set<std::string> switches;
std::unordered_map<std::string, std::string> settings;
+ std::unordered_map<std::string, std::vector<std::string>> multisettings;
};
struct VcpkgPaths;
@@ -41,10 +42,22 @@ namespace vcpkg
StringLiteral short_help_text;
};
+ struct CommandMultiSetting
+ {
+ constexpr CommandMultiSetting(const StringLiteral& name, const StringLiteral& short_help_text)
+ : name(name), short_help_text(short_help_text)
+ {
+ }
+
+ StringLiteral name;
+ StringLiteral short_help_text;
+ };
+
struct CommandOptionsStructure
{
Span<const CommandSwitch> switches;
Span<const CommandSetting> settings;
+ Span<const CommandMultiSetting> multisettings;
};
struct CommandStructure
@@ -74,6 +87,7 @@ namespace vcpkg
std::unique_ptr<std::string> vcpkg_root_dir;
std::unique_ptr<std::string> triplet;
+ std::unique_ptr<std::vector<std::string>> overlay_ports;
Optional<bool> debug = nullopt;
Optional<bool> sendmetrics = nullopt;
Optional<bool> printmetrics = nullopt;
@@ -88,6 +102,6 @@ namespace vcpkg
ParsedArguments parse_arguments(const CommandStructure& command_structure) const;
private:
- std::unordered_map<std::string, Optional<std::string>> optional_command_arguments;
+ std::unordered_map<std::string, Optional<std::vector<std::string>>> optional_command_arguments;
};
}
diff --git a/toolsrc/include/vcpkg/vcpkgpaths.h b/toolsrc/include/vcpkg/vcpkgpaths.h
index 42de40d9c..b09169b02 100644
--- a/toolsrc/include/vcpkg/vcpkgpaths.h
+++ b/toolsrc/include/vcpkg/vcpkgpaths.h
@@ -50,8 +50,6 @@ namespace vcpkg
static Expected<VcpkgPaths> create(const fs::path& vcpkg_root_dir, const std::string& default_vs_path);
fs::path package_dir(const PackageSpec& spec) const;
- fs::path port_dir(const PackageSpec& spec) const;
- fs::path port_dir(const std::string& name) const;
fs::path build_info_file_path(const PackageSpec& spec) const;
fs::path listfile_path(const BinaryParagraph& pgh) const;