summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_api/remote/bazel/bazel_api.cpp
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2025-03-03 11:44:16 +0100
committerMaksim Denisov <denisov.maksim@huawei.com>2025-03-24 09:33:46 +0100
commit4adc474d49d14472972a82f4a256c0346f722ce6 (patch)
treedbeae9343c736c7f5faffc4b723af0dd95384928 /src/buildtool/execution_api/remote/bazel/bazel_api.cpp
parentfedaa03fe9f90c84f5dbc966872aeefe8d72772c (diff)
downloadjustbuild-4adc474d49d14472972a82f4a256c0346f722ce6.tar.gz
BazelApi: Use file sources of ArtifactBlobs.
Diffstat (limited to 'src/buildtool/execution_api/remote/bazel/bazel_api.cpp')
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_api.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp
index 08fc8e99..33a60596 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp
@@ -239,18 +239,30 @@ auto BazelApi::CreateAction(
for (std::size_t pos = 0; pos < blobs.size(); ++pos) {
auto gpos = artifact_pos[count + pos];
auto const& type = artifacts_info[gpos].type;
+ auto const& dst = output_paths[gpos];
bool written = false;
- if (auto const content = blobs[pos].ReadContent()) {
+ if (auto const path = blobs[pos].GetFilePath()) {
+ if (FileSystemManager::CreateDirectory(dst.parent_path()) and
+ FileSystemManager::RemoveFile(dst)) {
+ written =
+ IsSymlinkObject(type)
+ ? FileSystemManager::CopySymlinkAs<
+ /*kSetEpochTime=*/true>(*path, dst)
+ : FileSystemManager::CreateFileHardlinkAs<
+ /*kSetEpochTime=*/true>(*path, dst, type);
+ }
+ }
+ else if (auto const content = blobs[pos].ReadContent()) {
written = FileSystemManager::WriteFileAs</*kSetEpochTime=*/true,
/*kSetWritable=*/true>(
- *content, output_paths[gpos], type);
+ *content, dst, type);
}
if (not written) {
Logger::Log(LogLevel::Warning,
"staging to output path {} failed.",
- output_paths[gpos].string());
+ dst.string());
return false;
}
}