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

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

No files matched your search

+64 -137
View File
@@ -1,169 +1,96 @@
# VoidBuildSystem
A C++ build system for Void projects, using
[VoidLibrary](https://git.faumaray.com/Void/VoidLibrary). Build logic lives in
ordinary `build.cpp` and reusable `.cpp`/`.hpp` files. Dependency declarations
will also support TOML.
A native C++26 build system and package manager for Void projects, built with
[VoidLibrary](https://git.faumaray.com/Void/VoidLibrary). Build descriptions and
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.
**Current milestone: compiling bootstrap and declaration SDK.** The `vbs` CLI
implements help/version and useful errors. `vbs_describe` evaluates the compiled
example and emits a versioned JSON description. Native builds, self-hosting,
dependency resolution, watchers and profile-aware compilation databases are
planned; those commands currently fail explicitly.
**Implemented scope (Plans 01–19):**
- **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`), and bounded-parallel DAG execution (`ProcessSupervisor` with `-pgid` `SIGTERM -> SIGKILL` cleanup).
- **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 (`MetadataOnly` never triggers builds or foreign configures).
- **Native Package Manager, Foreign Providers, Bridge & Install**: TOML 1.0 parser/merger, PubGrub-style SemVer solver, 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 with safe extraction, 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`).
- **VoidLibrary Reuse**: Built directly on VoidLibrary `Configuration` (`Void::Argparse::Parser` across `vbs`, `vbs-registry`, `vbs_describe`, and `vbs_benchmarks`; `Void::Configuration::get_env`/`get_env_or`), `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`), `Core` (`Void::Scope::on_exit`), `Time` (`Void::Time::Stopwatch`), `Data` (`Void::Json::Strict`), `System` (`Void::FileSystem`, `Void::Process::SignalWatcher`), and `Testing`.
- **Remaining future design scope**: [Plan 20 — Later native foreign execution and platform ports](docs/roadmap/20-future-translation-platforms.md) (native foreign graph translation and Windows/macOS ports) remains planned architectural scope.
Start with the [twenty implementation plans](docs/roadmap/README.md),
[architecture](docs/roadmap/ARCHITECTURE.md) and
[requirements](docs/roadmap/REQUIREMENTS.md). Each part specifies interfaces,
dependencies, ownership, implementation steps, failure behavior and acceptance
checks. [Verification](docs/agent-workflow/VERIFICATION.md) records observed results.
Start with the [twenty roadmap plans](docs/roadmap/README.md),
[architecture](docs/roadmap/ARCHITECTURE.md),
[requirements](docs/roadmap/REQUIREMENTS.md), and
[verification log](docs/agent-workflow/VERIFICATION.md).
## Build the bootstrap
## Naming Conventions
Requirements: GCC 16+ with C++26 reflection, CMake 4.0+, Git and Ninja. The verified
host environment is GCC 16.2.0, CMake 4.4.4 and Ninja 1.13.2 on Linux. The supplied
`dev cpp-gcc` environment provides these tools:
- C++ namespace: `Void::Build`
- Public umbrella header: `<Void/Build.hpp>` ([include/Void/Build.hpp](include/Void/Build.hpp))
- Internal headers and sources: PascalCase paths under [include/Void/Build/](include/Void/Build/) and [src/](src/)
- Types and enum constants: `PascalCase` (`Visibility::Public`, `CompilerFamily::Gcc`, `TargetKind::Executable`, etc.); functions and methods: `snake_case`
- CMake targets: `VoidBuild_Sdk` (`Void::BuildSdk`), `VoidBuild_Core` (`Void::BuildCore`), `VoidBuild_Registry` (`Void::BuildRegistry`), `VoidBuild_Options`
- CLI & project files: `vbs`, `vbs-registry`, `vbs.deps.toml`, `vbs.lock`, `.vbs/`, `VbsDeps.cmake`
## Building & Testing
Requirements: GCC 16+ with C++26 `-freflection`, CMake 4.0+, Git, and Ninja (verified on NixOS via `dev cpp-gcc` with GCC 16.2.0, CMake 4.4.4, Ninja 1.13.2, Meson 1.12.1; Clang target matrix verified via `dev cpp` with Clang 23.1.3 and `clang-scan-deps`).
```sh
dev cpp-gcc -c cmake -S . -B build/bootstrap -G Ninja \
dev cpp-gcc -c cmake -S . -B build/dev -G Ninja \
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
dev cpp-gcc -c cmake --build build/bootstrap --parallel 2
dev cpp-gcc -c ctest --test-dir build/bootstrap --output-on-failure
build/bootstrap/bin/vbs --help
build/bootstrap/bin/vbs --version
build/bootstrap/bin/vbs_describe --profile debug --compiler gcc
build/bootstrap/bin/vbs_describe --profile release --compiler clang
dev cpp-gcc -c cmake --build build/dev --parallel 4
dev cpp-gcc -c ctest --test-dir build/dev --output-on-failure
dev cpp-gcc -c build/dev/bin/vbs_benchmarks --files 15
```
Without this local `dev` wrapper, run the same CMake/CTest commands in an
equivalent toolchain environment. The host bootstrap requires GCC; the descriptor's
`--compiler clang` selects runtime declaration facts and does not invoke Clang.
CMake fetches VoidLibrary at the exact commit
`9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5`. It builds the Configuration and Testing
module closure statically, with VoidLibrary's own tests and benchmarks disabled.
To use a development checkout explicitly:
CMake fetches VoidLibrary at pinned commit `9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5`.
For development against a local checkout without mutating the pin:
```sh
dev cpp-gcc -c cmake -S . -B build/bootstrap-local -G Ninja \
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DVBS_VOID_SOURCE_DIR=../VoidLibrary
dev cpp-gcc -c cmake --build build/bootstrap-local --parallel 2
dev cpp-gcc -c ctest --test-dir build/bootstrap-local --output-on-failure
dev cpp-gcc -c cmake -S . -B build/dev-local -G Ninja \
-DCMAKE_BUILD_TYPE=Debug -DVBS_VOID_SOURCE_DIR=../VoidLibrary
```
The override bypasses the pin and prints a diagnostic. Its source checkout is not
modified. `-DVBS_BUILD_TESTS=OFF` omits the bootstrap tests and Testing module.
Build products and generated test registrations stay in the chosen build directory.
The `compile_commands.json` produced here belongs to the CMake bootstrap; VBS's
automatic per-profile export and selection are separate planned features.
Note on optional system dependencies: `dev cpp-gcc` provides pure-C++/Threads dependencies without external `SQLite3`, `OpenSSL`, `LibArchive`, or `conan`. `Void::BuildCore` links optional VoidLibrary modules when available and provides verified swappable local adapters in the meantime (tracked in [docs/VOIDLIBRARY_UPSTREAM_REQUESTS.md](docs/VOIDLIBRARY_UPSTREAM_REQUESTS.md)). Note that `conan` invocation requires `conan` in `PATH` and fails explicitly with a missing-prerequisite diagnostic when absent.
## Ordinary C++ declarations
## CLI Reference
The [root example](build.cpp) and its [helper](build-support/defaults.cpp) compile
as part of the bootstrap. This smaller example uses the implemented SDK:
- `vbs build [--project DIR] [--build-dir DIR] [--profile NAME]... [--target NAME]... [--compiler gcc|clang] [--editor-profile NAME] [--build-source FILE]... [--jobs N] [--locked] [--offline] [--no-cache]`
- `vbs test ...` (same flags as `vbs build`, then runs selected `TargetKind::Test` binaries)
- `vbs describe [--project DIR] [--build-dir DIR] [--profile NAME] [--compiler gcc|clang]`
- `vbs compdb use|show|export|watch ...`
- `vbs watch [--project DIR] [--build-dir DIR] [--profile NAME] [--target NAME]...`
- `vbs deps resolve|update [--project DIR] [--build-dir DIR] [--profile NAME] [--offline]`
- `vbs install --prefix DIR [--project DIR] [--build-dir DIR] [--profile NAME] [--compiler gcc|clang] [--package-name NAME] [--package-version VER] [--component NAME] [--no-cmake-export] [--no-native-export]`
- `vbs uninstall --prefix DIR`
- `vbs pack [--project DIR] [--output FILE]`
- `vbs publish --registry URL --name PKG --version X.Y.Z [--project DIR] [--description TEXT] [--token-env VAR] [--private]`
- `vbs bridge --request FILE --output FILE` (backend for [cmake/bridge/VbsDeps.cmake](cmake/bridge/VbsDeps.cmake))
- `vbs gc [--build-dir DIR] [--max-bytes N]`
- `vbs gen-tests --input FILE --output-dir DIR`
- `vbs-registry --data-dir DIR --web-root DIR [--bind ADDR] [--port PORT] ...`
## Ordinary C++ & TOML Declarations
```cpp
#include <vbs/build.hpp>
#include <Void/Build.hpp>
void build(Void::Build::Project &project) {
project.dependencies_file("vbs.deps.toml");
void build(vbs::Project& project) {
auto core = project.static_library("core");
core.sources(project.glob("src/core/*.cpp"))
.include_directory("include", vbs::Visibility::public_);
core.cxx_standard(Void::Build::CxxStandard::Cxx26)
.sources(project.glob("src/core/*.cpp"))
.include_directory("include", Void::Build::Visibility::Public);
auto app = project.executable("app");
app.sources({"src/main.cpp"}).link(core);
if (project.context().compiler == vbs::CompilerFamily::clang) {
if (project.context().compiler == Void::Build::CompilerFamily::Clang) {
app.compile_option("-Wextra-semi");
}
}
```
These calls record data. They do not enumerate files, resolve dependencies or run
a compiler. See the [SDK contract](docs/SDK.md) and [public header](include/vbs/build.hpp).
`build.profiles.cpp` supplies ordinary C++ profile definitions; the current example
uses debug/release defaults. The same host-compiled descriptor is evaluated with
each requested target context, so host preprocessor macros are not target selectors.
The root description currently models `vbs_sdk`, `vbs` and their dependency links.
It is not yet a complete self-build: generated bootstrap headers, test registration
and native VoidLibrary construction belong to the
[self-hosting milestone](docs/roadmap/18-self-host-voidlibrary.md).
## Dependencies
The current SDK can record an exact Git source, CMake options and imported targets:
```cpp
auto library = project.dependency("VoidLibrary");
library.git("https://git.faumaray.com/Void/VoidLibrary.git",
vbs::Commit{"9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5"})
.cmake({{"VOID_ENABLED_MODULES", "Configuration"},
{"VOID_ENABLE_TESTING", false},
{"BUILD_SHARED_LIBS", false}});
app.link(library.target("Void::Configuration"));
```
It also records `project.dependency("fmt").package("fmt", "^11.0")`.
Resolution, fetching and foreign builds are future operations; declaring a dependency
does not perform them.
**Planned TOML form**, normalized to the same dependency model:
```toml
[dependencies.VoidLibrary]
git = "https://git.faumaray.com/Void/VoidLibrary.git"
rev = "9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5"
builder = "cmake"
[dependencies.VoidLibrary.options]
VOID_ENABLED_MODULES = "Configuration"
VOID_ENABLE_TESTING = false
BUILD_SHARED_LIBS = false
[dependencies.fmt]
package = "fmt"
version = "^11.0"
```
The proposed `project.dependencies("vbs.deps.toml")` loader will permit custom
filenames. It is not in the bootstrap SDK. Conflicting C++/TOML declarations will
fail with origin diagnostics. A context-aware `vbs.lock` will hold exact resolutions;
existing incompatible declarations will require explicit resolve/update. See the
[dependency plan](docs/roadmap/11-dependencies-solver-lock.md).
## Planned build and editor workflow
The native engine will build selected target/profile combinations, with several
profiles sharing one build root and separate mutable outputs. Per-profile
`compile_commands.json` files will cover all configured targets, even when the build
selects only a subset.
Editor selection will follow the latest single-profile build or an explicit manual
switch. Multi-profile builds will require `--editor-profile`. Configuration and source
membership changes will refresh metadata automatically; an independent metadata
watcher will update it without scheduling target/package builds or foreign configure
operations. Invalid configuration retains a clearly stale last valid database.
Content verification and immutable snapshots will cover additions, deletions, renames,
headers, generated inputs and changed build logic. File events are hints; periodic
reconciliation recovers missed changes. See the [profile](docs/roadmap/04-profiles-toolchains.md),
[snapshot](docs/roadmap/05-snapshots-invalidation.md),
[compilation database](docs/roadmap/09-compilation-database.md) and
[watcher](docs/roadmap/10-watchers-cli.md) plans.
Full v1 also includes modern C++ modules/header units/PCH/unity/LTO/sanitizers,
CMake/Meson/Conan consumption, native source/binary package management, a CMake-facing
dependency bridge, installation/exports, a C++ registry service and web administration.
Native self-hosting progresses from the CMake seed through clean native stages.
Later work covers native translation of foreign graphs and additional operating systems.
## Development
Use [STATE](docs/agent-workflow/STATE.md), [TASKS](docs/agent-workflow/TASKS.md) and
[decisions](docs/agent-workflow/DECISIONS.md) to continue work. The initial test suite
has four CTest checks covering SDK behavior and registration, CLI contracts and
the four debug/release × GCC/Clang declaration contexts. Tests use Void::Testing.
See the [SDK reference](docs/SDK.md), [public header](include/Void/Build.hpp), and
[VoidLibrary upstream requests](docs/VOIDLIBRARY_UPSTREAM_REQUESTS.md).
Licensed under [MIT](LICENSE).