feat(platform): build on native Windows hosts
VoidBuildSystem CI / 1 · Requirements (push) Successful in 6s
VoidBuildSystem CI / 2C · Windows native build (debug) (push) Failing after 1m32s
VoidBuildSystem CI / 2C · Windows native build (sanitizers) (push) Failing after 18s
VoidBuildSystem CI / 2C · Windows native build (relwithdebinfo) (push) Failing after 3m4s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 6m20s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 6m32s
VoidBuildSystem CI / 3C · Windows native test (debug) (push) Failing after 1m45s
VoidBuildSystem CI / 2B · Windows Wine build (sanitizers) (push) Successful in 6m55s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 6m59s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 6m59s
VoidBuildSystem CI / 3C · Windows native test (sanitizers) (push) Failing after 15s
VoidBuildSystem CI / 3C · Windows native test (relwithdebinfo) (push) Failing after 1m47s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 2m4s
VoidBuildSystem CI / 4B · Windows package (debug) (push) Successful in 1m6s
VoidBuildSystem CI / 4B · Windows package (sanitizers) (push) Successful in 12s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 4m2s
VoidBuildSystem CI / 4B · Windows package (relwithdebinfo) (push) Successful in 1m44s
VoidBuildSystem CI / 3B · Windows Wine test (sanitizers) (push) Successful in 3m16s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 3m21s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Failing after 6m45s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Failing after 6m54s
VoidBuildSystem CI / 4A · Linux package (debug) (push) Skipped
VoidBuildSystem CI / 4A · Linux package (relwithdebinfo) (push) Skipped
VoidBuildSystem CI / 4A · Linux package (sanitizers) (push) Skipped
VoidBuildSystem CI / 5 · Release (push) Skipped
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 3m42s
VoidBuildSystem CI / 1 · Requirements (push) Successful in 6s
VoidBuildSystem CI / 2C · Windows native build (debug) (push) Failing after 1m32s
VoidBuildSystem CI / 2C · Windows native build (sanitizers) (push) Failing after 18s
VoidBuildSystem CI / 2C · Windows native build (relwithdebinfo) (push) Failing after 3m4s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 6m20s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 6m32s
VoidBuildSystem CI / 3C · Windows native test (debug) (push) Failing after 1m45s
VoidBuildSystem CI / 2B · Windows Wine build (sanitizers) (push) Successful in 6m55s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 6m59s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 6m59s
VoidBuildSystem CI / 3C · Windows native test (sanitizers) (push) Failing after 15s
VoidBuildSystem CI / 3C · Windows native test (relwithdebinfo) (push) Failing after 1m47s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 2m4s
VoidBuildSystem CI / 4B · Windows package (debug) (push) Successful in 1m6s
VoidBuildSystem CI / 4B · Windows package (sanitizers) (push) Successful in 12s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 4m2s
VoidBuildSystem CI / 4B · Windows package (relwithdebinfo) (push) Successful in 1m44s
VoidBuildSystem CI / 3B · Windows Wine test (sanitizers) (push) Successful in 3m16s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 3m21s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Failing after 6m45s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Failing after 6m54s
VoidBuildSystem CI / 4A · Linux package (debug) (push) Skipped
VoidBuildSystem CI / 4A · Linux package (relwithdebinfo) (push) Skipped
VoidBuildSystem CI / 4A · Linux package (sanitizers) (push) Skipped
VoidBuildSystem CI / 5 · Release (push) Skipped
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 3m42s
Bump VoidLibrary to 482a3ea (Windows target support: qualified Configuration/Crypto/System/Archive, Windows DirectoryWatcher, TempDir/TempFile, process pipes) and port VBS's own host backends: - Toolchain: Windows/macOS host names and architectures without uname. - Platform FileOps: Win32 stat metadata, CreateFileW+LockFileEx file locks (Void FileLock is POSIX-only, Void/Library#66), no-op directory fsync, GetModuleFileNameW executable path, mtime via std::filesystem, and a file-copy fallback for the compdb alias. - ProcessSupervisor: Windows PATH/PATHEXT resolution and no POSIX waitpid reaping (job objects own descendants). - Snapshot: directory listing through std::filesystem on Windows. - Remote cache/registry client/CDash: curl or Winsock-based HTTP on Windows (Void::Net is not qualified there yet). - Daemon: explicit unsupported errors on Windows (named-pipe transport is Track C3); the registry service stays POSIX-only and is excluded from the Windows build. - StateStore/Sbom/Main/Graph: portable stat, time and path handling. Verified: MinGW-w64 GCC 16.2 builds vbs, vbs_describe, vbs_benchmarks and the sdk/core/v1/selfhost test executables; vbs runs under Wine and the SDK suite passes 17/17. The Linux suite stays green (8/8).
This commit is contained in:
1 parent
8768720e54
commit
e333bbe84b
23 files changed
+715
-127
No files matched your search
@@ -18,6 +18,10 @@
|
||||
#include <unistd.h>
|
||||
#include <utility>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
namespace Void::Build::State {
|
||||
namespace {
|
||||
|
||||
@@ -39,10 +43,39 @@ bool pid_is_alive(pid_t pid) noexcept {
|
||||
if (pid <= 0) {
|
||||
return false;
|
||||
}
|
||||
#if defined(_WIN32)
|
||||
const HANDLE handle =
|
||||
::OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, static_cast<DWORD>(pid));
|
||||
if (handle == nullptr) {
|
||||
return false;
|
||||
}
|
||||
DWORD exit_code = 0;
|
||||
const bool alive = ::GetExitCodeProcess(handle, &exit_code) != 0 && exit_code == STILL_ACTIVE;
|
||||
::CloseHandle(handle);
|
||||
return alive;
|
||||
#else
|
||||
if (::kill(pid, 0) == 0) {
|
||||
return true;
|
||||
}
|
||||
return errno != ESRCH;
|
||||
#endif
|
||||
}
|
||||
|
||||
void apply_posix_mode(const std::filesystem::path &p, unsigned mode) noexcept {
|
||||
#if defined(_WIN32)
|
||||
using Perms = std::filesystem::perms;
|
||||
Perms perms = Perms::owner_read | Perms::group_read | Perms::others_read;
|
||||
if ((mode & 0200u) != 0) {
|
||||
perms |= Perms::owner_write;
|
||||
}
|
||||
if ((mode & 0100u) != 0) {
|
||||
perms |= Perms::owner_exec;
|
||||
}
|
||||
std::error_code ec;
|
||||
std::filesystem::permissions(p, perms, std::filesystem::perm_options::replace, ec);
|
||||
#else
|
||||
(void)::chmod(p.c_str(), static_cast<mode_t>(mode));
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string serialize_action(const ActionSuccessRecord &rec) {
|
||||
@@ -155,6 +188,16 @@ struct StateStore::CacheState {
|
||||
};
|
||||
|
||||
static std::optional<StatFingerprint> stat_file(const std::filesystem::path &p) noexcept {
|
||||
#if defined(_WIN32)
|
||||
struct _stat64 st{};
|
||||
if (::_wstat64(p.c_str(), &st) != 0) {
|
||||
return std::nullopt;
|
||||
}
|
||||
return StatFingerprint{static_cast<std::uint64_t>(st.st_dev),
|
||||
static_cast<std::uint64_t>(st.st_ino),
|
||||
static_cast<std::uint64_t>(st.st_size),
|
||||
static_cast<std::int64_t>(st.st_mtime), 0};
|
||||
#else
|
||||
struct stat st{};
|
||||
if (::stat(p.c_str(), &st) != 0) {
|
||||
return std::nullopt;
|
||||
@@ -163,6 +206,7 @@ struct StateStore::CacheState {
|
||||
static_cast<std::uint64_t>(st.st_dev), static_cast<std::uint64_t>(st.st_ino),
|
||||
static_cast<std::uint64_t>(st.st_size), static_cast<std::int64_t>(st.st_mtim.tv_sec),
|
||||
static_cast<std::int64_t>(st.st_mtim.tv_nsec)};
|
||||
#endif
|
||||
}
|
||||
|
||||
std::mutex mutex;
|
||||
@@ -703,12 +747,12 @@ StateStore::store_blob_from_file(const std::filesystem::path &file_path) {
|
||||
if (existing_ok && *existing_ok) {
|
||||
std::filesystem::remove(stage_path, ec);
|
||||
} else {
|
||||
(void)::chmod(final_path.c_str(), 0644);
|
||||
apply_posix_mode(final_path, 0644);
|
||||
std::filesystem::rename(stage_path, final_path, ec);
|
||||
(void)::chmod(final_path.c_str(), 0444);
|
||||
apply_posix_mode(final_path, 0444);
|
||||
}
|
||||
} else {
|
||||
(void)::chmod(stage_path.c_str(), 0444);
|
||||
apply_posix_mode(stage_path, 0444);
|
||||
std::filesystem::rename(stage_path, final_path, ec);
|
||||
if (ec) {
|
||||
std::filesystem::remove(stage_path, ec);
|
||||
@@ -848,7 +892,7 @@ StateStore::ensure_remote_blob(std::string_view sha256) {
|
||||
if (!wrote) {
|
||||
return std::unexpected{wrote.error()};
|
||||
}
|
||||
(void)::chmod(stage_path.c_str(), 0444);
|
||||
apply_posix_mode(stage_path, 0444);
|
||||
std::filesystem::rename(stage_path, final_path, ec);
|
||||
if (ec) {
|
||||
std::filesystem::remove(stage_path, ec);
|
||||
@@ -1141,7 +1185,7 @@ Void::Result::Result<GcStats, Void::Result::Error> StateStore::gc(std::uint64_t
|
||||
const std::string sha = entry.path().filename().string();
|
||||
const auto fsize = entry.file_size(ec);
|
||||
if (!pinned.contains(sha)) {
|
||||
(void)::chmod(entry.path().c_str(), 0644);
|
||||
apply_posix_mode(entry.path(), 0644);
|
||||
std::filesystem::remove(entry.path(), ec);
|
||||
if (!ec) {
|
||||
++stats.removed_blobs;
|
||||
|
||||
Reference in new issue
Block a user