Implement VoidBuildSystem v1 (Plans 01-19) with VoidLibrary integration
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 3s

This commit is contained in:
faumaray committed 2026-11-26 20:45:54 +03:00
1 parent 3cac890ce9
commit ab64147f9d
114 files changed
+23777 -1392

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
#pragma once
#include <cstddef>
#include <cstdint>
#include <string>
#include <string_view>
#include <vector>
namespace Void::Build::Util {
// Strict UTF-8 validation per RFC 8259 / Unicode scalar value rules (VL-008).
[[nodiscard]] bool is_valid_utf8(std::string_view text) noexcept;
void require_valid_utf8(std::string_view text);
// Emits a valid JSON string literal, throwing std::invalid_argument on malformed UTF-8.
[[nodiscard]] std::string json_quote(std::string_view text);
template <typename Range, typename Serialize>
[[nodiscard]] std::string json_array(const Range &range, Serialize serialize) {
std::string output{"["};
bool first = true;
for (const auto &item : range) {
if (!first) {
output += ',';
}
first = false;
output += serialize(item);
}
output += ']';
return output;
}
} // namespace Void::Build::Util
+53
View File
@@ -0,0 +1,53 @@
#pragma once
#include <Void/Functional/Error.hpp>
#include <Void/Functional/Result.hpp>
#include <array>
#include <cstddef>
#include <cstdint>
#include <filesystem>
#include <span>
#include <string>
#include <string_view>
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).
class Sha256Hasher {
public:
Sha256Hasher() noexcept;
void update(std::span<const std::byte> data) noexcept;
void update(std::span<const std::uint8_t> data) noexcept;
void update(std::string_view text) noexcept;
void update_length_prefixed(std::string_view text) noexcept;
void update_u64(std::uint64_t value) noexcept;
[[nodiscard]] Sha256Digest finalize() noexcept;
[[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};
bool finalized_{false};
};
[[nodiscard]] std::string to_hex(const Sha256Digest &digest);
[[nodiscard]] Sha256Digest sha256_bytes(std::span<const std::byte> data) noexcept;
[[nodiscard]] std::string sha256_hex(std::string_view text);
[[nodiscard]] std::string sha256_hex(std::span<const std::byte> data);
[[nodiscard]] Void::Result::Result<std::string, Void::Result::Error>
sha256_file_hex(const std::filesystem::path &path);
// Constant-time equality for hex digests / authentication tokens.
[[nodiscard]] bool constant_time_equal(std::string_view a, std::string_view b) noexcept;
} // namespace Void::Build::Util