diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-02-17 14:55:37 -0800 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-02-17 15:08:05 -0800 |
| commit | ff222fac454449b2fc108bf5271e1823db54d3da (patch) | |
| tree | e2d2177ca4ac5ca8019a47683e6412af2e3d4066 /toolsrc | |
| parent | 1c3335ed66597e90a1f0b2c393522a28bff1f400 (diff) | |
| download | vcpkg-ff222fac454449b2fc108bf5271e1823db54d3da.tar.gz vcpkg-ff222fac454449b2fc108bf5271e1823db54d3da.zip | |
[build_command] Extract function for calculations after Input processing
Diffstat (limited to 'toolsrc')
| -rw-r--r-- | toolsrc/include/vcpkg_Commands.h | 1 | ||||
| -rw-r--r-- | toolsrc/src/commands_build.cpp | 20 |
2 files changed, 13 insertions, 8 deletions
diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 5c643d017..7956cdab8 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -29,6 +29,7 @@ namespace vcpkg::Commands std::string create_user_troubleshooting_message(const package_spec& spec); BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db); + void perform_and_exit(const package_spec& spec, const fs::path& port_dir, const std::unordered_set<std::string>& options, const vcpkg_paths& paths); void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); } diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index 38dd4cfe6..eaba531cb 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -112,13 +112,8 @@ namespace vcpkg::Commands::Build , spec.toString(), Info::version()); } - void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) + void perform_and_exit(const package_spec& spec, const fs::path& port_dir, const std::unordered_set<std::string>& options, const vcpkg_paths& paths) { - static const std::string example = Commands::Help::create_example_string("build zlib:x64-windows"); - args.check_exact_arg_count(1, example); // Build only takes a single package and all dependencies must already be installed - const package_spec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_target_triplet, example); - Input::check_triplet(spec.target_triplet(), paths); - const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({ OPTION_CHECKS_ONLY }); if (options.find(OPTION_CHECKS_ONLY) != options.end()) { const size_t error_count = PostBuildLint::perform_all_checks(spec, paths); @@ -129,8 +124,7 @@ namespace vcpkg::Commands::Build exit(EXIT_SUCCESS); } - // Explicitly load and use the portfile's build dependencies when resolving the build command (instead of a cached package's dependencies). - const expected<SourceParagraph> maybe_spgh = try_load_port(paths, spec.name()); + const expected<SourceParagraph> maybe_spgh = try_load_port(port_dir); Checks::check_exit(!maybe_spgh.error_code(), "Could not find package named %s: %s", spec, maybe_spgh.error_code().message()); const SourceParagraph& spgh = *maybe_spgh.get(); @@ -168,4 +162,14 @@ namespace vcpkg::Commands::Build exit(EXIT_SUCCESS); } + + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) + { + static const std::string example = Commands::Help::create_example_string("build zlib:x64-windows"); + args.check_exact_arg_count(1, example); // Build only takes a single package and all dependencies must already be installed + const package_spec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_target_triplet, example); + Input::check_triplet(spec.target_triplet(), paths); + const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({ OPTION_CHECKS_ONLY }); + perform_and_exit(spec, paths.port_dir(spec), options, paths); + } } |
