diff options
| author | nicole mazzuca <mazzucan@outlook.com> | 2020-08-01 16:45:00 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-01 16:45:00 -0700 |
| commit | d6565e146cb131ad818a29c7d531969277582b17 (patch) | |
| tree | b77e2dd5fe96ad7dd62df938d0fed614fa3797d4 /toolsrc/src | |
| parent | 80d8bf5b72cdda9cac63b4e56a0b592b5830aff4 (diff) | |
| download | vcpkg-d6565e146cb131ad818a29c7d531969277582b17.tar.gz vcpkg-d6565e146cb131ad818a29c7d531969277582b17.zip | |
[vcpkg manifest] add feature support (#12549)
Diffstat (limited to 'toolsrc/src')
| -rw-r--r-- | toolsrc/src/vcpkg/install.cpp | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/toolsrc/src/vcpkg/install.cpp b/toolsrc/src/vcpkg/install.cpp index ec8eba8dd..5cadbd786 100644 --- a/toolsrc/src/vcpkg/install.cpp +++ b/toolsrc/src/vcpkg/install.cpp @@ -512,6 +512,8 @@ namespace vcpkg::Install static constexpr StringLiteral OPTION_USE_ARIA2 = "x-use-aria2"; static constexpr StringLiteral OPTION_CLEAN_AFTER_BUILD = "clean-after-build"; static constexpr StringLiteral OPTION_WRITE_PACKAGES_CONFIG = "x-write-nuget-packages-config"; + static constexpr StringLiteral OPTION_MANIFEST_NO_DEFAULT_FEATURES = "x-no-default-features"; + static constexpr StringLiteral OPTION_MANIFEST_FEATURE = "x-feature"; static constexpr std::array<CommandSwitch, 9> INSTALL_SWITCHES = {{ {OPTION_DRY_RUN, "Do not actually build or install"}, @@ -524,6 +526,19 @@ namespace vcpkg::Install {OPTION_USE_ARIA2, "Use aria2 to perform download tasks"}, {OPTION_CLEAN_AFTER_BUILD, "Clean buildtrees, packages and downloads after building each package"}, }}; + static constexpr std::array<CommandSwitch, 10> MANIFEST_INSTALL_SWITCHES = {{ + {OPTION_DRY_RUN, "Do not actually build or install"}, + {OPTION_USE_HEAD_VERSION, "Install the libraries on the command line using the latest upstream sources"}, + {OPTION_NO_DOWNLOADS, "Do not download new sources"}, + {OPTION_ONLY_DOWNLOADS, "Download sources but don't build packages"}, + {OPTION_RECURSE, "Allow removal of packages as part of installation"}, + {OPTION_KEEP_GOING, "Continue installing packages on failure"}, + {OPTION_EDITABLE, "Disable source re-extraction and binary caching for libraries on the command line"}, + {OPTION_USE_ARIA2, "Use aria2 to perform download tasks"}, + {OPTION_CLEAN_AFTER_BUILD, "Clean buildtrees, packages and downloads after building each package"}, + {OPTION_MANIFEST_NO_DEFAULT_FEATURES, "Don't install the default features from the manifest."}, + }}; + static constexpr std::array<CommandSetting, 2> INSTALL_SETTINGS = {{ {OPTION_XUNIT, "File to output results in XUnit format (Internal use)"}, {OPTION_WRITE_PACKAGES_CONFIG, @@ -531,6 +546,10 @@ namespace vcpkg::Install "binarycaching` for more information."}, }}; + static constexpr std::array<CommandMultiSetting, 1> MANIFEST_INSTALL_MULTISETTINGS = {{ + {OPTION_MANIFEST_FEATURE, "A feature from the manifest to install."}, + }}; + std::vector<std::string> get_all_port_names(const VcpkgPaths& paths) { auto sources_and_errors = Paragraphs::try_load_all_ports(paths.get_filesystem(), paths.ports); @@ -551,7 +570,7 @@ namespace vcpkg::Install create_example_string("install --triplet x64-windows"), 0, 0, - {INSTALL_SWITCHES, INSTALL_SETTINGS}, + {MANIFEST_INSTALL_SWITCHES, INSTALL_SETTINGS, MANIFEST_INSTALL_MULTISETTINGS}, nullptr, }; @@ -750,8 +769,24 @@ namespace vcpkg::Install pkgsconfig = fs::u8path(it_pkgsconfig->second); } + std::vector<std::string> features; + + if (Util::Sets::contains(options.switches, OPTION_MANIFEST_NO_DEFAULT_FEATURES)) + { + features.emplace_back("core"); + } + + auto manifest_feature_it = options.multisettings.find(OPTION_MANIFEST_FEATURE); + if (manifest_feature_it != options.multisettings.end()) + { + for (const auto& feature : manifest_feature_it->second) + { + features.push_back(feature); + } + } + std::vector<FullPackageSpec> specs; - specs.emplace_back(PackageSpec{PackageSpec::MANIFEST_NAME, default_triplet}); + specs.emplace_back(PackageSpec{PackageSpec::MANIFEST_NAME, default_triplet}, std::move(features)); auto install_plan = Dependencies::create_feature_install_plan(provider, var_provider, specs, {}); for (InstallPlanAction& action : install_plan.install_actions) |
