diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 471485e311..5c643d017e 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -3,6 +3,7 @@ #include "vcpkg_cmd_arguments.h" #include "vcpkg_paths.h" #include "StatusParagraphs.h" +#include namespace vcpkg::Commands { @@ -14,13 +15,15 @@ namespace vcpkg::Commands { enum class BuildResult { - BUILD_NOT_STARTED = 0, + NULLVALUE = 0, SUCCEEDED, BUILD_FAILED, POST_BUILD_CHECKS_FAILED, CASCADED_DUE_TO_MISSING_DEPENDENCIES }; + static constexpr std::array BuildResult_values = { BuildResult::SUCCEEDED, BuildResult::BUILD_FAILED, BuildResult::POST_BUILD_CHECKS_FAILED, BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES }; + const std::string& to_string(const BuildResult build_result); std::string create_error_message(const BuildResult build_result, const package_spec& spec); std::string create_user_troubleshooting_message(const package_spec& spec); diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index 264f9c06ec..03a4b944bc 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 { @@ -78,7 +79,7 @@ namespace vcpkg::Commands::Build const std::string& to_string(const BuildResult build_result) { - static const std::string BUILD_NOT_STARTED_STRING = "BUILD_NOT_STARTED"; + static const std::string NULLVALUE_STRING = Enums::nullvalue_toString("vcpkg::Commands::Build::BuildResult"); static const std::string SUCCEEDED_STRING = "SUCCEEDED"; static const std::string BUILD_FAILED_STRING = "BUILD_FAILED"; static const std::string POST_BUILD_CHECKS_FAILED_STRING = "POST_BUILD_CHECKS_FAILED"; @@ -86,7 +87,7 @@ namespace vcpkg::Commands::Build switch (build_result) { - case BuildResult::BUILD_NOT_STARTED: return BUILD_NOT_STARTED_STRING; + case BuildResult::NULLVALUE: return NULLVALUE_STRING; case BuildResult::SUCCEEDED: return SUCCEEDED_STRING; case BuildResult::BUILD_FAILED: return BUILD_FAILED_STRING; case BuildResult::POST_BUILD_CHECKS_FAILED: return POST_BUILD_CHECKS_FAILED_STRING;