diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2020-03-18 11:19:25 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2020-03-18 11:19:25 -0700 |
| commit | ebf8213945060c646e8074bcdf2b9463bcd44216 (patch) | |
| tree | 6470e30f4627e254b9880b86215fdcf0c9087a14 | |
| parent | 6b55c62144b120f3c5fc0d3cd8163f309241a18a (diff) | |
| download | vcpkg-ebf8213945060c646e8074bcdf2b9463bcd44216.tar.gz vcpkg-ebf8213945060c646e8074bcdf2b9463bcd44216.zip | |
[vcpkg] Use enum class for RestoreResult
| -rw-r--r-- | toolsrc/include/vcpkg/binarycaching.h | 8 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/binarycaching.cpp | 14 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/build.cpp | 10 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.ci.cpp | 4 |
4 files changed, 20 insertions, 16 deletions
diff --git a/toolsrc/include/vcpkg/binarycaching.h b/toolsrc/include/vcpkg/binarycaching.h index 60b2eeab7..199b01acc 100644 --- a/toolsrc/include/vcpkg/binarycaching.h +++ b/toolsrc/include/vcpkg/binarycaching.h @@ -16,11 +16,11 @@ namespace vcpkg::Build namespace vcpkg
{
- enum RestoreResult
+ enum class RestoreResult
{
- MISSING,
- SUCCESS,
- BUILD_FAILED,
+ missing,
+ success,
+ build_failed,
};
struct IBinaryProvider
diff --git a/toolsrc/src/vcpkg/binarycaching.cpp b/toolsrc/src/vcpkg/binarycaching.cpp index 659681c9e..af4a879ca 100644 --- a/toolsrc/src/vcpkg/binarycaching.cpp +++ b/toolsrc/src/vcpkg/binarycaching.cpp @@ -84,7 +84,7 @@ namespace System::print2("Failed to decompress archive package\n");
if (action.build_options.purge_decompress_failure == Build::PurgeDecompressFailure::NO)
{
- return RestoreResult::BUILD_FAILED;
+ return RestoreResult::build_failed;
}
else
{
@@ -94,7 +94,7 @@ namespace }
else
{
- return RestoreResult::SUCCESS;
+ return RestoreResult::success;
}
}
@@ -103,7 +103,7 @@ namespace if (action.build_options.fail_on_tombstone == Build::FailOnTombstone::YES)
{
System::print2("Found failure tombstone: ", archive_tombstone_path.u8string(), "\n");
- return RestoreResult::BUILD_FAILED;
+ return RestoreResult::build_failed;
}
else
{
@@ -116,7 +116,7 @@ namespace System::printf("Could not locate cached archive: %s\n", archive_path.u8string());
}
- return RestoreResult::MISSING;
+ return RestoreResult::missing;
}
void push_success(const VcpkgPaths& paths, const Dependencies::InstallPlanAction& action) override
{
@@ -200,7 +200,7 @@ namespace if (fs.exists(archive_path))
{
- return RestoreResult::SUCCESS;
+ return RestoreResult::success;
}
if (purge_tombstones)
@@ -211,11 +211,11 @@ namespace {
if (action.build_options.fail_on_tombstone == Build::FailOnTombstone::YES)
{
- return RestoreResult::BUILD_FAILED;
+ return RestoreResult::build_failed;
}
}
- return RestoreResult::MISSING;
+ return RestoreResult::missing;
}
};
}
diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index e6a81607d..81997e79c 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -527,7 +527,11 @@ namespace vcpkg::Build {
std::error_code err;
fs.create_directory(buildpath, err);
- Checks::check_exit(VCPKG_LINE_INFO, !err.value(), "Failed to create directory '%s', code: %d", buildpath.u8string(), err.value());
+ Checks::check_exit(VCPKG_LINE_INFO,
+ !err.value(),
+ "Failed to create directory '%s', code: %d",
+ buildpath.u8string(),
+ err.value());
}
auto stdoutlog = buildpath / ("stdout-" + action.spec.triplet().canonical_name() + ".log");
std::ofstream out_file(stdoutlog.native().c_str(), std::ios::out | std::ios::binary | std::ios::trunc);
@@ -865,9 +869,9 @@ namespace vcpkg::Build if (binary_caching_enabled)
{
auto restore = binaries_provider->try_restore(paths, action);
- if (restore == RestoreResult::BUILD_FAILED)
+ if (restore == RestoreResult::build_failed)
return BuildResult::BUILD_FAILED;
- else if (restore == RestoreResult::SUCCESS)
+ else if (restore == RestoreResult::success)
{
auto maybe_bcf = Paragraphs::try_load_cached_package(paths, spec);
auto bcf = std::make_unique<BinaryControlFile>(std::move(maybe_bcf).value_or_exit(VCPKG_LINE_INFO));
diff --git a/toolsrc/src/vcpkg/commands.ci.cpp b/toolsrc/src/vcpkg/commands.ci.cpp index 9cf3026cb..09bee8ddc 100644 --- a/toolsrc/src/vcpkg/commands.ci.cpp +++ b/toolsrc/src/vcpkg/commands.ci.cpp @@ -348,12 +348,12 @@ namespace vcpkg::Commands::CI ret->known.emplace(p->spec, BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES); will_fail.emplace(p->spec); } - else if (precheck_result == RestoreResult::SUCCESS) + else if (precheck_result == RestoreResult::success) { state = "pass"; ret->known.emplace(p->spec, BuildResult::SUCCEEDED); } - else if (precheck_result == RestoreResult::BUILD_FAILED) + else if (precheck_result == RestoreResult::build_failed) { state = "fail"; ret->known.emplace(p->spec, BuildResult::BUILD_FAILED); |
