From b4304c9c995d7984566ed28294836bccbdfc24b2 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 15:09:15 -0800 Subject: `build-external` now calls code from `build` after input processing --- toolsrc/src/commands_build_external.cpp | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) (limited to 'toolsrc/src') diff --git a/toolsrc/src/commands_build_external.cpp b/toolsrc/src/commands_build_external.cpp index 0b4010310..06bd1374c 100644 --- a/toolsrc/src/commands_build_external.cpp +++ b/toolsrc/src/commands_build_external.cpp @@ -3,7 +3,6 @@ #include "vcpkg_System.h" #include "vcpkg_Environment.h" #include "vcpkg_Input.h" -#include "vcpkglib.h" namespace vcpkg::Commands::BuildExternal { @@ -11,32 +10,11 @@ namespace vcpkg::Commands::BuildExternal { static const std::string example = Commands::Help::create_example_string(R"(build_external zlib2 C:\path\to\dir\with\controlfile\)"); args.check_exact_arg_count(2, example); + 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 options = args.check_and_get_optional_command_arguments({}); - StatusParagraphs status_db = database_load_check(paths); - - expected maybe_current_spec = package_spec::from_string(args.command_arguments[0], default_target_triplet); - if (auto spec = maybe_current_spec.get()) - { - Input::check_triplet(spec->target_triplet(), paths); - Environment::ensure_utilities_on_path(paths); - const fs::path port_dir = args.command_arguments.at(1); - const expected maybe_spgh = try_load_port(port_dir); - if (auto spgh = maybe_spgh.get()) - { - const Build::BuildResult result = Commands::Build::build_package(*spgh, *spec, paths, port_dir, status_db); - if (result != Build::BuildResult::SUCCEEDED) - { - System::println(System::color::error, Build::create_error_message(result, *spec)); - System::println(Build::create_user_troubleshooting_message(*spec)); - exit(EXIT_FAILURE); - } - - exit(EXIT_SUCCESS); - } - } - - System::println(System::color::error, "Error: %s: %s", maybe_current_spec.error_code().message(), args.command_arguments[0]); - Commands::Help::print_example(Strings::format("%s zlib:x64-windows", args.command)); - exit(EXIT_FAILURE); + const fs::path port_dir = args.command_arguments.at(1); + Build::perform_and_exit(spec, port_dir, options, paths); } } -- cgit v1.2.3