Restructure into umbrella modules (~55 -> 16 targets)

Headers move, CMake targets merge, C++ namespaces stay unchanged:
- Core: Scope, Lazy, Counted, Flags, Hash, Bits, Uuid, TypeList, TypeMap, Variant
- Functional: Pipeline, Either, Result, Retry
- Containers: Ring, Pool, PriorityQueue, LRU, Trie, Graph, DisjointSet, Bitset, Interval
- Math: +Matrix, Numeric, Random, Histogram
- Text: Str, Format, Tokenizer, Diff, Encoding, Semver
- Data: Json, Csv, Ini
- Async: Coro, Concurrency, EventBus, Observable
- Time: +Bench
- Log: Log facade + Logging framework (facade now header-only, breaking
  the Stacktrace<->Log link cycle the merge would have created)
- System: FileSystem + Process
- Configuration: +Argparse
- Unchanged: Stacktrace, Plugin, StateMachine, Testing, TestingMock, Detail

Module system fixes:
- OPTIONAL_DEPS resolution deferred to void_finalize_modules() so it no
  longer depends on the alphabetical discovery order of src/ subdirs
  (Testing -> Text would have been silently dropped).
- Every header-only module now has a tracked module.cmake; previously the
  empty src/<Name> marker dirs were untracked, so a fresh clone would have
  silently skipped those modules.
- VOID_HAS_LOGGING/CONCURRENCY/STR consumers renamed to LOG/ASYNC/TEXT.

Tests move to tests/standalone/<Umbrella>/<Feature>.cpp (Result suite files
prefixed: ResultBasic etc.). Test count verified identical (831) before and
after. README/CLAUDE.md module tables updated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Fable 5 committed 2026-06-12 18:50:02 +03:00
1 parent da2e93c405
commit 28b94883fd
156 files changed
+278 -220

No files matched your search

+35 -16
View File
@@ -19,8 +19,8 @@ cmake --build build
# Run all tests
ctest --test-dir build
# Run a single standalone test binary directly
./build/tests/test_standalone_Logging_FileLogger
# Or run the single test binary directly (supports --filter, --parallel, ...)
./build/tests/VoidTests --filter "Json*"
```
Format code with:
@@ -30,35 +30,54 @@ clang-format -i <file>
## Architecture
VoidLibrary is a C++23 modular shared library. Each module is an independently installable CMake target under the `Void::` namespace.
VoidLibrary is a C++26 modular shared library organized as **umbrella modules** — one CMake target each, grouping related functionality. The C++ namespaces of absorbed components are unchanged (e.g. `Void::Ring` lives in `include/Void/Containers/Ring.hpp`, linked via `Void::Containers`).
| Module | Type | Contents |
|---|---|---|
| `Core` | INTERFACE | Scope, Lazy, Counted, Flags, Hash, Bits, Uuid, TypeList, TypeMap, Variant |
| `Functional` | INTERFACE | Pipeline (+Curry, +Memo), Either (+Opt), Result, Retry |
| `Containers` | INTERFACE | Ring, Pool, PriorityQueue, LRU, Trie, Graph, DisjointSet, Bitset, Interval |
| `Math` | INTERFACE | Vec/Mat, Matrix, Numeric, Random, Histogram |
| `Text` | INTERFACE | Str, Format, Tokenizer, Diff, Encoding, Semver |
| `Data` | INTERFACE | Json, Csv, Ini |
| `Async` | INTERFACE | Coro (Task, Generator), Concurrency (ThreadPool, Channel, ParallelFor), EventBus, Observable |
| `Time` | INTERFACE | Stopwatch, Format (durations/ISO-8601), Bench |
| `Log` | SHARED | `Void::Log` header-only facade + `Void::Logging` framework |
| `System` | SHARED | FileSystem (Path, Query, TempDir) + Process |
| `Configuration` | SHARED | Config, Env + Argparse |
| `Stacktrace` | SHARED | Boost.Stacktrace capture, color helpers (kept separate to isolate the Boost dep) |
| `Plugin` | SHARED | dlopen loader, C ABI, hot reload |
| `StateMachine` | INTERFACE | compile-time variant-based FSM |
| `Testing` / `TestingMock` | STATIC / INTERFACE | test + mock frameworks |
`include/Void/Detail/` (e.g. `Enum.hpp` — P2996 enum reflection) is not a module; it is header-only and reachable from every module via the shared include root.
### Module system
`cmake/Module.cmake` defines `void_add_module(NAME ...)`. The root `CMakeLists.txt` auto-discovers every subdirectory under `src/` and calls it. A module with only headers becomes an `INTERFACE` library; one with `.cpp` sources becomes `SHARED` — except `Testing`, which is special-cased to `STATIC`.
`cmake/Module.cmake` defines `void_add_module(NAME ...)`. The root `CMakeLists.txt` auto-discovers every subdirectory under `src/` and calls it (or includes the dir's `module.cmake` if present), then calls `void_finalize_modules()`. A module with only headers becomes an `INTERFACE` library; one with `.cpp` sources becomes `SHARED` — except `Testing`, which is special-cased to `STATIC`.
Module layout:
- Headers: `include/Void/<ModuleName>/*.hpp`
- Sources: `src/<ModuleName>/*.cpp`
- CMake target: `Void_<ModuleName>` with alias `Void::<ModuleName>`
- Namespace: `Void::<ModuleName>`
- Headers: `include/Void/<Module>/*.hpp`
- Sources: `src/<Module>/*.cpp`
- CMake target: `Void_<Module>` with alias `Void::<Module>`
To add a new module, create `src/<ModuleName>/` and populate it — the build system picks it up automatically. If a module needs special dependency wiring, drop a `module.cmake` file inside the source directory (see `cmake/module.cmake.template` for the pattern).
Every header-only module **must** have at least a one-line `src/<Module>/module.cmake` (`void_add_module(<Module>)`) — git does not track empty directories, and discovery iterates `src/*`.
`void_add_module` accepts three dependency lists:
- `INTERNAL_DEPS` — other `Void::*` modules (linked unconditionally).
- `EXTERNAL_DEPS` — third-party targets fetched via `cmake/Dependencies.cmake` (`FetchContent`); add new ones there before referencing.
- `OPTIONAL_DEPS` — `Void::*` modules linked only if they exist; each present dep additionally defines `VOID_HAS_<UPPERCASE>` for conditional code.
- `OPTIONAL_DEPS` — `Void::*` modules linked only if they exist; each present dep additionally defines `VOID_HAS_<UPPERCASE>` for conditional code. Resolution is deferred to `void_finalize_modules()`, so it does not depend on discovery order.
### Tests
`tests/CMakeLists.txt` defines two test categories:
All tests compile into **one binary**, `build/tests/VoidTests` (registered as the single ctest entry):
| Category | Location | Binary | Links |
|---|---|---|---|
| Internal (kitchen-sink) | `tests/internal/*.cpp` | `VoidInternalTests` | all modules + `Void::Testing` |
| Standalone (isolated) | `tests/standalone/<ModuleName>/<name>.cpp` | `test_standalone_<ModuleName>_<name>` | its module only |
| Category | Location | Suite label |
|---|---|---|
| Standalone | `tests/standalone/<Module>/<Feature>.cpp` | `<Feature>` (file stem) |
| Internal (cross-module) | `tests/internal/*.cpp` | `internal_<stem>` |
Standalone tests are preferred for testing a single module in isolation.
**The `tests/standalone/<Module>` directory name must exactly match a module name** — the scanner iterates registered modules and silently skips unknown directories. After moving/renaming tests, compare the runner's total test count.
#### Writing a test