feat: adopt VoidLibrary VL-001..VL-013, self-building build.cpp, live logs, and generated CLI help
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 10s

This commit is contained in:
faumaray committed 2026-11-27 01:43:06 +03:00
1 parent ab64147f9d
commit 363fb8200e
33 files changed
+1754 -3155

No files matched your search

@@ -35,8 +35,10 @@ struct ExecutionEvent {
Kind kind{Kind::ActionStarted};
std::string action_id;
std::string target_name;
std::string label;
std::size_t completed{0};
std::size_t total{0};
std::chrono::milliseconds elapsed{0};
std::string message;
};
+12 -11
View File
@@ -2,6 +2,7 @@
#include <Void/Functional/Error.hpp>
#include <Void/Functional/Result.hpp>
#include <Void/System/Path.hpp>
#include <cstdint>
#include <filesystem>
@@ -15,27 +16,27 @@ namespace Void::Build::Platform {
enum class LockMode { Shared, Exclusive };
// RAII advisory flock lock (VL-010).
// RAII advisory flock lock delegating directly to Void::FileSystem::FileLock (VL-010).
class FileLock {
public:
FileLock() noexcept = default;
~FileLock() noexcept;
~FileLock() noexcept = default;
FileLock(const FileLock &) = delete;
FileLock &operator=(const FileLock &) = delete;
FileLock(FileLock &&other) noexcept;
FileLock &operator=(FileLock &&other) noexcept;
FileLock(FileLock &&other) noexcept = default;
FileLock &operator=(FileLock &&other) noexcept = default;
[[nodiscard]] static Void::Result::Result<FileLock, Void::Result::Error>
acquire(const std::filesystem::path &lock_path, LockMode mode = LockMode::Exclusive,
bool non_blocking = false);
[[nodiscard]] bool valid() const noexcept { return fd_ >= 0; }
void release() noexcept;
[[nodiscard]] bool valid() const noexcept { return lock_.locked(); }
void release() noexcept { lock_.unlock(); }
private:
explicit FileLock(int fd) noexcept : fd_{fd} {}
int fd_{-1};
explicit FileLock(Void::FileSystem::FileLock lock) noexcept : lock_{std::move(lock)} {}
Void::FileSystem::FileLock lock_;
};
struct FileMetadata {
@@ -57,13 +58,13 @@ struct FileMetadata {
[[nodiscard]] Void::Result::Result<FileMetadata, Void::Result::Error>
stat_lstat(const std::filesystem::path &path);
// Private isolated file copy: tries Linux FICLONE reflink, falls back to byte copy.
// Private isolated file copy delegating to Void::FileSystem::reflink_copy_file (VL-010).
// NEVER creates hardlinks. Guarantees distinct inode and nlink == 1 on destination.
[[nodiscard]] Void::Result::Result<bool, Void::Result::Error>
copy_isolated(const std::filesystem::path &src, const std::filesystem::path &dst,
std::optional<std::uint32_t> mode_override = std::nullopt);
// Canonicalizes mtime/atime via utimensat(..., AT_SYMLINK_NOFOLLOW).
// Canonicalizes mtime/atime via Void::FileSystem::set_canonical_mtime (VL-010).
[[nodiscard]] Void::Result::Result<void, Void::Result::Error>
set_canonical_mtime(const std::filesystem::path &path, std::int64_t epoch_seconds);
@@ -75,7 +76,7 @@ atomic_write_file(const std::filesystem::path &path, std::string_view content,
atomic_write_bytes(const std::filesystem::path &path, std::span<const std::byte> bytes,
bool durable_sync = true, unsigned mode = 0644);
// Atomically replaces symlink at `link_path` pointing to `target` + parent fsync.
// Atomically replaces symlink via Void::FileSystem::atomic_symlink_swap (VL-010).
[[nodiscard]] Void::Result::Result<void, Void::Result::Error>
atomic_swap_symlink(const std::filesystem::path &link_path, const std::filesystem::path &target);
+6 -9
View File
@@ -1,5 +1,6 @@
#pragma once
#include <Void/Crypto/Crypto.hpp>
#include <Void/Functional/Error.hpp>
#include <Void/Functional/Result.hpp>
@@ -7,6 +8,7 @@
#include <cstddef>
#include <cstdint>
#include <filesystem>
#include <optional>
#include <span>
#include <string>
#include <string_view>
@@ -15,11 +17,10 @@ namespace Void::Build::Util {
using Sha256Digest = std::array<std::uint8_t, 32>;
// Streaming FIPS 180-4 SHA-256 hasher (VL-007: delegates to Void::Crypto when
// OpenSSL is available; provides zero-dependency built-in fallback otherwise).
// Streaming FIPS 180-4 SHA-256 hasher backed directly by Void::Crypto::Hasher (VL-007).
class Sha256Hasher {
public:
Sha256Hasher() noexcept;
Sha256Hasher();
void update(std::span<const std::byte> data) noexcept;
void update(std::span<const std::uint8_t> data) noexcept;
@@ -31,12 +32,8 @@ class Sha256Hasher {
[[nodiscard]] std::string finalize_hex() noexcept;
private:
void transform(const std::uint8_t block[64]) noexcept;
std::uint32_t state_[8];
std::uint64_t bit_count_{0};
std::uint8_t buffer_[64]{};
std::size_t buffer_len_{0};
std::optional<Void::Crypto::Hasher> hasher_;
Sha256Digest cached_digest_{};
bool finalized_{false};
};
+10 -15
View File
@@ -8,6 +8,7 @@
#include <Void/Build/State/StateStore.hpp>
#include <Void/Functional/Error.hpp>
#include <Void/Functional/Result.hpp>
#include <Void/System/DirectoryWatcher.hpp>
#include <chrono>
#include <cstddef>
@@ -27,18 +28,17 @@ struct WatchBatch {
bool rescan_required{false};
};
// Linux inotify recursive directory watcher (VL-003).
// Automatically excludes build/cache/VCS trees to prevent feedback loops, attaches watches
// to newly created subdirectories, and reports IN_Q_OVERFLOW as rescan_required.
// Linux inotify recursive directory watcher delegating directly to
// Void::FileSystem::DirectoryWatcher (VL-003).
class InotifyWatcher {
public:
InotifyWatcher() = default;
~InotifyWatcher() noexcept;
~InotifyWatcher() noexcept = default;
InotifyWatcher(const InotifyWatcher &) = delete;
InotifyWatcher &operator=(const InotifyWatcher &) = delete;
InotifyWatcher(InotifyWatcher &&other) noexcept;
InotifyWatcher &operator=(InotifyWatcher &&other) noexcept;
InotifyWatcher(InotifyWatcher &&other) noexcept = default;
InotifyWatcher &operator=(InotifyWatcher &&other) noexcept = default;
[[nodiscard]] static Void::Result::Result<InotifyWatcher, Void::Result::Error>
create(const std::filesystem::path &root_dir,
@@ -54,19 +54,14 @@ class InotifyWatcher {
[[nodiscard]] Void::Result::Result<void, Void::Result::Error> rescan_watches();
[[nodiscard]] std::size_t watched_directory_count() const noexcept {
return wd_to_path_.size();
return watcher_ ? watcher_->watch_count() : 0;
}
private:
explicit InotifyWatcher(int fd, std::filesystem::path root, std::vector<std::string> excluded);
void close_fd() noexcept;
Void::Result::Result<void, Void::Result::Error> watch_tree(const std::filesystem::path &dir);
bool is_excluded(const std::filesystem::path &rel) const;
explicit InotifyWatcher(Void::FileSystem::DirectoryWatcher watcher) noexcept
: watcher_{std::move(watcher)} {}
int fd_{-1};
std::filesystem::path root_;
std::vector<std::string> excluded_;
std::map<int, std::filesystem::path> wd_to_path_;
std::optional<Void::FileSystem::DirectoryWatcher> watcher_;
};
enum class WatchMode { FullBuild, MetadataOnly };