feat: complete Track A zero-CMake self-hosting, full VOID_TEST migration, and bit-identical Stage 2/3 bootstrap
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 2s
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 2s
This commit is contained in:
1 parent
fe0d1a6483
commit
5e1916dc5c
23 files changed
+945
-141
No files matched your search
@@ -120,6 +120,5 @@ endif()
|
||||
|
||||
if(VBS_BUILD_TESTS)
|
||||
enable_testing()
|
||||
include("${VBS_VOID_TESTING_SCRIPT}")
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
@@ -6,16 +6,16 @@ profile definitions live in ordinary `build.cpp`, `build.profiles.cpp`, and
|
||||
`build-support/**/*.cpp`/`.hpp` files; declarative package manifests also support
|
||||
`vbs.deps.toml` normalized to the exact same dependency model.
|
||||
|
||||
**Implemented scope (Plans 01–19):**
|
||||
**Implemented scope (Plans 01–19, Plan 20 Slices 1 & 2A, Track A Self-Hosting):**
|
||||
- **Declaration SDK (`Void::Build`, `<Void/Build.hpp>`)**: `VoidBuild_Sdk` / `Void::BuildSdk` with version-1 deterministic UTF-8 JSON schema, profile inheritance and cycle detection, all seven `TargetKind`s, scoped options/defines/links, modern C++ flags, install rules, and symbolic TOML manifest references.
|
||||
- **Native Core Engine (`VoidBuild_Core` / `Void::BuildCore`)**: out-of-process host descriptor compilation, graph lowering and transitive visibility resolution, GCC 16 & Clang 23 toolchain discovery/capability probing, content-verified immutable snapshots (`FICLONE`/isolated copies, lookup guards), transactional CAS store (`StateStore`), bounded-parallel DAG execution (`ProcessSupervisor` with `-pgid` `SIGTERM -> SIGKILL` cleanup), and live `Void::Log` progress logging (`--verbose`/`-v`, `--quiet`/`-q`).
|
||||
- **Self-Building & Self-Testing `build.cpp`**: Root [build.cpp](build.cpp) declares the full `VoidBuildSystem` (`VoidBuildSdk`, `VoidBuildCore`, `GenerateBootstrapConfig`, `vbs`, `VoidBuildRegistry`, `vbs-registry`, and `vbs_self_smoke`) so both `vbs build` and `vbs test` compile, link, and test `VoidBuildSystem` itself end-to-end.
|
||||
- **Native Core Engine (`VoidBuild_Core` / `Void::BuildCore`)**: out-of-process host descriptor compilation, graph lowering and transitive visibility resolution, GCC 16 & Clang 23 toolchain discovery/capability probing, content-verified immutable snapshots (`FICLONE`/isolated copies, lookup guards), deterministic path prefix mapping + `-frandom-seed`, transactional CAS store (`StateStore`), bounded-parallel DAG execution (`ProcessSupervisor` with `-pgid` `SIGTERM -> SIGKILL` cleanup), and live `Void::Log` progress logging (`--verbose`/`-v`, `--quiet`/`-q`).
|
||||
- **Zero-CMake Self-Building & Self-Testing `build.cpp` (Track A)**: Root [build.cpp](build.cpp) builds `VoidLibrary` via `.native_builder(...)` (first-class `builder == "native"` in [Provider.cpp](src/Provider/Provider.cpp), zero CMake invocation) and declares all 13 targets (`VoidBuildSdk`, `VoidBuildCore`, `GenerateBootstrapConfig`, `vbs`, `VoidBuildRegistry`, `vbs-registry`, `vbs_self_smoke`, `vbs_benchmarks`, and all 5 `Void::Testing` `VOID_TEST` suites `vbs_sdk_tests`, `vbs_core_tests`, `vbs_v1_tests`, `vbs_registry_tests`, `vbs_selfhost_tests`). Stage 2 and Stage 3 `vbs` builds match bit-for-bit by SHA-256 across distinct build directories with `cmake` trapped on `PATH`.
|
||||
- **Plan 20 Slices 1 & 2A — Bounded Native CMake & Meson Graph Translation**: [Translator.hpp](include/Void/Build/Provider/Translator.hpp) / [Translator.cpp](src/Provider/Translator.cpp) audits configured CMake File API `codemodel-v2` and Meson `meson-info/intro-targets.json` + `build.ninja` graphs, executes supported single-config C++ targets natively through VBS's toolchain driver, CAS cache, and depfile tracker (zero `cmake --build` / `meson compile`), exposes unified `resolve_foreign_with_translation` and opt-in `vbs build|test --native-foreign`, and explicitly diagnoses or falls back on unsupported constructs (`UTILITY`/`custom_target`, generated sources, non-C++ languages, foreign `CXX_MODULES`, precompiled headers, untracked link fragments).
|
||||
- **Modern C++, Editor Metadata & Watchers**: Full graph-integrated P1689r5 named modules & module partitions (GCC `-fmodule-mapper` and Clang two-step `--precompile` `.pcm` -> `.o` + transitive `-fmodule-file=`), explicit `SourceKind::HeaderUnit` compilation, unity batches (excluding modules and per-file overrides), incompatible sanitizer rejection, per-profile `compile_commands.json` with monotonic selection tickets and user-file preservation, and Linux `inotify` build/metadata watching via `Void::FileSystem::DirectoryWatcher` (`MetadataOnly` never triggers builds or foreign configures).
|
||||
- **Native Package Manager, Foreign Providers, Bridge & Install**: `Void::Data::Toml` 1.0 parser/merger, PubGrub-style SemVer solver (`Void::Semver::parse_range`), context-aware CAS `vbs.lock`, live registry HTTP/1.1 client (`vbs publish`, `vbs deps resolve|update`, `vbs build --locked` against `vbs-registry`), deterministic PAX/USTAR `.tar` packaging & staged safe extraction (`Void::Archive`), CMake File API & Meson introspection providers (plus explicit-error Conan2 adapter), `cmake/bridge/VbsDeps.cmake`, and staged relocatable install/export/uninstall.
|
||||
- **Registry Service, Web Admin UI & Native Self-Hosting**: `vbs-registry` HTTP/1.1 service (`VoidBuild_Registry` / `Void::BuildRegistry`) with RBAC, salted password hashes, CSRF/HttpOnly session auth, immutable releases, backup/restore, XSS-safe DOM-only web UI (`registry/web/`), native `VoidLibrary` & full `VbsSelfHostRecipe` recipes (`recipes/VoidLibrary/`, `recipes/SelfHost/`) compiling the full Stage 1 `vbs` binary without CMake to build & test Stage 2 projects, and non-CMake `Void::Testing` registration generator (`vbs gen-tests`).
|
||||
- **Maximal VoidLibrary Reuse (`3e254055...`)**: Built directly on VoidLibrary `Configuration` (`Void::Argparse::Parser` with nested subcommands, `option_many`, and 100% auto-generated `--help` across `vbs`, `vbs-registry`, `vbs_describe`, and `vbs_benchmarks`; `Void::Configuration::get_env`/`get_env_or`), `Crypto` (`Void::Crypto::Hasher` zero-dep SHA-256), `Archive` (`Void::Archive::create` & `extract_staged`), `Data` (`Void::Data::Toml`, `Void::Json::Strict`), `System` (`Void::Process::spawn`/`communicate_blocking`/`enable_subreaper`, `Void::FileSystem::DirectoryWatcher`/`FileLock`/`reflink_copy_file`/`set_canonical_mtime`/`atomic_symlink_swap`, `Void::Process::SignalWatcher`), `Algorithms` (`Void::Algorithms::topological_order`), `Async` (`Void::Concurrency::ThreadPool`), `Unicode` (`Void::Unicode::validate_utf8`), `Text` (`Void::Str`, `Void::Encoding::Hex`, `Void::Encoding::Url`, `Void::Semver::parse_range`), `Log` (`Void::Log`), `Core` (`Void::Scope::on_exit`), `Time` (`Void::Time::Stopwatch`), and `Testing`.
|
||||
- **Remaining future design scope**: [Plan 20 Slices 2B/2C & 3](docs/roadmap/20-future-translation-platforms.md) and the [Post-v1 Expansion Roadmap](docs/roadmap/21-expansion-roadmap.md) (Track A zero-CMake self-host & full `VOID_TEST` suite, Track B C driver / custom-command / foreign module translation, Track C macOS/Windows/cross-compilation, Track D shared HTTP CAS & supply-chain provenance, Track E workspaces & daemon) remain planned architectural scope.
|
||||
- **Native Package Manager, Foreign Providers, Bridge & Install**: `Void::Data::Toml` 1.0 parser/merger, PubGrub-style SemVer solver (`Void::Semver::parse_range`), context-aware CAS `vbs.lock`, live registry HTTP/1.1 client (`vbs publish`, `vbs deps resolve|update`, `vbs build --locked` against `vbs-registry`), deterministic PAX/USTAR `.tar` packaging & staged safe extraction (`Void::Archive`), native/CMake/Meson providers (plus explicit-error Conan2 adapter), `cmake/bridge/VbsDeps.cmake`, and staged relocatable install/export/uninstall.
|
||||
- **Registry Service, Web Admin UI & Native Self-Hosting**: `vbs-registry` HTTP/1.1 service (`VoidBuild_Registry` / `Void::BuildRegistry`) with RBAC, salted password hashes, CSRF/HttpOnly session auth, immutable releases, backup/restore, XSS-safe DOM-only web UI (`registry/web/`), native `VoidLibrary` & full `VbsSelfHostRecipe` recipes (`recipes/VoidLibrary/`, `recipes/SelfHost/`) compiling the full Stage 1 `vbs` binary without CMake to build & test Stage 2/3 projects, and native `VOID_TEST` (`VL-009`) registration eliminating external CMake test scanning.
|
||||
- **Maximal VoidLibrary Reuse (`3e254055...`)**: Built directly on VoidLibrary `Configuration` (`Void::Argparse::Parser` with nested subcommands, `option_many`, and 100% auto-generated `--help` across `vbs`, `vbs-registry`, `vbs_describe`, and `vbs_benchmarks`; `Void::Configuration::get_env`/`get_env_or`), `Crypto` (`Void::Crypto::Hasher` zero-dep SHA-256), `Archive` (`Void::Archive::create` & `extract_staged`), `Data` (`Void::Data::Toml`, `Void::Json::Strict`), `System` (`Void::Process::spawn`/`communicate_blocking`/`enable_subreaper`, `Void::FileSystem::DirectoryWatcher`/`FileLock`/`reflink_copy_file`/`set_canonical_mtime`/`atomic_symlink_swap`, `Void::Process::SignalWatcher`), `Algorithms` (`Void::Algorithms::topological_order`), `Async` (`Void::Concurrency::ThreadPool`), `Unicode` (`Void::Unicode::validate_utf8`), `Text` (`Void::Str`, `Void::Encoding::Hex`, `Void::Encoding::Url`, `Void::Semver::parse_range`), `Log` (`Void::Log`), `Core` (`Void::Scope::on_exit`), `Time` (`Void::Time::Stopwatch`), and `Testing` (`VOID_TEST`).
|
||||
- **Remaining future design scope**: [Plan 20 Slices 2B/2C & 3](docs/roadmap/20-future-translation-platforms.md) and [Post-v1 Expansion Roadmap](docs/roadmap/21-expansion-roadmap.md) Tracks B–E2/E4 (Track B C driver / Ninja custom-command / foreign module translation, Track C macOS/Windows/cross-compilation, Track D shared HTTP CAS & supply-chain provenance, Track E2–E4 workspaces & daemon) remain planned architectural scope.
|
||||
|
||||
Start with the [roadmap plans](docs/roadmap/README.md), [expansion roadmap](docs/roadmap/21-expansion-roadmap.md),
|
||||
[architecture](docs/roadmap/ARCHITECTURE.md),
|
||||
@@ -55,12 +55,12 @@ dev cpp-gcc -c cmake -S . -B build/dev-local -G Ninja \
|
||||
|
||||
### Self-building and self-testing VoidBuildSystem with `vbs`
|
||||
|
||||
Once the bootstrap `vbs` binary is built, `VoidBuildSystem` builds and smoke-tests itself directly from root [build.cpp](build.cpp) with live progress logs (`-v`/`--verbose` for debug detail, `-q`/`--quiet` for warnings/errors only):
|
||||
Once the bootstrap `vbs` binary is built, `VoidBuildSystem` builds `VoidLibrary` and tests all binaries and full `VOID_TEST` suites directly from root [build.cpp](build.cpp) with zero CMake invocation and live progress logs (`-v`/`--verbose` for debug detail, `-q`/`--quiet` for warnings/errors only):
|
||||
|
||||
```sh
|
||||
dev cpp-gcc -c build/dev/bin/vbs test --build-dir build/vbs-self
|
||||
build/vbs-self/profiles/debug/out/bin/vbs --version
|
||||
build/vbs-self/profiles/debug/out/bin/vbs --help
|
||||
dev cpp-gcc -c build/dev/bin/vbs test --build-dir build/vbs-stage2 --profile release
|
||||
build/vbs-stage2/profiles/release/out/bin/vbs --version
|
||||
build/vbs-stage2/profiles/release/out/bin/vbs --help
|
||||
```
|
||||
|
||||
For offline/local VoidLibrary development during `vbs build`, set `VBS_VOID_SOURCE_DIR=/path/to/VoidLibrary`.
|
||||
|
||||
@@ -7,12 +7,9 @@ void build(Void::Build::Project &project) {
|
||||
library
|
||||
.git("https://git.faumaray.com/Void/VoidLibrary.git",
|
||||
Void::Build::Commit{"3e254055e081a104f08df68dde39711bc7813518"})
|
||||
.cmake(
|
||||
{{"VOID_ENABLED_MODULES", "Configuration;Text;Unicode;Async;Algorithms;Crypto;Archive"},
|
||||
{"VOID_ENABLE_TESTING", false},
|
||||
{"VOID_ENABLE_BENCHMARKS", false},
|
||||
{"VOID_FETCH_SQLITE3", false},
|
||||
{"BUILD_SHARED_LIBS", false}});
|
||||
.native_builder({{"VOID_ENABLED_MODULES",
|
||||
"Configuration;Text;Unicode;Async;Algorithms;Crypto;Archive;Testing"},
|
||||
{"BUILD_SHARED_LIBS", false}});
|
||||
|
||||
auto sdk = project.static_library("VoidBuildSdk");
|
||||
sdk.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
||||
@@ -82,7 +79,7 @@ void build(Void::Build::Project &project) {
|
||||
ctx.architecture +
|
||||
"\";\n"
|
||||
"inline constexpr std::string_view source_dir = \"$PROJECT_ROOT\";\n"
|
||||
"inline constexpr std::string_view binary_dir = \"$BUILD_DIR\";\n"
|
||||
"inline constexpr std::string_view binary_dir = \"\";\n"
|
||||
"inline constexpr std::string_view sdk_include_dir = \"$PROJECT_ROOT/include\";\n"
|
||||
"inline constexpr std::string_view sdk_source_dir = \"$PROJECT_ROOT/src\";\n"
|
||||
"}\n"
|
||||
@@ -122,4 +119,60 @@ void build(Void::Build::Project &project) {
|
||||
.sources({"tests/SelfBuildSmoke.cpp"})
|
||||
.link(core);
|
||||
BuildSupport::compiler_warnings(smoke_test, ctx);
|
||||
|
||||
auto benchmarks = project.executable("vbs_benchmarks");
|
||||
benchmarks.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
||||
.sources({"benchmarks/EngineBenchmarks.cpp"})
|
||||
.depends_on(bootstrap_cfg)
|
||||
.include_directory("$GEN/include", Void::Build::Visibility::Private)
|
||||
.link(core);
|
||||
BuildSupport::compiler_warnings(benchmarks, ctx);
|
||||
|
||||
auto sdk_tests = project.test("vbs_sdk_tests");
|
||||
sdk_tests.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
||||
.sources({"tests/SdkDeclarations.cpp", "tests/ExampleContexts.cpp", "build.cpp",
|
||||
"build.profiles.cpp", "build-support/Defaults.cpp"})
|
||||
.link(sdk)
|
||||
.link(library.target("Void::Testing"))
|
||||
.link(library.target("Void::Configuration"));
|
||||
BuildSupport::compiler_warnings(sdk_tests, ctx);
|
||||
|
||||
auto core_tests = project.test("vbs_core_tests");
|
||||
core_tests.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
||||
.sources({"tests/CoreEngineTests.cpp"})
|
||||
.depends_on(bootstrap_cfg)
|
||||
.include_directory("$GEN/include", Void::Build::Visibility::Private)
|
||||
.link(core)
|
||||
.link(library.target("Void::Testing"));
|
||||
BuildSupport::compiler_warnings(core_tests, ctx);
|
||||
|
||||
auto v1_tests = project.test("vbs_v1_tests");
|
||||
v1_tests.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
||||
.sources({"tests/FullV1Tests.cpp"})
|
||||
.depends_on(bootstrap_cfg)
|
||||
.depends_on(cli)
|
||||
.include_directory("$GEN/include", Void::Build::Visibility::Private)
|
||||
.link(core)
|
||||
.link(library.target("Void::Testing"));
|
||||
BuildSupport::compiler_warnings(v1_tests, ctx);
|
||||
|
||||
auto reg_tests = project.test("vbs_registry_tests");
|
||||
reg_tests.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
||||
.sources({"tests/RegistryTests.cpp"})
|
||||
.depends_on(bootstrap_cfg)
|
||||
.depends_on(cli)
|
||||
.include_directory("$GEN/include", Void::Build::Visibility::Private)
|
||||
.link(registry_lib)
|
||||
.link(library.target("Void::Testing"));
|
||||
BuildSupport::compiler_warnings(reg_tests, ctx);
|
||||
|
||||
auto selfhost_tests = project.test("vbs_selfhost_tests");
|
||||
selfhost_tests.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
||||
.sources({"tests/SelfHostTests.cpp"})
|
||||
.depends_on(bootstrap_cfg)
|
||||
.depends_on(cli)
|
||||
.include_directory("$GEN/include", Void::Build::Visibility::Private)
|
||||
.link(core)
|
||||
.link(library.target("Void::Testing"));
|
||||
BuildSupport::compiler_warnings(selfhost_tests, ctx);
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
Updated: 2026-11-27
|
||||
Branch: main
|
||||
Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1 & 2A (bounded native CMake & Meson translation) + Everyday DX CLI (`init`/`clean`/`doctor`/`graph`/`--native-foreign`) + Post-v1 Expansion Roadmap complete
|
||||
Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1 & 2A + Track A (zero-CMake `.native_builder()` self-host, full `VOID_TEST` migration, & bit-identical Stage 2 == Stage 3 bootstrap) complete
|
||||
|
||||
## Completed delivery waves
|
||||
|
||||
@@ -44,9 +44,14 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1 & 2A (bounded native CMake
|
||||
- Wired opt-in `--native-foreign` on `vbs build`/`vbs test` plus four everyday DX subcommands (`vbs init`, `vbs clean`, `vbs doctor`, `vbs graph --format dot|json`) into `Void::Argparse::Parser` in `src/Main.cpp`, verified end-to-end in `tests/FullV1Tests.cpp` and 32 CLI contracts in `tests/CliContracts.cmake`.
|
||||
- Authored comprehensive 5-track post-v1 expansion plan in [21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md) (Track A zero-CMake self-host & full `VOID_TEST` suite; Track B extended foreign translation; Track C macOS/Windows/cross-compilation; Track D shared HTTP CAS & supply-chain provenance; Track E workspaces, daemon & DX).
|
||||
|
||||
- **Wave 9 (Track A — Zero-CMake Self-Hosting, Full `VOID_TEST` Migration, & Bit-Identical Stage 2 == Stage 3 Bootstrap)**:
|
||||
- **Track A1 (`builder == "native"`)**: Extended `ProviderRequest` in `include/Void/Build/Provider/Provider.hpp` and implemented `run_native_provider` in `src/Provider/Provider.cpp` handling both pure `build.cpp` subprojects and built-in `VoidLibrary` recipe closure (`VOID_ENABLED_MODULES`), complete with `Log`/`Async`-complete `Testing` closure in `recipes/VoidLibrary/VoidLibraryRecipe.cpp`, reverse-DFS static archive link ordering, `Void::*` target aliasing, `MetadataOnly` cache isolation, and `/proc/self/exe`-first SDK/binary discovery in `src/Main.cpp`. Switched root `build.cpp`'s `VoidLibrary` dependency from `.cmake(...)` to `.native_builder(...)`.
|
||||
- **Track A2 (Full `VOID_TEST` `VL-009` Migration & Complete Self-Test `build.cpp`)**: Converted all 40 existing test cases across `tests/{SdkDeclarations,ExampleContexts,CoreEngineTests,FullV1Tests,RegistryTests,SelfHostTests}.cpp` to VoidLibrary's self-registering `VOID_TEST(Suite, name)` macro, removed `VoidTestScanner.cmake` invocation from `CMakeLists.txt` and `tests/CMakeLists.txt`, and declared `vbs_benchmarks` plus all 5 `Void::Testing` executables (`vbs_sdk_tests`, `vbs_core_tests`, `vbs_v1_tests`, `vbs_registry_tests`, `vbs_selfhost_tests`) alongside `vbs_self_smoke` in root `build.cpp` (13 targets total).
|
||||
- **Track A3 (Bit-Identical Stage 2 == Stage 3 Bootstrap)**: Removed `$BUILD_DIR` from `GenerateBootstrapConfig` (`binary_dir = ""`), added disjoint `{profile_build_dir, "/vbs-build"}` prefix mapping in `src/Graph/Graph.cpp`, emitted `-frandom-seed=<filename>` on deterministic GCC compiles and `TZ=UTC`/`LC_ALL=C` on links in `src/Toolchain/Driver.cpp`, and verified `sha256(stage2/vbs) == sha256(stage3/vbs)` (`9280ea998492cd3f48833cf87b06d91940c1f465f29f3871289c1e01bcf2e0b3`) plus `libVoidBuildSdk.a` and `libVoidBuildCore.a` bit-for-bit equality with `cmake` trapped on `PATH`.
|
||||
|
||||
## Remaining future scope
|
||||
|
||||
- **Post-v1 Expansion Roadmap ([21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md) & [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md))**: Track A (zero-CMake self-build + full `VOID_TEST` migration), Track B (C driver, custom-command Ninja translation, foreign C++20 modules, Conan2), Track C (macOS/Windows ports + cross-compilation), Track D (remote HTTP CAS + parallel hashing + SBOM/signatures), and Track E2–E4 (`workspace.cpp`, local daemon, `Void::Net`/`Void::Sqlite` alignment).
|
||||
- **Post-v1 Expansion Roadmap ([21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md) & [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md))**: Track B (C driver, Ninja custom-command translation, foreign C++20 modules, Conan2), Track C (macOS/Windows ports + cross-compilation), Track D (shared HTTP CAS + parallel hashing + SBOM/signatures), and Track E2–E4 (`workspace.cpp`, local daemon, `Void::Net`/`Void::Sqlite` alignment) remain planned scope.
|
||||
|
||||
## Environment notes & upstream boundaries
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Task graph and ownership
|
||||
|
||||
Updated: 2026-11-27
|
||||
Base HEAD: `d3d2666`
|
||||
Base HEAD: `fe0d1a6`
|
||||
|
||||
| Wave | Scope | Status | Primary Deliverables |
|
||||
| --- | --- | --- | --- |
|
||||
@@ -15,4 +15,5 @@ Base HEAD: `d3d2666`
|
||||
| Wave 6 (Upstream `VL-001`..`VL-013` Pin Bump, Self-Building `vbs build`, Live Logs & Generated CLI Help) | Bump VoidLibrary pin to `3e254055e081a104f08df68dde39711bc7813518`; adopt `Void::Crypto`, `Void::Archive`, `Void::Data::Toml`, `Void::Semver::parse_range`, `Void::FileSystem::FileLock`/`DirectoryWatcher`/`reflink_copy_file`/`atomic_symlink_swap`/`set_canonical_mtime`, `Void::Process`, `Void::Argparse::Parser` subcommands + `option_many` + `parse_detailed`; full self-building root `build.cpp`; live `Void::Log` console progress | COMPLETE & VERIFIED | `CMakeLists.txt`, `cmake/VoidDependency.cmake`, `build.cpp`, `src/Main.cpp`, `src/Describe.cpp`, `registry/service/Main.cpp`, `benchmarks/EngineBenchmarks.cpp`, `src/Util/Sha256.cpp`, `src/Package/{Toml,Solver,Archive,Fetch}.cpp`, `src/Platform/{FileOps,ProcessSupervisor}.cpp`, `src/Watch/Watcher.cpp`, `src/Provider/Provider.cpp`, `src/Graph/Graph.cpp`, `src/Execution/Scheduler.cpp`, `recipes/`, updated contracts & docs |
|
||||
| Wave 7 (Plan 20 Slice 1 Bounded CMake Native Translation, Self-Testing `build.cpp`, `VL-009` `VOID_TEST`, & Warm Cache Hardening) | Bounded single-config C++ CMake File API audit + native `Graph::BuildGraph` translation + explicit fallback; self-test target `vbs_self_smoke` in `build.cpp`; `VL-009` `VOID_TEST` zero-CMake basename-collision test; stat-validated `StateStore` cache + `Scheduler` `RunDigestCache` | COMPLETE & VERIFIED | `include/Void/Build/Provider/Translator.hpp`, `src/Provider/Translator.cpp`, `tests/SelfBuildSmoke.cpp`, `src/State/StateStore.{hpp,cpp}`, `src/Execution/Scheduler.cpp`, `build.cpp`, `CMakeLists.txt`, `recipes/SelfHost/VbsSelfHostRecipe.cpp`, expanded tests & docs |
|
||||
| Wave 8 (Plan 20 Slice 2A Meson Native Translation, Everyday DX CLI, & Expansion Roadmap) | Bounded Meson `intro-targets.json` + `build.ninja` native translation & unified `resolve_foreign_with_translation`; `vbs build\|test --native-foreign`, `vbs init`, `vbs clean`, `vbs doctor`, `vbs graph`; 5-track post-v1 expansion roadmap | COMPLETE & VERIFIED | `include/Void/Build/Provider/Translator.hpp`, `src/Provider/Translator.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, `tests/CliContracts.cmake`, `docs/roadmap/21-expansion-roadmap.md`, updated docs |
|
||||
| Future (Tracks A–E / Plan 20 Slices 2B–3) | Zero-CMake self-host & full `VOID_TEST`, C driver & Ninja custom-command translation, macOS/Windows/cross-compile, shared HTTP CAS, `workspace.cpp` & daemon | PLANNED (unimplemented) | [21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md), [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md) |
|
||||
| Wave 9 (Track A — Zero-CMake Self-Hosting, Full `VOID_TEST` Suite, & Bit-Identical Stage 2 == Stage 3) | First-class `builder == "native"` provider + `.native_builder()` in `build.cpp`; all tests migrated to `VOID_TEST(Suite, name)` & `VoidTestScanner.cmake` removed; all 13 targets (`vbs_benchmarks` + 6 test suites) declared in `build.cpp`; `binary_dir = ""` + `/vbs-build` prefix map + `-frandom-seed` Stage 2 == Stage 3 reproducibility verified with trapped `cmake` | COMPLETE & VERIFIED | `include/Void/Build/Provider/Provider.hpp`, `src/Provider/Provider.cpp`, `src/Graph/Graph.cpp`, `src/Toolchain/Driver.cpp`, `src/Main.cpp`, `recipes/VoidLibrary/VoidLibraryRecipe.{hpp,cpp}`, `build.cpp`, `CMakeLists.txt`, `tests/*`, docs |
|
||||
| Future (Tracks B–E2/E4 / Plan 20 Slices 2B–3) | C driver & Ninja custom-command translation, foreign C++20 modules & Conan2, macOS/Windows/cross-compile, shared HTTP CAS & SBOM/signatures, `workspace.cpp` & daemon | PLANNED (unimplemented) | [21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md), [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md) |
|
||||
@@ -36,46 +36,60 @@ dev cpp-gcc -c clang-format --dry-run --Werror \
|
||||
```sh
|
||||
dev cpp-gcc -c ctest --test-dir build/dev --output-on-failure
|
||||
```
|
||||
- Exit status: `0` — **8 / 8 passed (100%) in 107.03 sec**:
|
||||
- Exit status: `0` — **8 / 8 passed (100%) in 121.31 sec**:
|
||||
|
||||
| # | CTest Name | Scope Verified | Result | Time |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| 1 | `vbs_sdk_tests` | 17 tests (`SdkDeclarations` 14 + `ExampleContexts` 3 for 7-target self-building/self-testing `build.cpp` and pin `3e254055...`) | Passed | 0.02s |
|
||||
| 2 | `vbs_core_tests` | 6 tests: `Void::Crypto` SHA-256 NIST vectors, `Void::Process` exec-fail & stubborn grandchild `SIGKILL`, profile inheritance/cycles, snapshot mutation/symlinks/header-shadowing (`Void::FileSystem`), stat-cached `StateStore` CAS recovery/GC, end-to-end native frontend + deterministic build + `RunDigestCache` | Passed | 11.16s |
|
||||
| 3 | `vbs_v1_tests` | 11 tests: CompDB ticket races & `atomic_symlink_swap`, `Void::FileSystem::DirectoryWatcher` + `MetadataOnly` boundary, `Void::Data::Toml` + `Void::Semver::parse_range` PubGrub solver + CAS `vbs.lock`, `Void::Archive` `.tar` determinism & security rejection, real CMake & Meson providers + `VbsDeps.cmake` bridge + relocatable install + CLI `vbs install`/`vbs uninstall`, GCC 16 P1689 modules + full Plan 08 graph integration (sanitizers, partitions, unity, header units), **Plan 20 Slice 1** bounded native CMake translation (equivalence, restored-mtime mutation, `add_custom_command`/`UTILITY` fallback), **Plan 20 Slice 2A** bounded native Meson translation (zero `meson compile`, `custom_target` `RequireNative` rejection + `FallbackToForeignBuild`), AND **Wave 8 DX CLI** E2E (`vbs init` -> `vbs test` -> `vbs graph --format dot\|json` -> `vbs doctor` -> `vbs clean`/`--all`) | Passed | 19.82s |
|
||||
| 4 | `vbs_registry_tests` | 2 tests: `vbs-registry` HTTP/1.1 security/RBAC/CSRF/XSS/tar-422/backup-restore + full live CLI E2E `vbs publish` -> `vbs deps resolve` -> `vbs build --locked` | Passed | 3.98s |
|
||||
| 5 | `vbs_selfhost_tests` | 4 tests: basename-collision-safe `vbs gen-tests`, strict non-CMake native `VoidLibrary` (including `Crypto` + `Archive`) + `VoidBuildSdk` + Stage 2, full Stage 0 -> Stage 1 native `VbsSelfHostRecipe` (`stage1/bin/vbs`, zero CMake) -> Stage 2 `stage1/bin/vbs test` with trapped `cmake` on `PATH`, AND **`VL-009` `VOID_TEST(suite, name)`** zero-CMake zero-scanner test binary across colliding basenames (`alpha/Unit.cpp`, `beta/Unit.cpp`) | Passed | 71.96s |
|
||||
| 6 | `vbs_sdk_registration` | 17 SDK test registrations verified; named JSON case executed | Passed | 0.01s |
|
||||
| 7 | `vbs_cli_contract` | 32 native CLI & auto-generated `Void::Argparse::Parser` help/subcommand/error contracts verified (`vbs`, `vbs-registry`, `build --native-foreign`, `init`, `clean`, `doctor`, `graph`, `compdb`, `deps`, `install`, `publish`, etc.) | Passed | 0.05s |
|
||||
| 8 | `vbs_description_contract` | Four runtime profile/compiler contexts (`debug`/`release` x `gcc`/`clang` for 7-target `build.cpp`), auto-generated `vbs_describe --help`, and five error contracts verified | Passed | 0.04s |
|
||||
| 1 | `vbs_sdk_tests` | 17 self-registered `VOID_TEST` cases (`SdkDeclarations` 14 + `ExampleContexts` 3 for 13-target `.native_builder()` `build.cpp` and pin `3e254055...`; zero CMake test scanner) | Passed | 0.01s |
|
||||
| 2 | `vbs_core_tests` | 6 `VOID_TEST` cases: `Void::Crypto` SHA-256 NIST vectors, `Void::Process` exec-fail & stubborn grandchild `SIGKILL`, profile inheritance/cycles, snapshot mutation/symlinks/header-shadowing (`Void::FileSystem`), stat-cached `StateStore` CAS recovery/GC, end-to-end native frontend + deterministic build + `RunDigestCache` | Passed | 11.41s |
|
||||
| 3 | `vbs_v1_tests` | 12 `VOID_TEST` cases: CompDB ticket races & `atomic_symlink_swap`, `Void::FileSystem::DirectoryWatcher` + `MetadataOnly` boundary, `Void::Data::Toml` + `Void::Semver::parse_range` PubGrub solver + CAS `vbs.lock`, `Void::Archive` `.tar` determinism & security rejection, real CMake & Meson providers + `VbsDeps.cmake` bridge + relocatable install + CLI `vbs install`/`vbs uninstall`, GCC 16 P1689 modules + full Plan 08 graph integration, **Plan 20 Slice 1** CMake translation, **Plan 20 Slice 2A** Meson translation, **Wave 8 DX CLI** E2E (`vbs init` -> `vbs test` -> `vbs graph` -> `vbs doctor` -> `vbs clean`), AND **Track A1** pure `build.cpp` subproject `.native_builder()` build with trapped `cmake` on `PATH` | Passed | 23.95s |
|
||||
| 4 | `vbs_registry_tests` | 2 `VOID_TEST` cases: `vbs-registry` HTTP/1.1 security/RBAC/CSRF/XSS/tar-422/backup-restore + full live CLI E2E `vbs publish` -> `vbs deps resolve` -> `vbs build --locked` | Passed | 4.02s |
|
||||
| 5 | `vbs_selfhost_tests` | 5 `VOID_TEST` cases: basename-collision-safe `vbs gen-tests`, strict non-CMake native `VoidLibrary` + direct `VOID_TEST` `SdkDeclarations.cpp` (zero scanner) + Stage 2, full Stage 0 -> Stage 1 native `VbsSelfHostRecipe` -> Stage 2 `vbs test` with trapped `cmake`, `VL-009` `VOID_TEST(suite, name)` colliding basenames (`alpha/Unit.cpp`, `beta/Unit.cpp`), AND **Track A3** cross-build-dir SHA-256 bit-identical reproducibility (`librepro_lib.a` & `repro_app` with `custom_action` + anonymous namespace + trapped `cmake`) | Passed | 81.80s |
|
||||
| 6 | `vbs_sdk_registration` | 17 `VOID_TEST` registrations verified (`SdkDeclarations.*`, `ExampleContexts.*`); named JSON case executed | Passed | 0.01s |
|
||||
| 7 | `vbs_cli_contract` | 32 native CLI & auto-generated `Void::Argparse::Parser` help/subcommand/error contracts verified | Passed | 0.05s |
|
||||
| 8 | `vbs_description_contract` | Four runtime profile/compiler contexts (`debug`/`release` x `gcc`/`clang` for 13-target `.native_builder()` `build.cpp`), auto-generated `vbs_describe --help`, and five error contracts verified | Passed | 0.06s |
|
||||
|
||||
## Real Self-Build & Self-Test of VoidBuildSystem (`vbs test`)
|
||||
## Real Zero-CMake Self-Build, Native Test Suite & Bit-Identical Stage 2 == Stage 3 (`vbs test` / `vbs build`)
|
||||
|
||||
### Stage 1: Bootstrap `vbs` builds and smoke-tests complete `VoidBuildSystem` from root `build.cpp`
|
||||
### Stage 1 -> Stage 2: Bootstrap `vbs` builds `VoidLibrary` via `.native_builder()`, builds VBS, and runs native `VOID_TEST` suites with trapped `cmake` (`exit 99`)
|
||||
```sh
|
||||
VBS_VOID_SOURCE_DIR=/home/faumaray/Projects/VoidBuildSystem/build/voidlibrary-pinned \
|
||||
dev cpp-gcc -c build/dev/bin/vbs test --build-dir build/vbs-self --jobs 4
|
||||
dev cpp-gcc -c sh -c 'PATH="$PWD/build/cmake-trap:$PATH" build/dev/bin/vbs test --build-dir build/vbs-stage2 --profile release --target vbs --target vbs_self_smoke --target vbs_sdk_tests --target vbs_core_tests --jobs 8'
|
||||
```
|
||||
- Exit status: `0` — **`vbs: [debug] built (39 executed, 0 cached)`** in `42.23s` -> **`vbs test: PASSED 'vbs_self_smoke' (4 ms)`**.
|
||||
- Built `libVoidBuildSdk.a`, `libVoidBuildCore.a`, `libVoidBuildRegistry.a`, `bin/vbs`, `bin/vbs-registry`, and `bin/vbs_self_smoke` with live progress logs across all phases.
|
||||
- Exit status: `0`:
|
||||
- `VoidLibrary` built completely natively without CMake in `12.57s` (`27 executed, 0 cached`), exporting 60 targets.
|
||||
- Root `build.cpp` built cleanly in `41.87s` (`42 executed, 0 cached`).
|
||||
- `vbs test` passed `vbs_sdk_tests` (`4 ms`), `vbs_self_smoke` (`2 ms`), and `vbs_core_tests` (`11324 ms`) with zero `cmake` invocations.
|
||||
|
||||
### Stage 2: Self-built `vbs` verifies warm cached build, self-test, `doctor`, and `graph`
|
||||
### Stage 2 -> Stage 3: Bit-Identical Reproducible Self-Build (`sha256(stage2) == sha256(stage3)`) with trapped `cmake` (`--no-cache`)
|
||||
```sh
|
||||
VBS_VOID_SOURCE_DIR=/home/faumaray/Projects/VoidBuildSystem/build/voidlibrary-pinned \
|
||||
dev cpp-gcc -c build/vbs-self/profiles/debug/out/bin/vbs test --build-dir build/vbs-self --jobs 4
|
||||
dev cpp-gcc -c build/vbs-self/profiles/debug/out/bin/vbs doctor
|
||||
dev cpp-gcc -c build/vbs-self/profiles/debug/out/bin/vbs graph --build-dir build/vbs-self --format dot
|
||||
dev cpp-gcc -c sh -c 'PATH="$PWD/build/cmake-trap:$PATH" build/vbs-stage2/profiles/release/out/bin/vbs build --build-dir build/vbs-stage3 --profile release --target vbs --no-cache --jobs 8'
|
||||
sha256sum build/vbs-stage2/profiles/release/out/bin/vbs build/vbs-stage3/profiles/release/out/bin/vbs \
|
||||
build/vbs-stage2/profiles/release/out/libVoidBuildSdk.a build/vbs-stage3/profiles/release/out/libVoidBuildSdk.a \
|
||||
build/vbs-stage2/profiles/release/out/libVoidBuildCore.a build/vbs-stage3/profiles/release/out/libVoidBuildCore.a
|
||||
```
|
||||
- Exit status: `0` — **`vbs: [debug] built (0 executed, 39 cached)`** in `12.21s` -> **`vbs test: PASSED 'vbs_self_smoke' (3 ms)`**.
|
||||
- `vbs doctor` exited `0`, confirming GCC 16.2.0 (`c++26=yes, reflection=yes, p1689=yes`), `ar`, `git`, `cmake` 4.4.4, `ninja` 1.13.2, `meson` 1.12.1, `clang-scan-deps`, `clang-format`, `Void::Crypto`, and `Void::Archive`.
|
||||
- `vbs graph --format dot` exited `0`, emitting the 7-target Graphviz DOT dependency graph for `VoidBuildSystem`.
|
||||
- Exit status: `0` — `32 executed, 0 cached` in `38.36s`; exact bit-for-bit SHA-256 matches across distinct build directories:
|
||||
- `vbs`: `9280ea998492cd3f48833cf87b06d91940c1f465f29f3871289c1e01bcf2e0b3` (Stage 2 == Stage 3)
|
||||
- `libVoidBuildSdk.a`: `8f1ec2ea226fcb93a55e78e658ce62bc2769941edaaaf097045ba7f8e6027483` (Stage 2 == Stage 3)
|
||||
- `libVoidBuildCore.a`: `07f3ff5fd96e5c7cce3d5dfb0f25f071f09003ae850def63d605d9b0d2b1a4a3` (Stage 2 == Stage 3)
|
||||
|
||||
### Remaining Native Test Suites via Stage 2 `vbs test`
|
||||
```sh
|
||||
VBS_VOID_SOURCE_DIR=/home/faumaray/Projects/VoidBuildSystem/build/voidlibrary-pinned \
|
||||
dev cpp-gcc -c build/vbs-stage2/profiles/release/out/bin/vbs test --build-dir build/vbs-stage2 --profile release --target vbs_v1_tests --target vbs_registry_tests --target vbs_selfhost_tests --jobs 8
|
||||
```
|
||||
- Exit status: `0` (`9.60s` build, `9 executed, 32 cached`):
|
||||
- `vbs test: PASSED 'vbs_v1_tests'` (`23226 ms`)
|
||||
- `vbs test: PASSED 'vbs_selfhost_tests'` (`59753 ms`)
|
||||
- `vbs test: PASSED 'vbs_registry_tests'` (`2851 ms`)
|
||||
|
||||
## Clang 23.1.3 Target Matrix (`dev cpp`)
|
||||
|
||||
```sh
|
||||
dev cpp -c build/dev/bin/vbs_v1_tests --no-color --filter clang23
|
||||
```
|
||||
- Exit status: `0` — `1 tests: 1 ✔ in 780.0ms` (`clang23_target_toolchain_and_p1689_module_scan`).
|
||||
- Exit status: `0` — `1 tests: 1 ✔ in 771.0ms` (`FullV1Tests.clang23_target_toolchain_and_p1689_module_scan`).
|
||||
- Verified inside `dev cpp`: Clang 23.1.3 + `clang-scan-deps` target probing, C++20 compilation, and full `Graph::lower_project_graph` + `Execution::execute_graph` build of module partition (`vbs.clangcalc:part`) + primary interface (`vbs.clangcalc`) + consumer `main.cpp` using two-step `--precompile` `.pcm` -> `.o` with transitive `-fmodule-file=`.
|
||||
|
||||
## Benchmarks (`dev cpp-gcc`)
|
||||
@@ -85,7 +99,7 @@ dev cpp-gcc -c build/dev/bin/vbs_benchmarks --files 15
|
||||
```
|
||||
- Exit status: `0`:
|
||||
```json
|
||||
{"fixture_files":16,"compiler":"g++ (GCC) 16.2.0","snapshot_ms":19,"cold_build_ms":335,"cold_executed":17,"warm_noop_ms":5,"warm_executed":0,"warm_cached":17}
|
||||
{"fixture_files":16,"compiler":"g++ (GCC) 16.2.0","snapshot_ms":20,"cold_build_ms":337,"cold_executed":17,"warm_noop_ms":5,"warm_executed":0,"warm_cached":17}
|
||||
```
|
||||
|
||||
## Limits and Unrun Checks
|
||||
@@ -94,4 +108,4 @@ dev cpp-gcc -c build/dev/bin/vbs_benchmarks --files 15
|
||||
2. **Conan2 live installation**: `conan` is absent in `dev cpp-gcc`; automated testing verified explicit missing-prerequisite failure (`FullV1Tests.cpp`).
|
||||
3. **Optional external VoidLibrary modules (`Void::Net`, `Void::Sqlite`)**: `Boost`, `OpenSSL`, and `SQLite3` are not installed in `dev cpp-gcc`, so VBS continues using its pure-C++/POSIX loopback HTTP adapters (`HttpServer`, `RegistryClient`) and journaled atomic CAS store (`StateStore`), while retaining optional `Void::Sqlite` CMake detection.
|
||||
4. **CI workflow & Web UI browser**: [.github/workflows/ci.yml](../../.github/workflows/ci.yml) has not been executed on remote GitHub Actions runners, and `registry/web/` was verified via HTTP/header/static-serving/API/XSS/CSRF tests without a headless browser runner.
|
||||
5. **Post-v1 Expansion Roadmap ([21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md) & [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md))**: Track A (zero-CMake self-build + full `VOID_TEST` suite), Track B (C driver, Ninja custom-command translation, foreign C++20 module fileSets, Conan2), Track C (Windows/MSVC, macOS/Apple Clang, dual-profile cross-compilation), Track D (shared HTTP CAS, parallel hashing, SBOM/signatures), and Track E2–E4 (`workspace.cpp`, local daemon, `Void::Net`/`Void::Sqlite` alignment) remain planned scope.
|
||||
5. **Post-v1 Expansion Roadmap ([21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md) & [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md))**: Track B (C driver, Ninja custom-command translation, foreign C++20 module fileSets, Conan2), Track C (Windows/MSVC, macOS/Apple Clang, dual-profile cross-compilation), Track D (shared HTTP CAS, parallel hashing, SBOM/signatures), and Track E2–E4 (`workspace.cpp`, local daemon, `Void::Net`/`Void::Sqlite` alignment) remain planned scope.
|
||||
@@ -1,6 +1,6 @@
|
||||
# 21 — Post-v1 Expansion Roadmap
|
||||
|
||||
Status: Planning & active execution guide (Plans **01–19** and **Plan 20 Slices 1 & 2A** are implemented and verified; see [STATE](../agent-workflow/STATE.md) and [VERIFICATION](../agent-workflow/VERIFICATION.md)).
|
||||
Status: Active execution guide (Plans **01–19**, **Plan 20 Slices 1 & 2A**, **Track A [A1–A3]**, and **Track E1** are implemented and verified; **Tracks B–D & E2–E4** remain planned; see [STATE](../agent-workflow/STATE.md) and [VERIFICATION](../agent-workflow/VERIFICATION.md)).
|
||||
|
||||
This roadmap defines five orthogonal expansion tracks for taking VoidBuildSystem from a verified self-hosting Linux C++26 build system into a multi-platform, distributed, daily-driver ecosystem. Each track preserves core architectural invariants: ordinary C++ descriptions, hermetic content-verified snapshots, isolated profiles, immutable CAS publication, and explicit diagnostics over silent approximation.
|
||||
|
||||
@@ -16,15 +16,15 @@ flowchart LR
|
||||
|
||||
---
|
||||
|
||||
## Track A — Full Zero-CMake Self-Hosting & Native Test Suite
|
||||
## Track A — Full Zero-CMake Self-Hosting & Native Test Suite *(Implemented & Verified in Wave 9)*
|
||||
|
||||
**Goal**: Make `VoidBuildSystem` build `VoidLibrary` and all of its own binaries **and** full test suites purely via `vbs test` without invoking CMake at all.
|
||||
|
||||
| Phase | Concrete Scope | Acceptance Gate |
|
||||
| Phase | Concrete Scope | Acceptance Gate / Status |
|
||||
| --- | --- | --- |
|
||||
| **A1 — Native VoidLibrary Recipe Integration** | Expose a `project.native_recipe(...)` or built-in `Void::Build::Recipes::add_void_library_native` hook callable directly from root `build.cpp` so `build.cpp` does not even need the CMake provider for `VoidLibrary`. | `vbs build` builds `VoidBuildSystem` + `VoidLibrary` with a trapped `cmake` on `PATH`. |
|
||||
| **A2 — Full `VOID_TEST` (`VL-009`) Suite Migration** | Port `tests/{SdkDeclarations,ExampleContexts,CoreEngineTests,FullV1Tests,RegistryTests,SelfHostTests}.cpp` to VoidLibrary's self-registering `VOID_TEST(suite, name)` macro and declare all 5 test binaries in root `build.cpp`. | `vbs test` runs every unit, integration, registry, and self-host test directly without CMake or `VoidTestScanner.cmake`. |
|
||||
| **A3 — Reproducible Stage 2 == Stage 3 Bit-Identical Bootstrap** | Build `stage1/vbs` -> `stage2/vbs` -> `stage3/vbs` with fixed `SOURCE_DATE_EPOCH` and verify `sha256(stage2/vbs) == sha256(stage3/vbs)`. | Automated bit-for-bit equality check in CI. |
|
||||
| **A1 — Native Dependency Provider & Zero-CMake `build.cpp`** | Support `builder == "native"` directly in [Provider.cpp](../../src/Provider/Provider.cpp) (both pure `build.cpp` subprojects and built-in `VoidLibrary` recipe) and switch root [build.cpp](../../build.cpp) from `.cmake(...)` to `.native_builder(...)`. | **Verified**: Stage 2 builds `VoidLibrary` natively (27 actions) + VBS with trapped `cmake` on `PATH`; `FullV1Tests` verifies pure `build.cpp` subproject dependencies. |
|
||||
| **A2 — Full `VOID_TEST` (`VL-009`) Suite Migration** | Port all 40 existing cases (plus Wave 9 tests) across `tests/*.cpp` to `VOID_TEST(Suite, name)`, remove `VoidTestScanner.cmake` from CMake, and declare `vbs_benchmarks` + all 5 test binaries alongside `vbs_self_smoke` in root [build.cpp](../../build.cpp). | **Verified**: All 6 test targets (`vbs_self_smoke`, `vbs_sdk_tests`, `vbs_core_tests`, `vbs_v1_tests`, `vbs_registry_tests`, `vbs_selfhost_tests`) build and pass directly via `vbs test`. |
|
||||
| **A3 — Reproducible Stage 2 == Stage 3 Bit-Identical Bootstrap** | Remove `$BUILD_DIR` from `BootstrapConfig.hpp` (`binary_dir = ""` with `/proc/self/exe` sibling resolution), map `profile_build_dir` to `/vbs-build`, emit GCC `-frandom-seed=<filename>`, and set `TZ=UTC` / `LC_ALL=C` on links. | **Verified**: `sha256(stage2/vbs) == sha256(stage3/vbs)` (`9280ea99...`) + `librepro_lib.a`/`repro_app` equivalence across clean build directories with trapped `cmake`. |
|
||||
|
||||
---
|
||||
|
||||
@@ -80,8 +80,8 @@ flowchart LR
|
||||
|
||||
## Recommended Next Execution Order
|
||||
|
||||
1. **Track A1 + A2** (highest ROI for VBS itself): zero-CMake self-build + full `VOID_TEST` native suite via `vbs test`.
|
||||
2. **Track B1 + B2**: C compiler driver + bounded Ninja custom-command translation so real-world C/C++ CMake/Meson dependencies execute natively.
|
||||
3. **Track D1 + D2**: shared HTTP CAS cache on `vbs-registry` + parallel snapshot hashing for large repos.
|
||||
4. **Track E2**: multi-package `workspace.cpp` support.
|
||||
1. **Track B1 + B2** (highest leverage next): C compiler driver + bounded Ninja custom-command translation so real-world C/C++ CMake/Meson dependencies execute natively.
|
||||
2. **Track D1 + D2**: shared HTTP CAS cache on `vbs-registry` + parallel snapshot hashing for large repos.
|
||||
3. **Track E2**: multi-package `workspace.cpp` support.
|
||||
4. **Track B3**: foreign C++20 `CXX_MODULES` `fileSets` lowering + live Conan2 adapter.
|
||||
5. **Track C1–C4**: macOS / Windows platform ports + dual-profile cross-compilation once host CI runners are provisioned.
|
||||
@@ -32,7 +32,7 @@ Authority: [requirements](REQUIREMENTS.md), [architecture](ARCHITECTURE.md),
|
||||
| [18 — Native self-hosting and VoidLibrary migration](18-self-host-voidlibrary.md) | Implemented & Verified | [VoidLibraryRecipe.cpp](../../recipes/VoidLibrary/VoidLibraryRecipe.cpp), [TestRegistryGen.cpp](../../src/SelfHost/TestRegistryGen.cpp) |
|
||||
| [19 — Quality, performance and CI](19-quality-performance-ci.md) | Implemented & Verified | [tests/](../../tests/CMakeLists.txt), [EngineBenchmarks.cpp](../../benchmarks/EngineBenchmarks.cpp), [.github/workflows/ci.yml](../../.github/workflows/ci.yml) |
|
||||
| [20 — Later native foreign execution and platform ports](20-future-translation-platforms.md) | Slices 1 & 2A Implemented & Verified; 2B/2C & OS ports planned | [Translator.hpp](../../include/Void/Build/Provider/Translator.hpp), [Translator.cpp](../../src/Provider/Translator.cpp) (bounded CMake & Meson native translation + unified fallback + `--native-foreign`); C driver, custom commands, Windows/macOS ports planned |
|
||||
| [21 — Post-v1 expansion roadmap](21-expansion-roadmap.md) | Track E1 Implemented; Tracks A–E Planned | Five-track expansion roadmap (zero-CMake self-host & full `VOID_TEST`, extended foreign translation, cross-platform/cross-compile, remote HTTP CAS & attestations, workspaces/daemon/DX) |
|
||||
| [21 — Post-v1 expansion roadmap](21-expansion-roadmap.md) | Track A (A1–A3) & Track E1 Implemented; Tracks B–D, E2–E4 Planned | Five-track expansion roadmap (**Track A** zero-CMake `.native_builder()` self-host, full `VOID_TEST` suite in `build.cpp`, & bit-identical Stage 2 == Stage 3 bootstrap verified; Tracks B–E2/E4 planned) |
|
||||
|
||||
## Dependency graph
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <Void/Build.hpp>
|
||||
#include <Void/Build/Graph/Graph.hpp>
|
||||
#include <Void/Build/Package/Fetch.hpp>
|
||||
#include <Void/Build/State/StateStore.hpp>
|
||||
#include <Void/Build/Toolchain/Driver.hpp>
|
||||
#include <Void/Functional/Error.hpp>
|
||||
#include <Void/Functional/Result.hpp>
|
||||
@@ -27,6 +28,12 @@ struct ProviderRequest {
|
||||
ProviderMode mode{ProviderMode::FullBuild};
|
||||
// Explicit typed interface overrides for foreign projects with incomplete metadata.
|
||||
std::map<std::string, Graph::ImportedTargetInterface, std::less<>> explicit_overrides;
|
||||
// Optional VBS SDK/state context used by native (`builder == "native"`) dependencies.
|
||||
std::filesystem::path sdk_include_dir{};
|
||||
std::filesystem::path sdk_source_dir{};
|
||||
std::optional<std::filesystem::path> sdk_library_path{};
|
||||
State::StateStore *shared_state{nullptr};
|
||||
std::size_t jobs{0};
|
||||
};
|
||||
|
||||
struct ProviderExport {
|
||||
|
||||
@@ -31,7 +31,9 @@ const std::map<std::string, ModuleDef, std::less<>> &known_modules() {
|
||||
{"Crypto", {{"Functional"}, false}},
|
||||
{"Archive", {{"Functional", "Time", "System"}, false}},
|
||||
{"Configuration", {{"Core", "Functional", "System", "Data", "Time", "LogState"}, true}},
|
||||
{"Testing", {{"Core", "Functional", "Time", "LogState", "Configuration", "Text"}, true}},
|
||||
{"Log", {{"Async", "Core", "Data", "Functional", "Memory", "Time", "LogState"}, true}},
|
||||
{"Testing",
|
||||
{{"Core", "Functional", "Time", "LogState", "Async", "Configuration", "Text"}, true}},
|
||||
};
|
||||
return kDefs;
|
||||
}
|
||||
@@ -89,9 +91,10 @@ VoidLibraryTargets add_void_library_native(Project &project,
|
||||
|
||||
Target tgt = srcs.empty() ? project.header_only_library(target_name)
|
||||
: project.static_library(target_name);
|
||||
tgt.cxx_standard(CxxStandard::Cxx26)
|
||||
.include_directory(include_dir, Visibility::Public)
|
||||
.compile_option("-freflection", Visibility::Public);
|
||||
tgt.cxx_standard(CxxStandard::Cxx26).include_directory(include_dir, Visibility::Public);
|
||||
if (project.context().compiler == CompilerFamily::Gcc) {
|
||||
tgt.compile_option("-freflection", Visibility::Public);
|
||||
}
|
||||
|
||||
for (const auto &s : srcs) {
|
||||
tgt.sources(SourceSet::file(s));
|
||||
@@ -109,7 +112,8 @@ VoidLibraryTargets add_void_library_native(Project &project,
|
||||
tgt.define("VOID_ARCHIVE_HAS_LIBARCHIVE=0", Visibility::Public);
|
||||
}
|
||||
if (mod == "Testing") {
|
||||
tgt.define("VOID_HAS_CONFIGURATION", Visibility::Public)
|
||||
tgt.define("VOID_HAS_ASYNC", Visibility::Public)
|
||||
.define("VOID_HAS_CONFIGURATION", Visibility::Public)
|
||||
.define("VOID_HAS_TEXT", Visibility::Public);
|
||||
}
|
||||
result.modules.emplace(mod, tgt);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace Void::Build::Recipes {
|
||||
|
||||
// Pure native VBS recipe for VoidLibrary (pinned commit 9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5).
|
||||
// Pure native VBS recipe for VoidLibrary (pinned commit 3e254055e081a104f08df68dde39711bc7813518).
|
||||
// Translates VoidLibrary's module closure directly into native VBS targets without invoking
|
||||
// CMake or modifying the VoidLibrary source checkout (Plan 18).
|
||||
struct VoidLibraryTargets {
|
||||
|
||||
+7
-2
@@ -1109,12 +1109,17 @@ lower_project_graph(const ProjectDescription &description,
|
||||
physical_includes.emplace_back(map_logical_to_physical(inc_path), is_sys);
|
||||
}
|
||||
|
||||
// Path prefix maps remap physical snapshot root back to logical project root
|
||||
// so __FILE__, __BASE_FILE__, std::source_location, and debug paths match uncached builds!
|
||||
// Path prefix maps remap physical snapshot and build roots to canonical logical paths
|
||||
// so __FILE__, __BASE_FILE__, std::source_location, and debug paths remain deterministic
|
||||
// across isolated snapshots and build directories!
|
||||
std::vector<Toolchain::PathPrefixMap> prefix_maps;
|
||||
if (!graph.snapshot_materialized_root.empty()) {
|
||||
prefix_maps.push_back({graph.snapshot_materialized_root, canonical_root});
|
||||
}
|
||||
if (!t.nondeterministic && !description.profile.nondeterministic &&
|
||||
!graph.profile_build_dir.empty()) {
|
||||
prefix_maps.push_back({graph.profile_build_dir, "/vbs-build"});
|
||||
}
|
||||
|
||||
// 5. Optional PCH compilation action (Plan 08 foundation).
|
||||
std::optional<std::filesystem::path> pch_include_prefix;
|
||||
|
||||
+31
-9
@@ -114,13 +114,21 @@ make_frontend_opts(const std::filesystem::path &project_root,
|
||||
opts.build_root = build_root;
|
||||
opts.sdk_include_dir = std::filesystem::path{Bootstrap::sdk_include_dir};
|
||||
opts.sdk_source_dir = std::filesystem::path{Bootstrap::sdk_source_dir};
|
||||
const auto bin_dir = std::filesystem::path{Bootstrap::binary_dir};
|
||||
const std::array<std::filesystem::path, 3> sdk_candidates{
|
||||
bin_dir / "libVoidBuild_Sdk.a",
|
||||
bin_dir / "out" / "libVoidBuildSdk.a",
|
||||
bin_dir / "profiles" / "debug" / "out" / "libVoidBuildSdk.a",
|
||||
};
|
||||
std::error_code ec;
|
||||
std::vector<std::filesystem::path> sdk_candidates;
|
||||
if (const auto self_exe = std::filesystem::read_symlink("/proc/self/exe", ec);
|
||||
!ec && !self_exe.empty()) {
|
||||
const auto self_root = self_exe.parent_path().parent_path();
|
||||
sdk_candidates.push_back(self_root / "libVoidBuildSdk.a");
|
||||
sdk_candidates.push_back(self_root / "libVoidBuild_Sdk.a");
|
||||
sdk_candidates.push_back(self_root / "lib" / "libVoidBuildSdk.a");
|
||||
}
|
||||
if (!Bootstrap::binary_dir.empty()) {
|
||||
const auto bin_dir = std::filesystem::path{Bootstrap::binary_dir};
|
||||
sdk_candidates.push_back(bin_dir / "libVoidBuild_Sdk.a");
|
||||
sdk_candidates.push_back(bin_dir / "out" / "libVoidBuildSdk.a");
|
||||
sdk_candidates.push_back(bin_dir / "profiles" / "debug" / "out" / "libVoidBuildSdk.a");
|
||||
}
|
||||
for (const auto &candidate : sdk_candidates) {
|
||||
if (std::filesystem::is_regular_file(candidate, ec)) {
|
||||
opts.sdk_library_path = candidate;
|
||||
@@ -681,7 +689,10 @@ int execute_build_or_test(BuildCmdOptions opts, bool run_tests) {
|
||||
if (effective_dep.builder.empty() &&
|
||||
effective_dep.source_kind == DependencySourceKind::Package) {
|
||||
std::error_code bec;
|
||||
if (std::filesystem::is_regular_file(mat.source_dir / "CMakeLists.txt", bec)) {
|
||||
if (std::filesystem::is_regular_file(mat.source_dir / "build.cpp", bec)) {
|
||||
effective_dep.builder = "native";
|
||||
} else if (std::filesystem::is_regular_file(mat.source_dir / "CMakeLists.txt",
|
||||
bec)) {
|
||||
effective_dep.builder = "cmake";
|
||||
} else if (std::filesystem::is_regular_file(mat.source_dir / "meson.build",
|
||||
bec)) {
|
||||
@@ -689,14 +700,21 @@ int execute_build_or_test(BuildCmdOptions opts, bool run_tests) {
|
||||
}
|
||||
}
|
||||
if (effective_dep.builder == "cmake" || effective_dep.builder == "meson" ||
|
||||
effective_dep.builder == "conan") {
|
||||
effective_dep.builder == "conan" || effective_dep.builder == "native") {
|
||||
Provider::ProviderRequest preq{effective_dep,
|
||||
mat,
|
||||
ctx,
|
||||
*tc,
|
||||
build_root / ".vbs" / "providers",
|
||||
Provider::ProviderMode::FullBuild,
|
||||
{}};
|
||||
{},
|
||||
fopts.sdk_include_dir,
|
||||
fopts.sdk_source_dir,
|
||||
fopts.sdk_library_path.empty()
|
||||
? std::nullopt
|
||||
: std::optional{fopts.sdk_library_path},
|
||||
&(*state),
|
||||
jobs};
|
||||
if (opts.native_foreign &&
|
||||
(effective_dep.builder == "cmake" || effective_dep.builder == "meson")) {
|
||||
auto tr = Provider::resolve_foreign_with_translation(
|
||||
@@ -825,11 +843,15 @@ int execute_build_or_test(BuildCmdOptions opts, bool run_tests) {
|
||||
Platform::ProcessRequest treq;
|
||||
treq.executable = t.primary_outputs.front();
|
||||
treq.working_directory = project_root;
|
||||
treq.timeout = std::chrono::seconds{300};
|
||||
auto tres = Platform::run_supervised(treq);
|
||||
if (!tres || !tres->succeeded()) {
|
||||
Void::Log::error("Test", "[{}] FAILED '{}' ({:.0f} ms)", prof_name, t.name,
|
||||
tsw.elapsed_ms());
|
||||
std::cerr << "vbs test: FAILED '" << t.name << "'\n";
|
||||
if (tres && !tres->stdout_data.empty()) {
|
||||
std::cerr << tres->stdout_data << '\n';
|
||||
}
|
||||
if (tres && !tres->stderr_data.empty()) {
|
||||
std::cerr << tres->stderr_data << '\n';
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#include <Void/Build/Provider/Provider.hpp>
|
||||
|
||||
#include <Void/Build/Config/Frontend.hpp>
|
||||
#include <Void/Build/Execution/Scheduler.hpp>
|
||||
#include <Void/Build/Platform/FileOps.hpp>
|
||||
#include <Void/Build/Platform/ProcessSupervisor.hpp>
|
||||
#include <Void/Build/Snapshot/Snapshot.hpp>
|
||||
#include <Void/Build/Util/Json.hpp>
|
||||
#include <Void/Build/Util/Sha256.hpp>
|
||||
#include <Void/Data/StrictJson.hpp>
|
||||
@@ -9,6 +12,7 @@
|
||||
#include <Void/System/Path.hpp>
|
||||
#include <Void/System/Types.hpp>
|
||||
#include <Void/Time/Stopwatch.hpp>
|
||||
#include <VoidLibrary/VoidLibraryRecipe.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <format>
|
||||
@@ -868,6 +872,430 @@ run_conan_provider(const ProviderRequest &request, const std::filesystem::path &
|
||||
return exp;
|
||||
}
|
||||
|
||||
std::vector<std::string> parse_void_modules_option(const OptionMap &options) {
|
||||
std::vector<std::string> mods;
|
||||
const auto it = options.find("VOID_ENABLED_MODULES");
|
||||
if (it != options.end()) {
|
||||
const std::string raw = cmake_option_value(it->second);
|
||||
std::size_t pos = 0;
|
||||
while (pos < raw.size()) {
|
||||
const auto sep = raw.find_first_of(";,", pos);
|
||||
std::string_view token = sep == std::string::npos
|
||||
? std::string_view{raw}.substr(pos)
|
||||
: std::string_view{raw}.substr(pos, sep - pos);
|
||||
while (!token.empty() && (token.front() == ' ' || token.front() == '\t' ||
|
||||
token.front() == '\r' || token.front() == '\n')) {
|
||||
token.remove_prefix(1);
|
||||
}
|
||||
while (!token.empty() && (token.back() == ' ' || token.back() == '\t' ||
|
||||
token.back() == '\r' || token.back() == '\n')) {
|
||||
token.remove_suffix(1);
|
||||
}
|
||||
if (!token.empty()) {
|
||||
mods.emplace_back(token);
|
||||
}
|
||||
if (sep == std::string::npos) {
|
||||
break;
|
||||
}
|
||||
pos = sep + 1;
|
||||
}
|
||||
}
|
||||
if (mods.empty()) {
|
||||
mods = {"Configuration", "Text", "Unicode", "Async",
|
||||
"Algorithms", "Crypto", "Archive", "Testing"};
|
||||
}
|
||||
return mods;
|
||||
}
|
||||
|
||||
std::pair<std::vector<std::filesystem::path>, std::vector<std::filesystem::path>>
|
||||
collect_native_dep_snapshot_inputs(const Graph::ProjectDescription &desc,
|
||||
const std::filesystem::path &project_root) {
|
||||
std::error_code ec;
|
||||
const auto canon_root = std::filesystem::weakly_canonical(project_root, ec);
|
||||
const auto &root = ec ? project_root : canon_root;
|
||||
|
||||
std::set<std::filesystem::path> root_dirs;
|
||||
std::set<std::filesystem::path> files;
|
||||
|
||||
auto add_dir_if_in_project = [&](const std::filesystem::path &dir) {
|
||||
std::error_code dec;
|
||||
const auto norm = dir.lexically_normal();
|
||||
if (std::filesystem::is_directory(norm, dec) && Platform::path_is_within(root, norm) &&
|
||||
norm != root) {
|
||||
root_dirs.insert(norm);
|
||||
}
|
||||
};
|
||||
for (const char *d : {"src", "source", "include", "tests"}) {
|
||||
add_dir_if_in_project(root / d);
|
||||
}
|
||||
auto is_gen_ref = [](std::string_view p) {
|
||||
return p.starts_with("$GEN/") || p.starts_with("gen/");
|
||||
};
|
||||
for (const auto &t : desc.targets) {
|
||||
for (const auto &inc : t.include_directories) {
|
||||
if (!is_gen_ref(inc.path)) {
|
||||
const std::filesystem::path p{inc.path};
|
||||
add_dir_if_in_project(p.is_absolute() ? p : (root / p));
|
||||
}
|
||||
}
|
||||
for (const auto &src : t.sources) {
|
||||
if (is_gen_ref(src.path)) {
|
||||
continue;
|
||||
}
|
||||
if (src.kind == SourceKind::File || src.kind == SourceKind::ModuleInterface ||
|
||||
src.kind == SourceKind::ModulePartition || src.kind == SourceKind::HeaderUnit) {
|
||||
const std::filesystem::path p{src.path};
|
||||
const auto abs = (p.is_absolute() ? p : (root / p)).lexically_normal();
|
||||
if (std::filesystem::is_regular_file(abs, ec)) {
|
||||
files.insert(abs);
|
||||
if (abs.has_parent_path()) {
|
||||
add_dir_if_in_project(abs.parent_path());
|
||||
}
|
||||
}
|
||||
} else if (src.kind == SourceKind::Glob) {
|
||||
const auto star = src.path.find_first_of("*?[");
|
||||
const std::string_view prefix = star == std::string::npos
|
||||
? std::string_view{src.path}
|
||||
: std::string_view{src.path}.substr(0, star);
|
||||
const auto slash = prefix.rfind('/');
|
||||
if (slash != std::string_view::npos && slash > 0) {
|
||||
add_dir_if_in_project(root / std::filesystem::path{prefix.substr(0, slash)});
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const auto &in : t.action_inputs) {
|
||||
if (!is_gen_ref(in)) {
|
||||
const std::filesystem::path p{in};
|
||||
const auto abs = (p.is_absolute() ? p : (root / p)).lexically_normal();
|
||||
if (std::filesystem::is_regular_file(abs, ec)) {
|
||||
files.insert(abs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::filesystem::path> scan_roots;
|
||||
for (const auto &d : root_dirs) {
|
||||
bool covered = false;
|
||||
for (const auto &other : root_dirs) {
|
||||
if (other != d && Platform::path_is_within(other, d)) {
|
||||
covered = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!covered) {
|
||||
scan_roots.push_back(d);
|
||||
}
|
||||
}
|
||||
std::vector<std::filesystem::path> explicit_files;
|
||||
for (const auto &f : files) {
|
||||
bool covered = false;
|
||||
for (const auto &d : scan_roots) {
|
||||
if (Platform::path_is_within(d, f)) {
|
||||
covered = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!covered) {
|
||||
explicit_files.push_back(f);
|
||||
}
|
||||
}
|
||||
return {std::move(explicit_files), std::move(scan_roots)};
|
||||
}
|
||||
|
||||
Void::Result::Result<ProviderExport, Void::Result::Error>
|
||||
run_native_provider(const ProviderRequest &request, const std::filesystem::path &build_dir,
|
||||
const std::string &input_hash, std::stop_token stop) {
|
||||
std::error_code ec;
|
||||
std::filesystem::remove_all(build_dir, ec);
|
||||
std::filesystem::create_directories(build_dir, ec);
|
||||
|
||||
Graph::ProjectDescription desc;
|
||||
std::optional<Snapshot::InputSnapshot> snap;
|
||||
|
||||
const auto &src_dir = request.source.source_dir;
|
||||
const bool has_build_cpp = std::filesystem::is_regular_file(src_dir / "build.cpp", ec);
|
||||
const bool is_void_library = std::filesystem::is_directory(src_dir / "include" / "Void", ec) &&
|
||||
std::filesystem::is_directory(src_dir / "src" / "Core", ec);
|
||||
|
||||
if (has_build_cpp) {
|
||||
if (request.sdk_include_dir.empty() && request.sdk_source_dir.empty() &&
|
||||
!request.sdk_library_path) {
|
||||
return std::unexpected{make_error(Void::System::SystemErrorCode::invalid_argument,
|
||||
"native subproject builder requires VBS SDK "
|
||||
"include/source paths in ProviderRequest")};
|
||||
}
|
||||
Void::Log::info("Provider", "Evaluating native subproject '{}' (profile='{}')...",
|
||||
request.dependency.name, request.profile.name);
|
||||
Config::FrontendOptions fopts;
|
||||
fopts.project_root = src_dir;
|
||||
fopts.build_root = build_dir;
|
||||
fopts.sdk_include_dir = request.sdk_include_dir;
|
||||
fopts.sdk_source_dir = request.sdk_source_dir;
|
||||
if (request.sdk_library_path) {
|
||||
fopts.sdk_library_path = *request.sdk_library_path;
|
||||
}
|
||||
auto compiled = Config::compile_descriptor(fopts);
|
||||
if (!compiled) {
|
||||
return std::unexpected{compiled.error()};
|
||||
}
|
||||
auto eval = Config::evaluate_project(*compiled, request.profile, fopts);
|
||||
if (!eval) {
|
||||
return std::unexpected{eval.error()};
|
||||
}
|
||||
if (!eval->dependencies.empty() || !eval->dependency_files.empty()) {
|
||||
return std::unexpected{make_error(
|
||||
Void::System::SystemErrorCode::unsupported,
|
||||
std::format("native subproject '{}' declares nested dependencies which are not "
|
||||
"yet supported",
|
||||
request.dependency.name))};
|
||||
}
|
||||
desc = std::move(*eval);
|
||||
|
||||
const auto [explicit_files, scan_roots] = collect_native_dep_snapshot_inputs(desc, src_dir);
|
||||
Snapshot::SnapshotOptions sopts;
|
||||
sopts.project_root = src_dir;
|
||||
sopts.snapshot_store_dir = build_dir / ".vbs" / "snapshots";
|
||||
sopts.reproducibility_epoch = request.profile.reproducibility_epoch;
|
||||
auto cap = Snapshot::capture_snapshot(sopts, explicit_files, scan_roots);
|
||||
if (!cap) {
|
||||
return std::unexpected{cap.error()};
|
||||
}
|
||||
snap = std::move(*cap);
|
||||
} else if (is_void_library) {
|
||||
const auto mods = parse_void_modules_option(request.dependency.options);
|
||||
Void::Log::info("Provider",
|
||||
"Evaluating native VoidLibrary recipe for '{}' ({} module(s), "
|
||||
"profile='{}')...",
|
||||
request.dependency.name, mods.size(), request.profile.name);
|
||||
Project sub_proj{request.profile};
|
||||
try {
|
||||
(void)Recipes::add_void_library_native(sub_proj, src_dir, mods);
|
||||
} catch (const std::exception &ex) {
|
||||
return std::unexpected{
|
||||
make_error(Void::System::SystemErrorCode::invalid_argument, ex.what())};
|
||||
}
|
||||
auto parsed_desc = Graph::ProjectDescription::from_json(sub_proj.to_json());
|
||||
if (!parsed_desc) {
|
||||
return std::unexpected{parsed_desc.error()};
|
||||
}
|
||||
desc = std::move(*parsed_desc);
|
||||
} else {
|
||||
return std::unexpected{make_error(
|
||||
Void::System::SystemErrorCode::invalid_argument,
|
||||
std::format("native builder for '{}' requires build.cpp or a supported native recipe",
|
||||
request.dependency.name))};
|
||||
}
|
||||
|
||||
auto graph = Graph::lower_project_graph(
|
||||
desc, request.toolchain, {src_dir, build_dir, snap ? &(*snap) : nullptr, {}, 32768});
|
||||
if (!graph) {
|
||||
return std::unexpected{graph.error()};
|
||||
}
|
||||
|
||||
std::vector<std::string> selected_targets;
|
||||
for (const auto &t : desc.targets) {
|
||||
if (!t.enabled) {
|
||||
continue;
|
||||
}
|
||||
if (t.kind == TargetKind::StaticLibrary || t.kind == TargetKind::SharedLibrary ||
|
||||
t.kind == TargetKind::ObjectLibrary || t.kind == TargetKind::CustomAction ||
|
||||
(request.dependency.build_dependency && t.kind == TargetKind::Executable)) {
|
||||
selected_targets.push_back(t.name);
|
||||
}
|
||||
}
|
||||
|
||||
if (!selected_targets.empty()) {
|
||||
std::optional<State::StateStore> local_state;
|
||||
State::StateStore *state_ptr = request.shared_state;
|
||||
if (!state_ptr) {
|
||||
auto st = State::StateStore::open(build_dir / ".vbs");
|
||||
if (!st) {
|
||||
return std::unexpected{st.error()};
|
||||
}
|
||||
local_state.emplace(std::move(*st));
|
||||
state_ptr = &(*local_state);
|
||||
}
|
||||
Execution::ExecutionOptions eopts;
|
||||
eopts.jobs = request.jobs;
|
||||
eopts.use_cache = true;
|
||||
eopts.fail_fast = true;
|
||||
eopts.selected_targets = selected_targets;
|
||||
|
||||
const auto sw = Void::Time::Stopwatch::started();
|
||||
Void::Log::info("Provider", "Building native dependency '{}' ({} action(s))...",
|
||||
request.dependency.name, graph->actions.size());
|
||||
auto exec = Execution::execute_graph(*graph, *state_ptr, eopts, stop);
|
||||
if (!exec) {
|
||||
return std::unexpected{exec.error()};
|
||||
}
|
||||
if (!exec->succeeded) {
|
||||
std::string detail;
|
||||
for (const auto &ar : exec->results) {
|
||||
if (!ar.succeeded) {
|
||||
if (!detail.empty()) {
|
||||
detail += '\n';
|
||||
}
|
||||
detail += ar.action_id + ": " + ar.error_message;
|
||||
if (!ar.stderr_data.empty()) {
|
||||
detail += "\n" + ar.stderr_data;
|
||||
}
|
||||
}
|
||||
}
|
||||
return std::unexpected{make_error(
|
||||
Void::System::SystemErrorCode::io_error,
|
||||
std::format("native dependency '{}' build failed:\n{}", request.dependency.name,
|
||||
detail.empty() ? exec->diagnostic : detail))};
|
||||
}
|
||||
Void::Log::info("Provider",
|
||||
"Built native dependency '{}' in {:.2f}s ({} executed, {} cached)",
|
||||
request.dependency.name, sw.elapsed_ms() / 1000.0, exec->executed_count,
|
||||
exec->cached_count);
|
||||
}
|
||||
|
||||
ProviderExport exp;
|
||||
exp.dependency_name = request.dependency.name;
|
||||
exp.builder = "native";
|
||||
exp.input_identity_hash = input_hash;
|
||||
|
||||
std::map<std::string, const TargetRecord *, std::less<>> rec_by_name;
|
||||
for (const auto &t : desc.targets) {
|
||||
rec_by_name[t.name] = &t;
|
||||
}
|
||||
std::map<std::string, const Graph::ResolvedTargetSummary *, std::less<>> summary_by_name;
|
||||
for (const auto &s : graph->targets) {
|
||||
summary_by_name[s.name] = &s;
|
||||
}
|
||||
|
||||
const auto gen_root = graph->profile_build_dir / "gen";
|
||||
auto resolve_inc = [&](const std::string &raw) -> std::filesystem::path {
|
||||
if (raw.starts_with("$GEN/") || raw.starts_with("gen/")) {
|
||||
const auto suffix = raw.starts_with("$GEN/") ? raw.substr(5) : raw.substr(4);
|
||||
return (gen_root / suffix).lexically_normal();
|
||||
}
|
||||
const std::filesystem::path p{raw};
|
||||
return p.is_absolute() ? p.lexically_normal() : (src_dir / p).lexically_normal();
|
||||
};
|
||||
|
||||
for (const auto &t : desc.targets) {
|
||||
if (t.kind != TargetKind::StaticLibrary && t.kind != TargetKind::SharedLibrary &&
|
||||
t.kind != TargetKind::HeaderOnly) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Graph::ImportedTargetInterface iface;
|
||||
iface.dependency_name = request.dependency.name;
|
||||
iface.target_name = t.name;
|
||||
|
||||
std::set<std::string> usage_visited;
|
||||
auto collect_usage = [&](auto &&self, const std::string &cur_name) -> void {
|
||||
if (!usage_visited.insert(cur_name).second) {
|
||||
return;
|
||||
}
|
||||
const auto it = rec_by_name.find(cur_name);
|
||||
if (it == rec_by_name.end()) {
|
||||
return;
|
||||
}
|
||||
const auto &cur = *it->second;
|
||||
if (cur.use_conventional_sources &&
|
||||
std::filesystem::is_directory(src_dir / "include", ec)) {
|
||||
const auto inc = (src_dir / "include").lexically_normal();
|
||||
if (!std::ranges::contains(iface.include_dirs,
|
||||
std::pair<std::filesystem::path, bool>{inc, false})) {
|
||||
iface.include_dirs.emplace_back(inc, false);
|
||||
}
|
||||
}
|
||||
for (const auto &inc : cur.include_directories) {
|
||||
if (inc.visibility != Visibility::Private) {
|
||||
const std::pair<std::filesystem::path, bool> entry{resolve_inc(inc.path),
|
||||
inc.is_system};
|
||||
if (!std::ranges::contains(iface.include_dirs, entry)) {
|
||||
iface.include_dirs.push_back(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const auto &def : cur.defines) {
|
||||
if (def.visibility != Visibility::Private &&
|
||||
!std::ranges::contains(iface.defines, def.value)) {
|
||||
iface.defines.push_back(def.value);
|
||||
}
|
||||
}
|
||||
for (const auto &opt : cur.scoped_compile_options) {
|
||||
if (opt.visibility != Visibility::Private &&
|
||||
!std::ranges::contains(iface.compile_options, opt.value)) {
|
||||
iface.compile_options.push_back(opt.value);
|
||||
}
|
||||
}
|
||||
for (const auto &l : cur.links) {
|
||||
if (l.kind == LinkKind::Local && l.visibility != Visibility::Private) {
|
||||
self(self, l.target);
|
||||
}
|
||||
}
|
||||
};
|
||||
collect_usage(collect_usage, t.name);
|
||||
|
||||
std::vector<std::string> post_order;
|
||||
std::set<std::string> link_visited;
|
||||
auto collect_links = [&](auto &&self, const std::string &cur_name) -> void {
|
||||
if (!link_visited.insert(cur_name).second) {
|
||||
return;
|
||||
}
|
||||
const auto it = rec_by_name.find(cur_name);
|
||||
if (it == rec_by_name.end()) {
|
||||
return;
|
||||
}
|
||||
for (const auto &l : it->second->links) {
|
||||
if (l.kind == LinkKind::Local) {
|
||||
self(self, l.target);
|
||||
}
|
||||
}
|
||||
post_order.push_back(cur_name);
|
||||
};
|
||||
collect_links(collect_links, t.name);
|
||||
|
||||
for (auto rit = post_order.rbegin(); rit != post_order.rend(); ++rit) {
|
||||
const auto rec_it = rec_by_name.find(*rit);
|
||||
const auto sum_it = summary_by_name.find(*rit);
|
||||
if (rec_it != rec_by_name.end()) {
|
||||
for (const auto &lo : rec_it->second->link_options) {
|
||||
if (lo.visibility != Visibility::Private &&
|
||||
!std::ranges::contains(iface.link_options, lo.value)) {
|
||||
iface.link_options.push_back(lo.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rec_it != rec_by_name.end() && sum_it != summary_by_name.end() &&
|
||||
!sum_it->second->primary_outputs.empty()) {
|
||||
const auto &art = sum_it->second->primary_outputs.front();
|
||||
if (rec_it->second->kind == TargetKind::StaticLibrary &&
|
||||
!std::ranges::contains(iface.static_libraries, art)) {
|
||||
iface.static_libraries.push_back(art);
|
||||
} else if (rec_it->second->kind == TargetKind::SharedLibrary &&
|
||||
!std::ranges::contains(iface.shared_libraries, art)) {
|
||||
iface.shared_libraries.push_back(art);
|
||||
if (!std::ranges::contains(iface.runtime_files, art)) {
|
||||
iface.runtime_files.push_back(art);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exp.targets[request.dependency.name + "::" + t.name] = iface;
|
||||
exp.targets[t.name] = iface;
|
||||
if (t.name.starts_with("Void_")) {
|
||||
auto alias = iface;
|
||||
alias.target_name = "Void::" + t.name.substr(5);
|
||||
exp.targets[request.dependency.name + "::" + alias.target_name] = alias;
|
||||
exp.targets[alias.target_name] = std::move(alias);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &[k, v] : request.explicit_overrides) {
|
||||
exp.targets[k] = v;
|
||||
}
|
||||
return exp;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
std::string compute_provider_input_hash(const ProviderRequest &request) {
|
||||
@@ -933,6 +1361,8 @@ resolve_foreign_provider(const ProviderRequest &request, std::stop_token stop) {
|
||||
res = run_meson_provider(request, tool_build_dir, input_hash, stop);
|
||||
} else if (request.dependency.builder == "conan") {
|
||||
res = run_conan_provider(request, tool_build_dir, input_hash, stop);
|
||||
} else if (request.dependency.builder == "native") {
|
||||
res = run_native_provider(request, tool_build_dir, input_hash, stop);
|
||||
}
|
||||
if (!res) {
|
||||
return std::unexpected{res.error()};
|
||||
|
||||
@@ -556,6 +556,9 @@ lower_compile_command(const ToolchainCapabilities &toolchain, const CompileReque
|
||||
args.push_back("-fdebug-prefix-map=" + spec);
|
||||
}
|
||||
}
|
||||
if (toolchain.family == CompilerFamily::Gcc && !request.nondeterministic) {
|
||||
args.push_back("-frandom-seed=" + request.output_object.filename().string());
|
||||
}
|
||||
for (const auto &[inc, is_system] : request.include_dirs) {
|
||||
args.push_back(is_system ? "-isystem" : "-I");
|
||||
args.push_back(inc.string());
|
||||
@@ -654,6 +657,8 @@ lower_link_command(const ToolchainCapabilities &toolchain, const LinkRequest &re
|
||||
}
|
||||
LoweredCommand cmd;
|
||||
cmd.executable = toolchain.cxx_compiler;
|
||||
cmd.environment["TZ"] = "UTC";
|
||||
cmd.environment["LC_ALL"] = "C";
|
||||
|
||||
std::vector<std::string> args;
|
||||
if (!toolchain.sysroot.empty()) {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
add_executable(vbs_sdk_tests SdkDeclarations.cpp ExampleContexts.cpp)
|
||||
target_link_libraries(vbs_sdk_tests PRIVATE VoidBuild_ExampleDescription)
|
||||
target_link_libraries(vbs_sdk_tests PRIVATE VoidBuild_ExampleDescription Void::Testing)
|
||||
set_target_properties(vbs_sdk_tests PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
|
||||
add_test(NAME vbs_sdk_tests COMMAND "${CMAKE_COMMAND}"
|
||||
"-DSDK_TESTS=$<TARGET_FILE:vbs_sdk_tests>" -P "${CMAKE_CURRENT_SOURCE_DIR}/RunSdkTests.cmake")
|
||||
void_add_tests(vbs_sdk_tests)
|
||||
|
||||
add_executable(vbs_core_tests CoreEngineTests.cpp)
|
||||
target_include_directories(vbs_core_tests PRIVATE "${PROJECT_BINARY_DIR}/generated")
|
||||
@@ -12,7 +11,6 @@ target_link_libraries(vbs_core_tests PRIVATE Void::BuildCore Void::Testing)
|
||||
set_target_properties(vbs_core_tests PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
|
||||
add_test(NAME vbs_core_tests COMMAND "$<TARGET_FILE:vbs_core_tests>" --no-color)
|
||||
void_add_tests(vbs_core_tests)
|
||||
|
||||
add_executable(vbs_v1_tests FullV1Tests.cpp)
|
||||
target_include_directories(vbs_v1_tests PRIVATE "${PROJECT_BINARY_DIR}/generated")
|
||||
@@ -20,7 +18,6 @@ target_link_libraries(vbs_v1_tests PRIVATE Void::BuildCore Void::Testing)
|
||||
set_target_properties(vbs_v1_tests PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
|
||||
add_test(NAME vbs_v1_tests COMMAND "$<TARGET_FILE:vbs_v1_tests>" --no-color)
|
||||
void_add_tests(vbs_v1_tests)
|
||||
|
||||
add_executable(vbs_registry_tests RegistryTests.cpp)
|
||||
target_include_directories(vbs_registry_tests PRIVATE "${PROJECT_BINARY_DIR}/generated")
|
||||
@@ -28,7 +25,6 @@ target_link_libraries(vbs_registry_tests PRIVATE Void::BuildRegistry Void::Testi
|
||||
set_target_properties(vbs_registry_tests PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
|
||||
add_test(NAME vbs_registry_tests COMMAND "$<TARGET_FILE:vbs_registry_tests>" --no-color)
|
||||
void_add_tests(vbs_registry_tests)
|
||||
|
||||
add_executable(vbs_selfhost_tests SelfHostTests.cpp)
|
||||
target_include_directories(vbs_selfhost_tests PRIVATE "${PROJECT_BINARY_DIR}/generated")
|
||||
@@ -38,7 +34,6 @@ target_link_libraries(vbs_selfhost_tests PRIVATE Void::BuildCore Void::Testing)
|
||||
set_target_properties(vbs_selfhost_tests PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
|
||||
add_test(NAME vbs_selfhost_tests COMMAND "$<TARGET_FILE:vbs_selfhost_tests>" --no-color)
|
||||
void_add_tests(vbs_selfhost_tests)
|
||||
|
||||
add_test(NAME vbs_sdk_registration COMMAND "${CMAKE_COMMAND}"
|
||||
"-DSDK_TESTS=$<TARGET_FILE:vbs_sdk_tests>" -P "${CMAKE_CURRENT_SOURCE_DIR}/SdkRegistration.cmake")
|
||||
|
||||
@@ -36,7 +36,7 @@ void write_text_file(const std::filesystem::path &path, std::string_view content
|
||||
|
||||
} // namespace
|
||||
|
||||
Void::Testing::Test sha256_nist_vectors_and_files() {
|
||||
VOID_TEST(CoreEngineTests, sha256_nist_vectors_and_files) {
|
||||
Void::Testing::expect_eq(
|
||||
Util::sha256_hex(""),
|
||||
std::string{"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"});
|
||||
@@ -58,7 +58,7 @@ Void::Testing::Test sha256_nist_vectors_and_files() {
|
||||
}
|
||||
}
|
||||
|
||||
Void::Testing::Test process_supervisor_exec_failure_and_early_leader_grandchild_kill() {
|
||||
VOID_TEST(CoreEngineTests, process_supervisor_exec_failure_and_early_leader_grandchild_kill) {
|
||||
// 1. Distinguish exec failure from exit code 127.
|
||||
{
|
||||
Platform::ProcessRequest req;
|
||||
@@ -108,7 +108,7 @@ Void::Testing::Test process_supervisor_exec_failure_and_early_leader_grandchild_
|
||||
}
|
||||
}
|
||||
|
||||
Void::Testing::Test profile_inheritance_and_cycle_rejection() {
|
||||
VOID_TEST(CoreEngineTests, profile_inheritance_and_cycle_rejection) {
|
||||
Profiles p = default_profiles();
|
||||
p.inherit("debug-asan", "debug", {"-fno-omit-frame-pointer"});
|
||||
auto resolved = p.resolve("debug-asan", CompilerFamily::Gcc, "Linux", "x86_64");
|
||||
@@ -129,7 +129,7 @@ Void::Testing::Test profile_inheritance_and_cycle_rejection() {
|
||||
[&] { (void)missing_parent.resolve("child", CompilerFamily::Gcc, "Linux", "x86_64"); });
|
||||
}
|
||||
|
||||
Void::Testing::Test snapshot_content_mutations_symlinks_shadowing_and_isolation() {
|
||||
VOID_TEST(CoreEngineTests, snapshot_content_mutations_symlinks_shadowing_and_isolation) {
|
||||
Void::FileSystem::TempDir tmp{"vbs_snap_"};
|
||||
const auto proj = tmp / "project";
|
||||
const auto store = tmp / "store";
|
||||
@@ -206,7 +206,7 @@ Void::Testing::Test snapshot_content_mutations_symlinks_shadowing_and_isolation(
|
||||
Void::Testing::expect(!loop_snap.has_value());
|
||||
}
|
||||
|
||||
Void::Testing::Test state_store_cas_corruption_recovery_and_gc() {
|
||||
VOID_TEST(CoreEngineTests, state_store_cas_corruption_recovery_and_gc) {
|
||||
Void::FileSystem::TempDir tmp{"vbs_state_"};
|
||||
auto store = State::StateStore::open(tmp / ".vbs");
|
||||
Void::Testing::expect(store.has_value());
|
||||
@@ -262,7 +262,7 @@ Void::Testing::Test state_store_cas_corruption_recovery_and_gc() {
|
||||
Void::Testing::expect(lookup.has_value() && !lookup->has_value());
|
||||
}
|
||||
|
||||
Void::Testing::Test end_to_end_native_frontend_graph_execution_and_archive_member_removal() {
|
||||
VOID_TEST(CoreEngineTests, end_to_end_native_frontend_graph_execution_and_archive_member_removal) {
|
||||
Void::FileSystem::TempDir tmp{"vbs_e2e_"};
|
||||
const auto proj = tmp / "app_proj";
|
||||
const auto build_dir = tmp / "build";
|
||||
|
||||
@@ -53,7 +53,19 @@ foreach(profile IN ITEMS debug release)
|
||||
expect_json(executable targets 5 kind)
|
||||
expect_json(vbs_self_smoke targets 6 name)
|
||||
expect_json(test targets 6 kind)
|
||||
foreach(index IN ITEMS 0 1 3 4 5 6)
|
||||
expect_json(vbs_benchmarks targets 7 name)
|
||||
expect_json(executable targets 7 kind)
|
||||
expect_json(vbs_sdk_tests targets 8 name)
|
||||
expect_json(test targets 8 kind)
|
||||
expect_json(vbs_core_tests targets 9 name)
|
||||
expect_json(test targets 9 kind)
|
||||
expect_json(vbs_v1_tests targets 10 name)
|
||||
expect_json(test targets 10 kind)
|
||||
expect_json(vbs_registry_tests targets 11 name)
|
||||
expect_json(test targets 11 kind)
|
||||
expect_json(vbs_selfhost_tests targets 12 name)
|
||||
expect_json(test targets 12 kind)
|
||||
foreach(index IN ITEMS 0 1 3 4 5 6 7 8 9 10 11 12)
|
||||
if(compiler STREQUAL "gcc")
|
||||
expect_json(-Wduplicated-cond targets "${index}" compile_options 2)
|
||||
else()
|
||||
@@ -62,7 +74,7 @@ foreach(profile IN ITEMS debug release)
|
||||
endforeach()
|
||||
expect_json(git dependencies 0 source kind)
|
||||
expect_json(3e254055e081a104f08df68dde39711bc7813518 dependencies 0 source revision)
|
||||
expect_json(cmake dependencies 0 builder)
|
||||
expect_json(native dependencies 0 builder)
|
||||
string(JSON option_type TYPE "${graph}" dependencies 0 options BUILD_SHARED_LIBS)
|
||||
if(NOT option_type STREQUAL "BOOLEAN")
|
||||
message(FATAL_ERROR "CMake bool option lost its type")
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
Void::Testing::Test example_uses_runtime_compiler() {
|
||||
VOID_TEST(ExampleContexts, example_uses_runtime_compiler) {
|
||||
Void::Build::Profiles definitions;
|
||||
profiles(definitions);
|
||||
Void::Build::Project gcc{
|
||||
@@ -29,7 +29,7 @@ Void::Testing::Test example_uses_runtime_compiler() {
|
||||
}
|
||||
}
|
||||
|
||||
Void::Testing::Test example_profile_options_are_separate() {
|
||||
VOID_TEST(ExampleContexts, example_profile_options_are_separate) {
|
||||
Void::Build::Profiles definitions;
|
||||
profiles(definitions);
|
||||
Void::Build::Project debug{
|
||||
@@ -47,11 +47,11 @@ Void::Testing::Test example_profile_options_are_separate() {
|
||||
Void::Testing::expect(debug.to_json() != release.to_json());
|
||||
}
|
||||
|
||||
Void::Testing::Test example_records_sources_links_and_pin() {
|
||||
VOID_TEST(ExampleContexts, example_records_sources_links_and_pin) {
|
||||
Void::Build::Project project{Void::Build::default_profiles().resolve(
|
||||
"debug", Void::Build::CompilerFamily::Gcc, "linux", "x86_64")};
|
||||
build(project);
|
||||
Void::Testing::expect_eq(project.targets().size(), std::size_t{7});
|
||||
Void::Testing::expect_eq(project.targets().size(), std::size_t{13});
|
||||
Void::Testing::expect_eq(project.targets().at(0).name, std::string{"VoidBuildSdk"});
|
||||
Void::Testing::expect_eq(project.targets().at(0).sources.at(0).path,
|
||||
std::string{"src/Build.cpp"});
|
||||
@@ -68,7 +68,14 @@ Void::Testing::Test example_records_sources_links_and_pin() {
|
||||
Void::Testing::expect_eq(project.targets().at(5).name, std::string{"vbs-registry"});
|
||||
Void::Testing::expect_eq(project.targets().at(6).name, std::string{"vbs_self_smoke"});
|
||||
Void::Testing::expect_eq(project.targets().at(6).kind, Void::Build::TargetKind::Test);
|
||||
Void::Testing::expect_eq(project.targets().at(7).name, std::string{"vbs_benchmarks"});
|
||||
Void::Testing::expect_eq(project.targets().at(8).name, std::string{"vbs_sdk_tests"});
|
||||
Void::Testing::expect_eq(project.targets().at(8).kind, Void::Build::TargetKind::Test);
|
||||
Void::Testing::expect_eq(project.targets().at(9).name, std::string{"vbs_core_tests"});
|
||||
Void::Testing::expect_eq(project.targets().at(10).name, std::string{"vbs_v1_tests"});
|
||||
Void::Testing::expect_eq(project.targets().at(11).name, std::string{"vbs_registry_tests"});
|
||||
Void::Testing::expect_eq(project.targets().at(12).name, std::string{"vbs_selfhost_tests"});
|
||||
Void::Testing::expect_eq(project.dependencies().at(0).revision,
|
||||
std::string{"3e254055e081a104f08df68dde39711bc7813518"});
|
||||
Void::Testing::expect_eq(project.dependencies().at(0).builder, std::string{"cmake"});
|
||||
Void::Testing::expect_eq(project.dependencies().at(0).builder, std::string{"native"});
|
||||
}
|
||||
+102
-15
@@ -83,10 +83,25 @@ void write_raw_tar(const std::filesystem::path &tar_path,
|
||||
out.write(end.data(), 1024);
|
||||
}
|
||||
|
||||
std::filesystem::path locate_vbs_binary() {
|
||||
std::error_code ec;
|
||||
if (const auto self = std::filesystem::read_symlink("/proc/self/exe", ec);
|
||||
!ec && !self.empty()) {
|
||||
const auto sibling = self.parent_path() / "vbs";
|
||||
if (std::filesystem::exists(sibling, ec)) {
|
||||
return sibling;
|
||||
}
|
||||
}
|
||||
if (!Bootstrap::binary_dir.empty()) {
|
||||
return std::filesystem::path{Bootstrap::binary_dir} / "bin" / "vbs";
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// === Plan 09: CompDB projection, selection ticket races, user-file preservation, recovery ===
|
||||
Void::Testing::Test compdb_projection_ticket_races_and_user_file_preservation() {
|
||||
VOID_TEST(FullV1Tests, compdb_projection_ticket_races_and_user_file_preservation) {
|
||||
Void::FileSystem::TempDir tmp{"vbs_compdb_"};
|
||||
const auto proj = tmp / "proj";
|
||||
const auto build_dir = tmp / "build";
|
||||
@@ -193,7 +208,7 @@ Void::Testing::Test compdb_projection_ticket_races_and_user_file_preservation()
|
||||
}
|
||||
|
||||
// === Plan 10: Inotify watcher + strict MetadataOnly watch boundary ===
|
||||
Void::Testing::Test watcher_inotify_and_metadata_only_forbids_foreign_configure() {
|
||||
VOID_TEST(FullV1Tests, watcher_inotify_and_metadata_only_forbids_foreign_configure) {
|
||||
Void::FileSystem::TempDir tmp{"vbs_watch_"};
|
||||
const auto proj = tmp / "proj";
|
||||
const auto build_dir = tmp / "build";
|
||||
@@ -246,7 +261,7 @@ void build(Void::Build::Project &p) {
|
||||
}
|
||||
|
||||
// === Plan 11: TOML 1.0, PubGrub solver (with exhaustive oracle), atomic CAS lockfile ===
|
||||
Void::Testing::Test toml_solver_oracle_and_atomic_cas_lockfile() {
|
||||
VOID_TEST(FullV1Tests, toml_solver_oracle_and_atomic_cas_lockfile) {
|
||||
Void::FileSystem::TempDir tmp{"vbs_pkg_"};
|
||||
const auto toml_file = tmp / "vbs.deps.toml";
|
||||
write_file(toml_file, R"toml(
|
||||
@@ -385,7 +400,7 @@ features = ["header-only"]
|
||||
}
|
||||
|
||||
// === Plan 12: Deterministic tar, malicious archive security, binary ABI matching, redaction ===
|
||||
Void::Testing::Test archive_security_determinism_binary_abi_and_redaction() {
|
||||
VOID_TEST(FullV1Tests, archive_security_determinism_binary_abi_and_redaction) {
|
||||
Void::FileSystem::TempDir tmp{"vbs_arc_"};
|
||||
const auto proj = tmp / "pkg_src";
|
||||
write_file(proj / "build.cpp", "void build(Void::Build::Project&) {}\n");
|
||||
@@ -443,7 +458,7 @@ Void::Testing::Test archive_security_determinism_binary_abi_and_redaction() {
|
||||
|
||||
// === Plan 13, 14, 15: Real CMake provider, Meson provider, VbsDeps.cmake bridge, Install/Relocate
|
||||
// ===
|
||||
Void::Testing::Test foreign_cmake_meson_providers_bridge_and_relocatable_install() {
|
||||
VOID_TEST(FullV1Tests, foreign_cmake_meson_providers_bridge_and_relocatable_install) {
|
||||
Void::FileSystem::TempDir tmp{"vbs_foreign_"};
|
||||
auto ctx = default_profiles().resolve("debug", CompilerFamily::Gcc, Toolchain::host_os_name(),
|
||||
Toolchain::host_architecture_name());
|
||||
@@ -615,10 +630,11 @@ static_library('m_helper', 'src/helper.cpp', include_directories: inc)
|
||||
Void::Testing::expect(!std::filesystem::exists(prefix_b / "lib" / "libwrap.a"));
|
||||
|
||||
// 5. Real CMake Bridge (VbsDeps.cmake) consumer test!
|
||||
const auto vbs_bin = std::filesystem::path{Bootstrap::binary_dir} / "bin" / "vbs";
|
||||
const auto vbs_bin = locate_vbs_binary();
|
||||
const auto bridge_module =
|
||||
std::filesystem::path{Bootstrap::source_dir} / "cmake" / "bridge" / "VbsDeps.cmake";
|
||||
if (std::filesystem::exists(vbs_bin) && Platform::resolve_executable("cmake").has_value()) {
|
||||
if (!vbs_bin.empty() && std::filesystem::exists(vbs_bin) &&
|
||||
Platform::resolve_executable("cmake").has_value()) {
|
||||
const auto br_proj = tmp / "bridge_consumer";
|
||||
write_file(br_proj / "CMakeLists.txt",
|
||||
"cmake_minimum_required(VERSION 4.0)\n"
|
||||
@@ -691,7 +707,7 @@ void build(Void::Build::Project &p) {
|
||||
|
||||
// === Plan 08: Modern C++ (GCC16 P1689 named modules + partitions, cycle/dup checks, unity, PCH)
|
||||
// ===
|
||||
Void::Testing::Test modern_cpp_modules_scan_collation_cycles_and_unity_exclusion() {
|
||||
VOID_TEST(FullV1Tests, modern_cpp_modules_scan_collation_cycles_and_unity_exclusion) {
|
||||
Void::FileSystem::TempDir tmp{"vbs_mod_"};
|
||||
auto ctx = default_profiles().resolve("debug", CompilerFamily::Gcc, Toolchain::host_os_name(),
|
||||
Toolchain::host_architecture_name());
|
||||
@@ -797,7 +813,7 @@ Void::Testing::Test modern_cpp_modules_scan_collation_cycles_and_unity_exclusion
|
||||
}
|
||||
|
||||
// === Plan 04/08/19 Matrix: Clang 23 target toolchain probe, build, and P1689 module scan ===
|
||||
Void::Testing::Test clang23_target_toolchain_and_p1689_module_scan() {
|
||||
VOID_TEST(FullV1Tests, clang23_target_toolchain_and_p1689_module_scan) {
|
||||
if (!Platform::resolve_executable("clang++").has_value()) {
|
||||
return; // Only skip if Clang is genuinely absent from PATH.
|
||||
}
|
||||
@@ -899,7 +915,7 @@ Void::Testing::Test clang23_target_toolchain_and_p1689_module_scan() {
|
||||
}
|
||||
|
||||
// === Plan 08 Full Graph Integration: Modules+Partitions, Unity+PerFile, HeaderUnit, Sanitizers ===
|
||||
Void::Testing::Test graph_lowering_modules_partitions_unity_header_units_and_sanitizers() {
|
||||
VOID_TEST(FullV1Tests, graph_lowering_modules_partitions_unity_header_units_and_sanitizers) {
|
||||
Void::FileSystem::TempDir tmp{"vbs_plan08_"};
|
||||
auto ctx = default_profiles().resolve("debug", CompilerFamily::Gcc, Toolchain::host_os_name(),
|
||||
Toolchain::host_architecture_name());
|
||||
@@ -1057,7 +1073,7 @@ Void::Testing::Test graph_lowering_modules_partitions_unity_header_units_and_san
|
||||
|
||||
// === Plan 20 Slice 1: Bounded native CMake graph translation, equivalence, mutations & fallback
|
||||
// ===
|
||||
Void::Testing::Test plan20_bounded_cmake_translation_equivalence_mutations_and_fallback() {
|
||||
VOID_TEST(FullV1Tests, plan20_bounded_cmake_translation_equivalence_mutations_and_fallback) {
|
||||
Void::FileSystem::TempDir tmp{"vbs_plan20_"};
|
||||
auto ctx = default_profiles().resolve("debug", CompilerFamily::Gcc, Toolchain::host_os_name(),
|
||||
Toolchain::host_architecture_name());
|
||||
@@ -1217,7 +1233,7 @@ target_include_directories(p20_genlib PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
// === Plan 20 Slice 2A: Bounded native Meson graph translation + unsupported custom_target fallback
|
||||
// ===
|
||||
Void::Testing::Test plan20_bounded_meson_translation_equivalence_and_fallback() {
|
||||
VOID_TEST(FullV1Tests, plan20_bounded_meson_translation_equivalence_and_fallback) {
|
||||
if (!Platform::resolve_executable("meson").has_value()) {
|
||||
return;
|
||||
}
|
||||
@@ -1332,9 +1348,9 @@ static_library('mgenlib', ['src/gen.cpp', gen])
|
||||
}
|
||||
|
||||
// === Wave 8 DX CLI: vbs init -> vbs test -> vbs graph -> vbs doctor -> vbs clean ===
|
||||
Void::Testing::Test cli_init_graph_clean_doctor_end_to_end() {
|
||||
const auto vbs_bin = std::filesystem::path{Bootstrap::binary_dir} / "bin" / "vbs";
|
||||
if (!std::filesystem::exists(vbs_bin)) {
|
||||
VOID_TEST(FullV1Tests, cli_init_graph_clean_doctor_end_to_end) {
|
||||
const auto vbs_bin = locate_vbs_binary();
|
||||
if (vbs_bin.empty() || !std::filesystem::exists(vbs_bin)) {
|
||||
return;
|
||||
}
|
||||
Void::FileSystem::TempDir tmp{"vbs_dx_"};
|
||||
@@ -1399,3 +1415,74 @@ Void::Testing::Test cli_init_graph_clean_doctor_end_to_end() {
|
||||
Void::Testing::expect(r_clean_all.has_value() && r_clean_all->succeeded());
|
||||
Void::Testing::expect(!std::filesystem::exists(bdir));
|
||||
}
|
||||
|
||||
// === Track A1: Native VBS subproject dependency (builder == "native", zero CMake!) ===
|
||||
VOID_TEST(FullV1Tests, native_vbs_subproject_dependency_builds_without_cmake) {
|
||||
const auto vbs_bin = locate_vbs_binary();
|
||||
Void::Testing::expect(!vbs_bin.empty() && std::filesystem::exists(vbs_bin));
|
||||
if (vbs_bin.empty() || !std::filesystem::exists(vbs_bin)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Void::FileSystem::TempDir tmp{"vbs_native_subproj_"};
|
||||
const auto trap_bin = tmp / "trap_bin";
|
||||
write_file(trap_bin / "cmake",
|
||||
"#!/bin/sh\necho 'FORBIDDEN CMAKE INVOCATION IN NATIVE DEP BUILD' >&2\nexit 99\n");
|
||||
std::filesystem::permissions(trap_bin / "cmake", std::filesystem::perms::owner_exec |
|
||||
std::filesystem::perms::owner_read |
|
||||
std::filesystem::perms::owner_write |
|
||||
std::filesystem::perms::group_exec |
|
||||
std::filesystem::perms::others_exec);
|
||||
|
||||
std::string trapped_path = trap_bin.string();
|
||||
if (const char *old_path = std::getenv("PATH")) {
|
||||
trapped_path += ":";
|
||||
trapped_path += old_path;
|
||||
}
|
||||
|
||||
// Pure `build.cpp` library dependency (NO CMakeLists.txt!).
|
||||
const auto dep_dir = tmp / "sub_math_dep";
|
||||
write_file(dep_dir / "build.cpp", R"cpp(#include <Void/Build.hpp>
|
||||
void build(Void::Build::Project &p) {
|
||||
auto lib = p.static_library("sub_math");
|
||||
lib.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
||||
.sources({"src/math.cpp"})
|
||||
.include_directory("include", Void::Build::Visibility::Public);
|
||||
}
|
||||
)cpp");
|
||||
write_file(dep_dir / "include" / "sub_math.hpp", "#pragma once\nint sub_math_answer();\n");
|
||||
write_file(dep_dir / "src" / "math.cpp",
|
||||
"#include \"sub_math.hpp\"\nint sub_math_answer() { return 42; }\n");
|
||||
|
||||
const auto cons_dir = tmp / "consumer";
|
||||
const auto cons_build = tmp / "consumer_build";
|
||||
write_file(cons_dir / "build.cpp",
|
||||
"#include <Void/Build.hpp>\n"
|
||||
"void build(Void::Build::Project &p) {\n"
|
||||
" auto dep = p.dependency(\"math\").path(\"" +
|
||||
dep_dir.string() +
|
||||
"\").native_builder();\n"
|
||||
" p.test(\"consumer_test\")\n"
|
||||
" .cxx_standard(Void::Build::CxxStandard::Cxx26)\n"
|
||||
" .sources({\"tests/main.cpp\"})\n"
|
||||
" .link(dep.target(\"sub_math\"));\n"
|
||||
"}\n");
|
||||
write_file(
|
||||
cons_dir / "tests" / "main.cpp",
|
||||
"#include \"sub_math.hpp\"\nint main() { return sub_math_answer() == 42 ? 0 : 1; }\n");
|
||||
|
||||
Platform::ProcessRequest req;
|
||||
req.executable = vbs_bin;
|
||||
req.arguments = {"test", "--project", cons_dir.string(), "--build-dir", cons_build.string()};
|
||||
req.environment.set_vars["PATH"] = trapped_path;
|
||||
req.timeout = std::chrono::seconds{120};
|
||||
auto res = Platform::run_supervised(req);
|
||||
Void::Testing::expect_eq(
|
||||
res ? (res->succeeded() ? std::string{} : (res->stdout_data + res->stderr_data))
|
||||
: res.error().message(),
|
||||
std::string{});
|
||||
Void::Testing::expect(res.has_value() && res->succeeded());
|
||||
if (res) {
|
||||
Void::Testing::expect(res->stdout_data.find("PASSED 'consumer_test'") != std::string::npos);
|
||||
}
|
||||
}
|
||||
+20
-5
@@ -43,9 +43,24 @@ std::string extract_json_str(std::string_view json, const std::string &key) {
|
||||
return s ? *s : std::string{};
|
||||
}
|
||||
|
||||
std::filesystem::path locate_vbs_binary() {
|
||||
std::error_code ec;
|
||||
if (const auto self = std::filesystem::read_symlink("/proc/self/exe", ec);
|
||||
!ec && !self.empty()) {
|
||||
const auto sibling = self.parent_path() / "vbs";
|
||||
if (std::filesystem::exists(sibling, ec)) {
|
||||
return sibling;
|
||||
}
|
||||
}
|
||||
if (!Bootstrap::binary_dir.empty()) {
|
||||
return std::filesystem::path{Bootstrap::binary_dir} / "bin" / "vbs";
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Void::Testing::Test registry_rbac_immutability_csrf_xss_web_and_backup_restore() {
|
||||
VOID_TEST(RegistryTests, registry_rbac_immutability_csrf_xss_web_and_backup_restore) {
|
||||
Void::FileSystem::TempDir tmp{"vbs_reg_"};
|
||||
RegistryConfig cfg;
|
||||
cfg.data_dir = tmp / "data";
|
||||
@@ -202,10 +217,10 @@ Void::Testing::Test registry_rbac_immutability_csrf_xss_web_and_backup_restore()
|
||||
|
||||
// End-to-end live client <-> server test: `vbs publish` -> `vbs deps resolve` -> `vbs build
|
||||
// --locked`!
|
||||
Void::Testing::Test cli_publish_deps_resolve_and_locked_build_against_live_registry() {
|
||||
const auto vbs_bin = std::filesystem::path{Bootstrap::binary_dir} / "bin" / "vbs";
|
||||
Void::Testing::expect(std::filesystem::exists(vbs_bin));
|
||||
if (!std::filesystem::exists(vbs_bin)) {
|
||||
VOID_TEST(RegistryTests, cli_publish_deps_resolve_and_locked_build_against_live_registry) {
|
||||
const auto vbs_bin = locate_vbs_binary();
|
||||
Void::Testing::expect(!vbs_bin.empty() && std::filesystem::exists(vbs_bin));
|
||||
if (vbs_bin.empty() || !std::filesystem::exists(vbs_bin)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+14
-14
@@ -23,7 +23,7 @@ const Json &element(const Json &value, std::size_t index) {
|
||||
std::string text(const Json &value) { return std::get<std::string>(value.value); }
|
||||
} // namespace
|
||||
|
||||
Void::Testing::Test default_profiles_and_overrides() {
|
||||
VOID_TEST(SdkDeclarations, default_profiles_and_overrides) {
|
||||
const auto profiles = Void::Build::default_profiles();
|
||||
const auto debug =
|
||||
profiles.resolve("debug", Void::Build::CompilerFamily::Clang, "linux", "aarch64");
|
||||
@@ -36,7 +36,7 @@ Void::Testing::Test default_profiles_and_overrides() {
|
||||
Void::Testing::expect_eq(release.compile_options.at(0), std::string{"-O3"});
|
||||
}
|
||||
|
||||
Void::Testing::Test rejects_invalid_profiles() {
|
||||
VOID_TEST(SdkDeclarations, rejects_invalid_profiles) {
|
||||
auto profiles = Void::Build::default_profiles();
|
||||
Void::Testing::expect_throw<std::invalid_argument>([&] { profiles.add("debug"); });
|
||||
Void::Testing::expect_throw<std::invalid_argument>([&] { profiles.add(""); });
|
||||
@@ -50,7 +50,7 @@ Void::Testing::Test rejects_invalid_profiles() {
|
||||
[&] { (void)profiles.resolve("debug", Void::Build::CompilerFamily::Gcc, "", "x86_64"); });
|
||||
}
|
||||
|
||||
Void::Testing::Test declaration_records_and_visibility() {
|
||||
VOID_TEST(SdkDeclarations, declaration_records_and_visibility) {
|
||||
Void::Build::Project project{context()};
|
||||
auto library = project.static_library("library");
|
||||
library.sources({"one.cpp", "two.cpp"})
|
||||
@@ -68,7 +68,7 @@ Void::Testing::Test declaration_records_and_visibility() {
|
||||
Void::Build::Visibility::Interface);
|
||||
}
|
||||
|
||||
Void::Testing::Test sources_are_symbolic() {
|
||||
VOID_TEST(SdkDeclarations, sources_are_symbolic) {
|
||||
Void::Build::Project project{context()};
|
||||
auto target = project.executable("symbolic");
|
||||
target.sources({"missing/../literal.cpp"}).sources(project.glob("nonexistent/**/*.cpp"));
|
||||
@@ -80,7 +80,7 @@ Void::Testing::Test sources_are_symbolic() {
|
||||
std::string{"nonexistent/**/*.cpp"});
|
||||
}
|
||||
|
||||
Void::Testing::Test handles_survive_record_growth() {
|
||||
VOID_TEST(SdkDeclarations, handles_survive_record_growth) {
|
||||
Void::Build::Project project{context()};
|
||||
auto library = project.static_library("first");
|
||||
auto dependency = project.dependency("original");
|
||||
@@ -100,7 +100,7 @@ Void::Testing::Test handles_survive_record_growth() {
|
||||
Void::Testing::expect_eq(project.dependencies().front().revision, std::string{revision});
|
||||
}
|
||||
|
||||
Void::Testing::Test rejects_cross_project_links() {
|
||||
VOID_TEST(SdkDeclarations, rejects_cross_project_links) {
|
||||
Void::Build::Project first{context()};
|
||||
Void::Build::Project second{context()};
|
||||
auto app = first.executable("app");
|
||||
@@ -111,7 +111,7 @@ Void::Testing::Test rejects_cross_project_links() {
|
||||
Void::Testing::expect(app.record().links.empty());
|
||||
}
|
||||
|
||||
Void::Testing::Test rejects_expired_handles_and_owner_moves() {
|
||||
VOID_TEST(SdkDeclarations, rejects_expired_handles_and_owner_moves) {
|
||||
static_assert(!std::is_move_constructible_v<Void::Build::Project>);
|
||||
static_assert(!std::is_copy_constructible_v<Void::Build::Project>);
|
||||
std::optional<Void::Build::Target> target;
|
||||
@@ -132,7 +132,7 @@ Void::Testing::Test rejects_expired_handles_and_owner_moves() {
|
||||
Void::Testing::expect_throw<std::logic_error>([&] { app.link(*imported); });
|
||||
}
|
||||
|
||||
Void::Testing::Test rejects_empty_and_duplicate_identifiers() {
|
||||
VOID_TEST(SdkDeclarations, rejects_empty_and_duplicate_identifiers) {
|
||||
Void::Build::Project project{context()};
|
||||
auto app = project.executable("app");
|
||||
auto dep = project.dependency("dep");
|
||||
@@ -149,7 +149,7 @@ Void::Testing::Test rejects_empty_and_duplicate_identifiers() {
|
||||
Void::Testing::expect_throw<std::invalid_argument>([&] { (void)project.glob(""); });
|
||||
}
|
||||
|
||||
Void::Testing::Test rejects_contradictory_providers() {
|
||||
VOID_TEST(SdkDeclarations, rejects_contradictory_providers) {
|
||||
Void::Build::Project project{context()};
|
||||
auto git = project.dependency("git");
|
||||
git.git("https://example.invalid/repo", Void::Build::Commit{revision}).cmake();
|
||||
@@ -170,7 +170,7 @@ Void::Testing::Test rejects_contradictory_providers() {
|
||||
Void::Testing::expect_throw<std::invalid_argument>([&] { (void)project.to_json(); });
|
||||
}
|
||||
|
||||
Void::Testing::Test json_schema_types_and_escaping() {
|
||||
VOID_TEST(SdkDeclarations, json_schema_types_and_escaping) {
|
||||
Void::Build::Project project{context()};
|
||||
std::string escaped = "quote\" slash\\ newline\n\r\t";
|
||||
for (char c = 0; c < 32; ++c)
|
||||
@@ -218,7 +218,7 @@ Void::Testing::Test json_schema_types_and_escaping() {
|
||||
std::string{"org/pkg"});
|
||||
}
|
||||
|
||||
Void::Testing::Test json_preserves_valid_utf8() {
|
||||
VOID_TEST(SdkDeclarations, json_preserves_valid_utf8) {
|
||||
// Boundary scalar values for every UTF-8 width, including either side of surrogates.
|
||||
const std::string unicode = "ASCII \xc2\x80\xdf\xbf\xe0\xa0\x80\xed\x9f\xbf"
|
||||
"\xee\x80\x80\xef\xbf\xbf\xf0\x90\x80\x80\xf4\x8f\xbf\xbf";
|
||||
@@ -240,7 +240,7 @@ Void::Testing::Test json_preserves_valid_utf8() {
|
||||
Void::Testing::expect_eq(text(member(options, unicode)), unicode);
|
||||
}
|
||||
|
||||
Void::Testing::Test json_rejects_malformed_utf8() {
|
||||
VOID_TEST(SdkDeclarations, json_rejects_malformed_utf8) {
|
||||
const std::vector<std::string> invalid{
|
||||
"\x80", "\xbf", "\xc0\x80", "\xc1\xbf", "\xc2",
|
||||
"\xc2 ", "\xe0\x80\x80", "\xe0\x9f\xbf", "\xe1\x80", "\xe1 \x80",
|
||||
@@ -276,7 +276,7 @@ Void::Testing::Test json_rejects_malformed_utf8() {
|
||||
}
|
||||
}
|
||||
|
||||
Void::Testing::Test independent_projects_and_contexts() {
|
||||
VOID_TEST(SdkDeclarations, independent_projects_and_contexts) {
|
||||
auto initial = context();
|
||||
Void::Build::Project first{initial};
|
||||
initial.name = "mutated";
|
||||
@@ -289,7 +289,7 @@ Void::Testing::Test independent_projects_and_contexts() {
|
||||
Void::Testing::expect(first.to_json() != second.to_json());
|
||||
}
|
||||
|
||||
Void::Testing::Test rejects_option_errors_without_mutation() {
|
||||
VOID_TEST(SdkDeclarations, rejects_option_errors_without_mutation) {
|
||||
Void::Build::Project project{context()};
|
||||
auto dep = project.dependency("library");
|
||||
Void::Testing::expect_throw<std::invalid_argument>([&] { dep.cmake({{"", true}}); });
|
||||
|
||||
+156
-13
@@ -9,6 +9,8 @@
|
||||
#include <Void/Build/SelfHost/TestRegistryGen.hpp>
|
||||
#include <Void/Build/State/StateStore.hpp>
|
||||
#include <Void/Build/Toolchain/Driver.hpp>
|
||||
#include <Void/Build/Util/Sha256.hpp>
|
||||
#include <Void/Configuration/Env.hpp>
|
||||
#include <Void/System/TempDir.hpp>
|
||||
#include <Void/Testing/Assert.hpp>
|
||||
#include <Void/Testing/Test.hpp>
|
||||
@@ -25,10 +27,38 @@ void write_file(const std::filesystem::path &path, std::string_view content) {
|
||||
auto r = Platform::atomic_write_file(path, content, false);
|
||||
Void::Testing::expect(r.has_value());
|
||||
}
|
||||
|
||||
std::filesystem::path locate_void_source_dir() {
|
||||
if (auto env = Void::Configuration::get_env("VBS_VOID_SOURCE_DIR");
|
||||
env && !env->empty() && std::filesystem::is_directory(*env)) {
|
||||
return std::filesystem::path{*env};
|
||||
}
|
||||
#ifdef VBS_VOID_SOURCE_PATH
|
||||
if (std::filesystem::is_directory(std::filesystem::path{VBS_VOID_SOURCE_PATH})) {
|
||||
return std::filesystem::path{VBS_VOID_SOURCE_PATH};
|
||||
}
|
||||
#endif
|
||||
return std::filesystem::path{Bootstrap::source_dir} / "build" / "voidlibrary-pinned";
|
||||
}
|
||||
|
||||
std::filesystem::path locate_vbs_binary() {
|
||||
std::error_code ec;
|
||||
if (const auto self = std::filesystem::read_symlink("/proc/self/exe", ec);
|
||||
!ec && !self.empty()) {
|
||||
const auto sibling = self.parent_path() / "vbs";
|
||||
if (std::filesystem::exists(sibling, ec)) {
|
||||
return sibling;
|
||||
}
|
||||
}
|
||||
if (!Bootstrap::binary_dir.empty()) {
|
||||
return std::filesystem::path{Bootstrap::binary_dir} / "bin" / "vbs";
|
||||
}
|
||||
return {};
|
||||
}
|
||||
} // namespace
|
||||
|
||||
// Plan 18: Native non-CMake Void::Testing scanner avoids equal-basename collisions!
|
||||
Void::Testing::Test native_test_registration_generator_avoids_basename_collisions() {
|
||||
VOID_TEST(SelfHostTests, native_test_registration_generator_avoids_basename_collisions) {
|
||||
Void::FileSystem::TempDir tmp{"vbs_testgen_"};
|
||||
const auto f1 = tmp / "dir_a" / "SameStem.cpp";
|
||||
const auto f2 = tmp / "dir_b" / "SameStem.cpp";
|
||||
@@ -50,8 +80,8 @@ Void::Testing::Test native_test_registration_generator_avoids_basename_collision
|
||||
|
||||
// Plan 18: Strict native VoidLibrary closure + native VBS SDK + native test runner built
|
||||
// completely WITHOUT CMake (trapped cmake shim ahead of PATH!) in a clean stage directory!
|
||||
Void::Testing::Test strict_native_selfhost_voidlibrary_and_sdk_without_cmake() {
|
||||
const std::filesystem::path void_src{VBS_VOID_SOURCE_PATH};
|
||||
VOID_TEST(SelfHostTests, strict_native_selfhost_voidlibrary_and_sdk_without_cmake) {
|
||||
const auto void_src = locate_void_source_dir();
|
||||
Void::Testing::expect(std::filesystem::is_directory(void_src));
|
||||
|
||||
Void::FileSystem::TempDir tmp{"vbs_selfhost_"};
|
||||
@@ -85,17 +115,13 @@ Void::Testing::Test strict_native_selfhost_voidlibrary_and_sdk_without_cmake() {
|
||||
.include_directory((vbs_root / "include").string(), Visibility::Public)
|
||||
.compile_option("-freflection", Visibility::Public);
|
||||
|
||||
// Generate native C++ test registrations for SdkDeclarations.cpp (NO CMake scanner!).
|
||||
// Compile self-registering VL-009 VOID_TEST suite SdkDeclarations.cpp directly (zero CMake,
|
||||
// zero external test scanner!).
|
||||
const auto test_src = vbs_root / "tests" / "SdkDeclarations.cpp";
|
||||
auto reg = SelfHost::generate_test_registration_unit(test_src, stage1_dir / "gen_tests");
|
||||
Void::Testing::expect(reg.has_value() && reg->cases.size() >= 14);
|
||||
if (!reg)
|
||||
return;
|
||||
|
||||
auto native_tests = proj.executable("stage1_sdk_tests");
|
||||
native_tests.cxx_standard(CxxStandard::Cxx26)
|
||||
.sources(SourceSet::file(test_src.string()))
|
||||
.sources(SourceSet::file(reg->generated_cpp.string()))
|
||||
.link(sdk)
|
||||
.link(void_libs.modules.at("Testing"))
|
||||
.link(void_libs.modules.at("Data"));
|
||||
@@ -230,8 +256,8 @@ int main() {
|
||||
// VoidBuildSdk + VoidBuildCore + stage-isolated BootstrapConfig.hpp, ZERO CMake!) into stage1_dir,
|
||||
// then executes that freshly self-hosted `stage1/bin/vbs` binary WITH TRAPPED `cmake` ON PATH to
|
||||
// build and test a real Stage 2 C++ project!
|
||||
Void::Testing::Test strict_native_full_vbs_stage1_to_stage2_without_cmake() {
|
||||
const std::filesystem::path void_src{VBS_VOID_SOURCE_PATH};
|
||||
VOID_TEST(SelfHostTests, strict_native_full_vbs_stage1_to_stage2_without_cmake) {
|
||||
const auto void_src = locate_void_source_dir();
|
||||
const std::filesystem::path vbs_root{Bootstrap::source_dir};
|
||||
Void::Testing::expect(std::filesystem::is_directory(void_src));
|
||||
|
||||
@@ -342,8 +368,8 @@ void build(Void::Build::Project &p) {
|
||||
|
||||
// VL-009: Verify VoidLibrary's upstream self-registering `VOID_TEST(suite, name)` macro works
|
||||
// purely with `g++` (zero CMake AND zero external scanner) including equal-basename files!
|
||||
Void::Testing::Test native_void_test_macro_zero_cmake_and_basename_collisions() {
|
||||
const std::filesystem::path void_src{VBS_VOID_SOURCE_PATH};
|
||||
VOID_TEST(SelfHostTests, native_void_test_macro_zero_cmake_and_basename_collisions) {
|
||||
const auto void_src = locate_void_source_dir();
|
||||
Void::Testing::expect(std::filesystem::is_directory(void_src));
|
||||
|
||||
Void::FileSystem::TempDir tmp{"vbs_vl009_"};
|
||||
@@ -434,3 +460,120 @@ VOID_TEST(BetaSuite, multiplication_works) {
|
||||
Void::Testing::expect(ran->stdout_data.find("2 tests:") != std::string::npos);
|
||||
}
|
||||
}
|
||||
|
||||
// Track A3: Reproducible bit-identical artifacts across distinct build directories!
|
||||
VOID_TEST(SelfHostTests, reproducible_stage2_equals_stage3_artifacts_across_build_dirs) {
|
||||
const auto vbs_bin = locate_vbs_binary();
|
||||
Void::Testing::expect(!vbs_bin.empty() && std::filesystem::exists(vbs_bin));
|
||||
if (vbs_bin.empty() || !std::filesystem::exists(vbs_bin)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Void::FileSystem::TempDir tmp{"vbs_repro_"};
|
||||
const auto trap_bin = tmp / "trap_bin";
|
||||
write_file(trap_bin / "cmake",
|
||||
"#!/bin/sh\necho 'FORBIDDEN CMAKE INVOCATION IN REPRO STAGE' >&2\nexit 99\n");
|
||||
(void)::chmod((trap_bin / "cmake").c_str(), 0755);
|
||||
|
||||
std::string trapped_path = trap_bin.string();
|
||||
if (const char *old_path = std::getenv("PATH")) {
|
||||
trapped_path += ":";
|
||||
trapped_path += old_path;
|
||||
}
|
||||
|
||||
const auto proj = tmp / "repro_proj";
|
||||
write_file(proj / "build.profiles.cpp", R"cpp(#include <Void/Build.hpp>
|
||||
void profiles(Void::Build::Profiles &p) {
|
||||
Void::Build::ProfileDescription d;
|
||||
d.name = "debug";
|
||||
d.compile_options = {"-O0", "-g"};
|
||||
d.reproducibility_epoch = 1700000000;
|
||||
p.define(std::move(d));
|
||||
}
|
||||
)cpp");
|
||||
write_file(proj / "build.cpp", R"cpp(#include <Void/Build.hpp>
|
||||
void build(Void::Build::Project &p) {
|
||||
auto gen = p.custom_action("gen_ver");
|
||||
gen.command({"/bin/sh", "-c",
|
||||
"mkdir -p \"$GEN\" && printf '#pragma once\\ninline constexpr int kVer = 7;\\n' "
|
||||
"> \"$GEN/gen_ver.hpp\""})
|
||||
.outputs({"gen_ver.hpp"});
|
||||
|
||||
auto lib = p.static_library("repro_lib");
|
||||
lib.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
||||
.sources({"src/lib.cpp"})
|
||||
.include_directory("include", Void::Build::Visibility::Public);
|
||||
|
||||
auto app = p.executable("repro_app");
|
||||
app.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
||||
.sources({"src/main.cpp"})
|
||||
.depends_on(gen)
|
||||
.include_directory("$GEN/", Void::Build::Visibility::Private)
|
||||
.link(lib);
|
||||
}
|
||||
)cpp");
|
||||
write_file(proj / "include" / "repro.hpp", "#pragma once\nint repro_fn();\n");
|
||||
write_file(proj / "src" / "lib.cpp", R"cpp(#include "repro.hpp"
|
||||
namespace {
|
||||
int local_helper() { return 35; }
|
||||
struct AutoInit { int v{local_helper()}; };
|
||||
const AutoInit g_init{};
|
||||
} // namespace
|
||||
int repro_fn() { return g_init.v; }
|
||||
)cpp");
|
||||
write_file(proj / "src" / "main.cpp", R"cpp(#include "repro.hpp"
|
||||
#include "gen_ver.hpp"
|
||||
#include <iostream>
|
||||
int main() {
|
||||
std::cout << (repro_fn() + kVer) << "|" << __DATE__ << "|" << __FILE__ << "\n";
|
||||
return 0;
|
||||
}
|
||||
)cpp");
|
||||
|
||||
const auto stage_a = tmp / "stage_a";
|
||||
const auto stage_b = tmp / "stage_b";
|
||||
|
||||
auto build_stage = [&](const std::filesystem::path &bdir) {
|
||||
Platform::ProcessRequest req;
|
||||
req.executable = vbs_bin;
|
||||
req.arguments = {"build", "--project", proj.string(), "--build-dir",
|
||||
bdir.string(), "--profile", "debug", "--no-cache"};
|
||||
req.environment.set_vars["PATH"] = trapped_path;
|
||||
req.timeout = std::chrono::seconds{120};
|
||||
return Platform::run_supervised(req);
|
||||
};
|
||||
|
||||
auto ra = build_stage(stage_a);
|
||||
auto rb = build_stage(stage_b);
|
||||
Void::Testing::expect(ra.has_value() && ra->succeeded());
|
||||
Void::Testing::expect(rb.has_value() && rb->succeeded());
|
||||
if (!ra || !rb || !ra->succeeded() || !rb->succeeded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto lib_a = stage_a / "profiles" / "debug" / "out" / "librepro_lib.a";
|
||||
const auto lib_b = stage_b / "profiles" / "debug" / "out" / "librepro_lib.a";
|
||||
const auto exe_a = stage_a / "profiles" / "debug" / "out" / "bin" / "repro_app";
|
||||
const auto exe_b = stage_b / "profiles" / "debug" / "out" / "bin" / "repro_app";
|
||||
|
||||
auto sha_lib_a = Util::sha256_file_hex(lib_a);
|
||||
auto sha_lib_b = Util::sha256_file_hex(lib_b);
|
||||
auto sha_exe_a = Util::sha256_file_hex(exe_a);
|
||||
auto sha_exe_b = Util::sha256_file_hex(exe_b);
|
||||
Void::Testing::expect(sha_lib_a.has_value() && sha_lib_b.has_value());
|
||||
Void::Testing::expect(sha_exe_a.has_value() && sha_exe_b.has_value());
|
||||
if (sha_lib_a && sha_lib_b) {
|
||||
Void::Testing::expect_eq(*sha_lib_a, *sha_lib_b);
|
||||
}
|
||||
if (sha_exe_a && sha_exe_b) {
|
||||
Void::Testing::expect_eq(*sha_exe_a, *sha_exe_b);
|
||||
}
|
||||
|
||||
Platform::ProcessRequest run_a;
|
||||
run_a.executable = exe_a;
|
||||
auto out_a = Platform::run_supervised(run_a);
|
||||
Void::Testing::expect(out_a.has_value() && out_a->succeeded());
|
||||
if (out_a) {
|
||||
Void::Testing::expect(out_a->stdout_data.starts_with("42|"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user