mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-06-07 15:24:46 +08:00
[vcpkg] Use enum class for RestoreResult
This commit is contained in:
parent
6b55c62144
commit
ebf8213945
@ -16,11 +16,11 @@ namespace vcpkg::Build
|
|||||||
|
|
||||||
namespace vcpkg
|
namespace vcpkg
|
||||||
{
|
{
|
||||||
enum RestoreResult
|
enum class RestoreResult
|
||||||
{
|
{
|
||||||
MISSING,
|
missing,
|
||||||
SUCCESS,
|
success,
|
||||||
BUILD_FAILED,
|
build_failed,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IBinaryProvider
|
struct IBinaryProvider
|
||||||
|
@ -84,7 +84,7 @@ namespace
|
|||||||
System::print2("Failed to decompress archive package\n");
|
System::print2("Failed to decompress archive package\n");
|
||||||
if (action.build_options.purge_decompress_failure == Build::PurgeDecompressFailure::NO)
|
if (action.build_options.purge_decompress_failure == Build::PurgeDecompressFailure::NO)
|
||||||
{
|
{
|
||||||
return RestoreResult::BUILD_FAILED;
|
return RestoreResult::build_failed;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -94,7 +94,7 @@ namespace
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return RestoreResult::SUCCESS;
|
return RestoreResult::success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ namespace
|
|||||||
if (action.build_options.fail_on_tombstone == Build::FailOnTombstone::YES)
|
if (action.build_options.fail_on_tombstone == Build::FailOnTombstone::YES)
|
||||||
{
|
{
|
||||||
System::print2("Found failure tombstone: ", archive_tombstone_path.u8string(), "\n");
|
System::print2("Found failure tombstone: ", archive_tombstone_path.u8string(), "\n");
|
||||||
return RestoreResult::BUILD_FAILED;
|
return RestoreResult::build_failed;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -116,7 +116,7 @@ namespace
|
|||||||
System::printf("Could not locate cached archive: %s\n", archive_path.u8string());
|
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
|
void push_success(const VcpkgPaths& paths, const Dependencies::InstallPlanAction& action) override
|
||||||
{
|
{
|
||||||
@ -200,7 +200,7 @@ namespace
|
|||||||
|
|
||||||
if (fs.exists(archive_path))
|
if (fs.exists(archive_path))
|
||||||
{
|
{
|
||||||
return RestoreResult::SUCCESS;
|
return RestoreResult::success;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (purge_tombstones)
|
if (purge_tombstones)
|
||||||
@ -211,11 +211,11 @@ namespace
|
|||||||
{
|
{
|
||||||
if (action.build_options.fail_on_tombstone == Build::FailOnTombstone::YES)
|
if (action.build_options.fail_on_tombstone == Build::FailOnTombstone::YES)
|
||||||
{
|
{
|
||||||
return RestoreResult::BUILD_FAILED;
|
return RestoreResult::build_failed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return RestoreResult::MISSING;
|
return RestoreResult::missing;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -527,7 +527,11 @@ namespace vcpkg::Build
|
|||||||
{
|
{
|
||||||
std::error_code err;
|
std::error_code err;
|
||||||
fs.create_directory(buildpath, 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");
|
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);
|
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)
|
if (binary_caching_enabled)
|
||||||
{
|
{
|
||||||
auto restore = binaries_provider->try_restore(paths, action);
|
auto restore = binaries_provider->try_restore(paths, action);
|
||||||
if (restore == RestoreResult::BUILD_FAILED)
|
if (restore == RestoreResult::build_failed)
|
||||||
return BuildResult::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 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));
|
auto bcf = std::make_unique<BinaryControlFile>(std::move(maybe_bcf).value_or_exit(VCPKG_LINE_INFO));
|
||||||
|
@ -348,12 +348,12 @@ namespace vcpkg::Commands::CI
|
|||||||
ret->known.emplace(p->spec, BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES);
|
ret->known.emplace(p->spec, BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES);
|
||||||
will_fail.emplace(p->spec);
|
will_fail.emplace(p->spec);
|
||||||
}
|
}
|
||||||
else if (precheck_result == RestoreResult::SUCCESS)
|
else if (precheck_result == RestoreResult::success)
|
||||||
{
|
{
|
||||||
state = "pass";
|
state = "pass";
|
||||||
ret->known.emplace(p->spec, BuildResult::SUCCEEDED);
|
ret->known.emplace(p->spec, BuildResult::SUCCEEDED);
|
||||||
}
|
}
|
||||||
else if (precheck_result == RestoreResult::BUILD_FAILED)
|
else if (precheck_result == RestoreResult::build_failed)
|
||||||
{
|
{
|
||||||
state = "fail";
|
state = "fail";
|
||||||
ret->known.emplace(p->spec, BuildResult::BUILD_FAILED);
|
ret->known.emplace(p->spec, BuildResult::BUILD_FAILED);
|
||||||
|
Loading…
Reference in New Issue
Block a user