From ce47c23cdaeb8ee988350c0ee256667ca1b59cb0 Mon Sep 17 00:00:00 2001 From: "Aleksei (Faumaray) Selikhov" Date: Sat, 5 Dec 2026 07:00:23 +0300 Subject: [PATCH] docs(migration): record the verified VoidLibrary VBS migration trial --- contrib/voidlibrary-migration/README.md | 28 ++++ .../build-support/vl/VoidLibraryModules.cpp | 125 ++++++++++++++++++ .../build-support/vl/VoidLibraryModules.hpp | 24 ++++ contrib/voidlibrary-migration/build.cpp | 20 +++ .../voidlibrary-migration/tests/vl/smoke.cpp | 6 + docs/agent-workflow/STATE.md | 2 + docs/agent-workflow/TASKS.md | 1 + docs/agent-workflow/VERIFICATION.md | 19 +++ docs/roadmap/22-superiority-and-gaps.md | 2 +- 9 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 contrib/voidlibrary-migration/README.md create mode 100644 contrib/voidlibrary-migration/build-support/vl/VoidLibraryModules.cpp create mode 100644 contrib/voidlibrary-migration/build-support/vl/VoidLibraryModules.hpp create mode 100644 contrib/voidlibrary-migration/build.cpp create mode 100644 contrib/voidlibrary-migration/tests/vl/smoke.cpp diff --git a/contrib/voidlibrary-migration/README.md b/contrib/voidlibrary-migration/README.md new file mode 100644 index 0000000..9628964 --- /dev/null +++ b/contrib/voidlibrary-migration/README.md @@ -0,0 +1,28 @@ +# VoidLibrary → VBS migration assets + +Verified against VoidLibrary `0002e74` in a separate clone (never the shared checkout). +VoidLibrary does not yet have a first-class build description; this is the trial that proves +VBS can build and test it natively. Tracked upstream as +[Void/Library#61](https://git.faumaray.com/Void/Library/issues/61). + +## Apply to a VoidLibrary clone + +```sh +cp -r contrib/voidlibrary-migration/. /path/to/VoidLibrary-clone/ +cd /path/to/VoidLibrary-clone +vbs build --project . --build-dir build-vbs --profile debug --target void_smoke +vbs test --project . --build-dir build-vbs --target void_smoke +``` + +`build-support/vl/VoidLibraryModules.{hpp,cpp}` is the native module closure (the same logic as +`recipes/VoidLibrary/VoidLibraryRecipe.cpp`), `build.cpp` declares the enabled module set, and +`tests/vl/smoke.cpp` is a runtime smoke test linked against the built modules. + +Keep the smoke test outside `build-support/`: the configuration frontend treats every +`build-support/**/*.cpp` as part of the build description itself. + +## Known limits + +- Only modules described by the native module table can be enabled; Net (Boost/OpenSSL), + Sqlite (SQLite3), Stacktrace (Boost + dl) and many others are missing. +- Use absolute `--project`/`--build-dir` paths when invoking `vbs` from outside the project root. diff --git a/contrib/voidlibrary-migration/build-support/vl/VoidLibraryModules.cpp b/contrib/voidlibrary-migration/build-support/vl/VoidLibraryModules.cpp new file mode 100644 index 0000000..a4e0b9f --- /dev/null +++ b/contrib/voidlibrary-migration/build-support/vl/VoidLibraryModules.cpp @@ -0,0 +1,125 @@ +#include "VoidLibraryModules.hpp" + +#include +#include +#include +#include +#include + +namespace Void::Build::Recipes { +namespace { + +struct ModuleDef { + std::vector internal_deps; + bool needs_threads{false}; +}; + +const std::map> &known_modules() { + static const std::map> kDefs = { + {"Core", {{}, false}}, + {"Functional", {{}, false}}, + {"Math", {{}, false}}, + {"Algorithms", {{"Core", "Math"}, false}}, + {"Memory", {{"Core"}, false}}, + {"Time", {{}, false}}, + {"Text", {{}, false}}, + {"Unicode", {{"Core", "Text"}, false}}, + {"LogState", {{}, false}}, + {"Data", {{"Core", "Math", "Time"}, false}}, + {"System", {{"Functional", "Time", "LogState"}, true}}, + {"Async", {{"Functional", "Time", "LogState"}, true}}, + {"Crypto", {{"Functional"}, false}}, + {"Archive", {{"Functional", "Time", "System"}, false}}, + {"Configuration", {{"Core", "Functional", "System", "Data", "Time", "LogState"}, true}}, + {"Log", {{"Async", "Core", "Data", "Functional", "Memory", "Time", "LogState"}, true}}, + {"Testing", + {{"Core", "Functional", "Time", "LogState", "Async", "Configuration", "Text"}, true}}, + }; + return kDefs; +} + +std::vector collect_sources(const std::filesystem::path &src_dir) { + std::vector files; + std::error_code ec; + if (!std::filesystem::is_directory(src_dir, ec)) { + return files; + } + for (const auto &ent : std::filesystem::recursive_directory_iterator(src_dir, ec)) { + if (ent.is_regular_file(ec) && ent.path().extension() == ".cpp") { + files.push_back(ent.path().lexically_normal().string()); + } + } + std::ranges::sort(files); + return files; +} + +} // namespace + +VoidLibraryTargets add_void_library_native(Project &project, + const std::filesystem::path &void_source_dir, + const std::vector &enabled_modules) { + const auto &defs = known_modules(); + + // Compute transitive module closure in deterministic topological order. + std::set visited; + std::vector topo; + auto visit = [&](auto &&self, const std::string &mod) -> void { + if (!visited.insert(mod).second) { + return; + } + const auto it = defs.find(mod); + if (it == defs.end()) { + throw std::invalid_argument{"VoidLibraryRecipe: unsupported native module '" + mod + + "'"}; + } + for (const auto &dep : it->second.internal_deps) { + self(self, dep); + } + topo.push_back(mod); + }; + for (const auto &mod : enabled_modules) { + visit(visit, mod); + } + + const auto include_dir = (void_source_dir / "include").lexically_normal().string(); + VoidLibraryTargets result; + + for (const auto &mod : topo) { + const auto &def = defs.at(mod); + const auto srcs = collect_sources(void_source_dir / "src" / mod); + const std::string target_name = "Void_" + mod; + + 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); + if (project.context().compiler == CompilerFamily::Gcc) { + tgt.compile_option("-freflection", Visibility::Public); + } + + for (const auto &s : srcs) { + tgt.sources(SourceSet::file(s)); + } + for (const auto &dep : def.internal_deps) { + tgt.link(result.modules.at(dep), Visibility::Public); + } + if (def.needs_threads) { + tgt.link_option("-pthread", Visibility::Public); + } + if (mod == "Crypto") { + tgt.define("VOID_CRYPTO_HAS_OPENSSL=0", Visibility::Public); + } + if (mod == "Archive") { + tgt.define("VOID_ARCHIVE_HAS_LIBARCHIVE=0", Visibility::Public); + } + if (mod == "Testing") { + tgt.define("VOID_HAS_ASYNC", Visibility::Public) + .define("VOID_HAS_CONFIGURATION", Visibility::Public) + .define("VOID_HAS_TEXT", Visibility::Public); + } + result.modules.emplace(mod, tgt); + } + + return result; +} + +} // namespace Void::Build::Recipes diff --git a/contrib/voidlibrary-migration/build-support/vl/VoidLibraryModules.hpp b/contrib/voidlibrary-migration/build-support/vl/VoidLibraryModules.hpp new file mode 100644 index 0000000..39e3e61 --- /dev/null +++ b/contrib/voidlibrary-migration/build-support/vl/VoidLibraryModules.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include + +#include +#include +#include +#include + +namespace Void::Build::Recipes { + +// Pure native VBS recipe for VoidLibrary (pinned commit 0002e74a7da94a756f55a4a5574d20b77736c185). +// Translates VoidLibrary's module closure directly into native VBS targets without invoking +// CMake or modifying the VoidLibrary source checkout (Plan 18). +struct VoidLibraryTargets { + std::map> modules; +}; + +[[nodiscard]] VoidLibraryTargets +add_void_library_native(Project &project, const std::filesystem::path &void_source_dir, + const std::vector &enabled_modules = { + "Configuration", "Text", "Unicode", "Async", "Testing"}); + +} // namespace Void::Build::Recipes diff --git a/contrib/voidlibrary-migration/build.cpp b/contrib/voidlibrary-migration/build.cpp new file mode 100644 index 0000000..59092d6 --- /dev/null +++ b/contrib/voidlibrary-migration/build.cpp @@ -0,0 +1,20 @@ +// Native VoidBuildSystem description for VoidLibrary itself (migration trial). +// The module closure is declared in build-support/vl/VoidLibraryModules.{hpp,cpp}. +#include "build-support/vl/VoidLibraryModules.hpp" + +void build(Void::Build::Project &project) { + const auto &ctx = project.context(); + (void)ctx; + + auto libs = Void::Build::Recipes::add_void_library_native(project, ".", + {"Configuration", "Text", "Unicode", + "Async", "Algorithms", "Crypto", + "Archive", "Testing", "Log"}); + + // Smoke test exercising the native VoidLibrary closure through VBS. + auto smoke = project.test("void_smoke"); + smoke.cxx_standard(Void::Build::CxxStandard::Cxx26) + .sources({"tests/vl/smoke.cpp"}) + .link(libs.modules.at("Testing")) + .link(libs.modules.at("Configuration")); +} diff --git a/contrib/voidlibrary-migration/tests/vl/smoke.cpp b/contrib/voidlibrary-migration/tests/vl/smoke.cpp new file mode 100644 index 0000000..1687ce7 --- /dev/null +++ b/contrib/voidlibrary-migration/tests/vl/smoke.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + const auto value = Void::Configuration::get_env_or("VBS_VOID_MIGRATION_SMOKE", "fallback"); + return value == "fallback" ? 0 : 1; +} diff --git a/docs/agent-workflow/STATE.md b/docs/agent-workflow/STATE.md index c26149c..8399fa4 100644 --- a/docs/agent-workflow/STATE.md +++ b/docs/agent-workflow/STATE.md @@ -296,6 +296,8 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B - **Wave 101 (CMake File API Shim)**: `vbs ide generate` now regenerates a CMake File API `codemodel-v2` reply tree (`build/.cmake/api/v1/reply/{index,codemodel-v2,directory,target-*}.json`) from the lowered graph, including per-target type, artifacts, `nameOnDisk`, sources, and compile groups (language, command fragments, defines, includes). Covered by `FullV1Tests.ide_integration_compdb_build_cpp_and_editor_configs_end_to_end`, which walks index → codemodel → target JSON. +- **Wave 102 (VoidLibrary Migration Trial)**: in a separate VoidLibrary clone at the pin (`0002e74`), a native `build.cpp` (using the shared module-closure logic) built VoidLibrary entirely with VBS - 23 actions, module archives plus `void_smoke` - and `vbs test` reported `PASSED 'void_smoke'` with no CMake. The reusable assets live in `contrib/voidlibrary-migration/` (outside the globbed source trees), and the missing first-class upstream build description was filed as [Void/Library#61](https://git.faumaray.com/Void/Library/issues/61). + ## Remaining future scope - **Superiority plan ([22-superiority-and-gaps.md](../roadmap/22-superiority-and-gaps.md), 2026-12-05)**: revised platform strategy - **macOS deferred**, **Windows via MinGW-w64 cross-compilation + Wine execution** (`dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc`, `dev cpp-gcc -p wine64`), native MSVC deferred; plus packaging parity (ZIP/DEB/RPM), IDE ecosystem, migration tooling, test-runner parity, benchmarks, CI runners, and remote execution in prioritized order. diff --git a/docs/agent-workflow/TASKS.md b/docs/agent-workflow/TASKS.md index 796ba97..f149747 100644 --- a/docs/agent-workflow/TASKS.md +++ b/docs/agent-workflow/TASKS.md @@ -105,4 +105,5 @@ Base HEAD: `fe0d1a6` | Wave 99 (Windows path semantics) | Case-insensitive output collision + reserved device name validation for Windows targets; Wine case-insensitivity assertion | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Windows regression test passes, full CTest 8/8) | `src/Graph/Graph.cpp`, `tests/FullV1Tests.cpp`, docs | | Wave 100 (CMakePresets import) | `Config::load_cmake_presets` (inherits, `${sourceDir}`, cache merge, profile/compiler mapping) + `vbs presets` CLI | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; presets test passes, full CTest 8/8) | `include/Void/Build/Config/Presets.hpp`, `src/Config/Presets.cpp`, `src/Main.cpp`, `tests/{FullV1Tests,CliContracts}.cpp/cmake`, docs | | Wave 101 (CMake File API shim) | `vbs ide generate` emits `.cmake/api/v1/reply` codemodel-v2 + directory + per-target JSON from the lowered graph | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; IDE integration test passes, full CTest 8/8) | `src/Editor/CompDb.cpp`, `tests/FullV1Tests.cpp`, docs | +| Wave 102 (VoidLibrary migration trial) | Separate-clone `build.cpp` builds and tests VoidLibrary with VBS; assets in `contrib/voidlibrary-migration/`; upstream issue #61 | VERIFIED IN CLONE (23 actions, `vbs test` PASSED; no CMake) | `contrib/voidlibrary-migration/`, docs | | Future (Plan 20 Slice 3 / Tracks C, E3 editor extensions) |"}] Live `conan` CLI verification; macOS/Windows/cross-compile; binary-variant signing and key distribution; daemon-side dependency materialization and editor plugins; `Void::Net`/`Void::Sqlite` alignment | PLANNED (unimplemented) | [21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md), [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md) | diff --git a/docs/agent-workflow/VERIFICATION.md b/docs/agent-workflow/VERIFICATION.md index d45913f..396e5ef 100644 --- a/docs/agent-workflow/VERIFICATION.md +++ b/docs/agent-workflow/VERIFICATION.md @@ -1428,6 +1428,25 @@ dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc -p wine64 -c build/pinned/bin/vbs_v1 target and asserts the executable target has artifacts and compile groups: **passed** (3.14 s). - Full CTest: **8 / 8 passed** in 276.69 s. +## VoidLibrary Migration Trial (GCC 16.2, VoidLibrary `0002e74`) + +Performed in a **separate clone** (`/tmp/opencode/vl-migrate`); the shared checkout was not touched. + +```sh +cp -r contrib/voidlibrary-migration/. /tmp/opencode/vl-migrate/ +vbs build --project /tmp/opencode/vl-migrate --build-dir /tmp/opencode/vl-migrate/build \ + --profile debug --target void_smoke --jobs 8 +vbs test --project /tmp/opencode/vl-migrate --build-dir /tmp/opencode/vl-migrate/build \ + --target void_smoke --jobs 8 +``` + +- Build: **exit 0**, 23 actions (`libVoid_*.a` archives for the enabled module closure plus + `void_smoke`), no CMake involved. +- `./build/profiles/debug/out/bin/void_smoke`: exit 0. +- `vbs test`: `PASSED 'void_smoke'`. +- Upstream gap filed as [Void/Library#61](https://git.faumaray.com/Void/Library/issues/61) because + VoidLibrary lacks an in-repo VBS build description and many modules have no native entry. + ## Limits and Unrun Checks 1. **HTTPS git fetch**: the host shell is proxy-restricted, but the Docker container could clone `https://git.faumaray.com/Void/VoidLibrary.git`; the pinned commit `3e254055e081a104f08df68dde39711bc7813518` was fetched directly for the verification above. A separate configure against the local `/home/faumaray/Projects/Library` checkout via `VBS_VOID_SOURCE_DIR` also succeeded (development-only override, checkout unmodified). diff --git a/docs/roadmap/22-superiority-and-gaps.md b/docs/roadmap/22-superiority-and-gaps.md index f851286..f8bf11b 100644 --- a/docs/roadmap/22-superiority-and-gaps.md +++ b/docs/roadmap/22-superiority-and-gaps.md @@ -79,7 +79,7 @@ Concrete work this implies: 2. Wine-first Windows target support (§2). 3. Packaging parity: ZIP (stored), DEB, RPM, metadata, signing (`--archive-format` extensions). 4. IDE ecosystem: File API shim (**done**: `vbs ide generate` emits codemodel-v2), presets import (**done**: `vbs presets`), external plugins. -5. Migration tooling (`vbs migrate`) and migrating VoidLibrary onto VBS. +5. Migration tooling (`vbs migrate`) and migrating VoidLibrary onto VBS (**trial verified**: VoidLibrary builds and tests with VBS in a separate clone; upstream #61 tracks the in-repo build description). 6. Test-runner parity. 7. Benchmarks against CMake/Meson/build2 on documented fixtures (including 10k-target scaling). 8. CI on real runners, sanitizer jobs, parser fuzzing.