diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-02-03 18:10:29 -0800 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-02-10 14:00:11 -0800 |
| commit | a13b2f0c92d1cd5322ed0cb839a4bba5b1ab6aa7 (patch) | |
| tree | 35cda0b755f5d3c7304b44663c6e1732a0df7664 /toolsrc/src/commands_build.cpp | |
| parent | 95650bdd424b9499f4676dae8f110b15b3fd024f (diff) | |
| download | vcpkg-a13b2f0c92d1cd5322ed0cb839a4bba5b1ab6aa7.tar.gz vcpkg-a13b2f0c92d1cd5322ed0cb839a4bba5b1ab6aa7.zip | |
build_package() modified to return the result of the build
Diffstat (limited to 'toolsrc/src/commands_build.cpp')
| -rw-r--r-- | toolsrc/src/commands_build.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index c5a278450..a9c6469d7 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -9,6 +9,7 @@ #include "vcpkg_Environment.h" #include "metrics.h" #include "vcpkg_info.h" +#include "vcpkg_Enums.h" namespace vcpkg::Commands::Build { @@ -24,7 +25,7 @@ namespace vcpkg::Commands::Build std::ofstream(binary_control_file) << bpgh; } - void build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir) + BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir) { Checks::check_exit(spec.name() == source_paragraph.name, "inconsistent arguments to build_internal()"); const triplet& target_triplet = spec.target_triplet(); @@ -58,15 +59,22 @@ namespace vcpkg::Commands::Build , spec.toString(), Info::version()); TrackProperty("error", "build failed"); TrackProperty("build_error", spec.toString()); - exit(EXIT_FAILURE); + return BuildResult::BUILD_FAILED; } - PostBuildLint::perform_all_checks(spec, paths); + const size_t error_count = PostBuildLint::perform_all_checks(spec, paths); + + if (error_count != 0) + { + return BuildResult::POST_BUILD_CHECKS_FAILED; + } create_binary_control_file(paths, source_paragraph, target_triplet); // const fs::path port_buildtrees_dir = paths.buildtrees / spec.name; // delete_directory(port_buildtrees_dir); + + return BuildResult::SUCCESS; } void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) @@ -86,7 +94,11 @@ namespace vcpkg::Commands::Build 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()) { - PostBuildLint::perform_all_checks(spec, paths); + const size_t error_count = PostBuildLint::perform_all_checks(spec, paths); + if (error_count > 0) + { + exit(EXIT_FAILURE); + } exit(EXIT_SUCCESS); } @@ -125,7 +137,12 @@ namespace vcpkg::Commands::Build } Environment::ensure_utilities_on_path(paths); - build_package(spgh, spec, paths, paths.port_dir(spec)); + const BuildResult result = build_package(spgh, spec, paths, paths.port_dir(spec)); + if (result != BuildResult::SUCCESS) + { + exit(EXIT_FAILURE); + } + exit(EXIT_SUCCESS); } } |
