From 0186711a901685988ad395032ae929350bba38e9 Mon Sep 17 00:00:00 2001 From: "Aleksei (Faumaray) Selikhov" Date: Sun, 6 Dec 2026 08:40:16 +0300 Subject: [PATCH] feat: 1.0.0 release built and packaged by VBS - Bump the project version to 1.0.0 (CMake and the VBS description). - vbs install now imports declared dependencies before lowering (previously it ignored providers entirely, so any project with an external dependency could not be installed). - Native providers export plain option names alongside VBS_DEP_OPTION_* because dependencies such as VoidLibrary read VOID_ENABLED_MODULES directly. - The VBS description disables VoidLibrary's own test executables and keeps the entry points out of the core library glob, which lets the self-hosted build link. - CI gains 4A2: builds VBS with VBS and packages tar/sh/zip/deb/rpm/ wix/dmg/nuget installers, which the release publishes. Verified locally: the self-hosted build and all eight installer formats succeed; the tar contains vbs, vbs-registry, the CMake export and package metadata. --- .gitea/workflows/ci.yml | 63 +++++++++++++++++++++- CMakeLists.txt | 2 +- build.cpp | 11 +++- src/Main.cpp | 107 +++++++++++++++++++++++++++++++++++--- src/Provider/Provider.cpp | 3 ++ 5 files changed, 174 insertions(+), 12 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index cbccf30..2196795 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -216,6 +216,60 @@ jobs: path: dist-linux-${{ matrix.variant }}/ retention-days: 30 + # --------------------------------------------------------------------------- + # 4A2 - the release installers, built and packaged by VBS itself + # --------------------------------------------------------------------------- + vbs-installers: + name: "4A2 · VBS installers (self-hosted)" + needs: linux-test + runs-on: vulkan + steps: + - uses: actions/checkout@v4 + - name: Download the RelWithDebInfo build + uses: actions/download-artifact@v3 + with: + name: vbs-linux-build-relwithdebinfo + path: build/linux-relwithdebinfo + - name: Make the restored binaries executable + run: chmod +x build/linux-relwithdebinfo/bin/* + - name: Build and package every installer format with VBS + run: | + set -eu + vbs=build/linux-relwithdebinfo/bin/vbs + version="$(sed -nE 's/^project\(VoidBuildSystem VERSION ([0-9.]+).*/\1/p' CMakeLists.txt)" + label="${{ github.event.inputs.tag }}" + if [ -z "${label}" ]; then + case "${GITHUB_REF_NAME}" in + v*) label="${GITHUB_REF_NAME}" ;; + *) label="dev-$(printf '%s' "${GITHUB_SHA}" | cut -c1-7)" ;; + esac + fi + out=dist-installers + prefix="$(mktemp -d)" + mkdir -p "${out}" + # The first install builds the project with VBS (build.cpp); the rest reuse + # the shared build directory. + for fmt in tar sh zip deb rpm wix dmg nuget; do + case "${fmt}" in + tar) ext=tar ;; + wix) ext=wxs ;; + nuget) ext=nupkg ;; + *) ext="${fmt}" ;; + esac + "${vbs}" install --project . --build-dir build/selfhost --profile release \ + --prefix "${prefix}" --package-name VoidBuildSystem \ + --package-version "${version}" \ + --archive "${out}/vbs-${label}-linux-x86_64-${fmt}.${ext}" \ + --archive-format "${fmt}" + done + ls -l "${out}/" + - name: Upload the installers + uses: actions/upload-artifact@v3 + with: + name: vbs-installers + path: dist-installers/ + retention-days: 30 + # --------------------------------------------------------------------------- # 2B / 3B / 4B - Windows via Wine: VBS is cross-compiled with MinGW-w64, its # test executables run under Wine, and the Windows binaries are packaged. @@ -370,9 +424,9 @@ jobs: # --------------------------------------------------------------------------- release: name: "5 · Release" - # Linked to both package lanes and only dispatched for a release tag or an + # Linked to every package lane and only dispatched for a release tag or an # explicit publish dispatch (always() would queue the job on every push). - needs: [linux-package, wine-package] + needs: [linux-package, wine-package, vbs-installers] if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.publish == 'true' runs-on: vulkan steps: @@ -388,6 +442,11 @@ jobs: with: name: vbs-windows-package-relwithdebinfo path: dist + - name: Download the VBS installers + uses: actions/download-artifact@v3 + with: + name: vbs-installers + path: dist - name: Verify the tag matches the project version run: | tag="${{ github.event.inputs.tag }}" diff --git a/CMakeLists.txt b/CMakeLists.txt index e971e92..b6444a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 4.0) -project(VoidBuildSystem VERSION 0.1.0 LANGUAGES CXX) +project(VoidBuildSystem VERSION 1.0.0 LANGUAGES CXX) if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16) message(FATAL_ERROR diff --git a/build.cpp b/build.cpp index 6d39580..dac3768 100644 --- a/build.cpp +++ b/build.cpp @@ -9,6 +9,9 @@ void build(Void::Build::Project &project) { Void::Build::Commit{"de1fdcda72ddd6ac069fba433b13f643327efa3f"}) .native_builder({{"VOID_ENABLED_MODULES", "Configuration;Text;Unicode;Async;Algorithms;Crypto;Archive;Testing;Log"}, + // Only the Testing library is needed, not VoidLibrary's own test + // executables (the CMake path sets VOID_ENABLE_TESTING=OFF too). + {"VOID_ENABLE_TESTING", "0"}, {"BUILD_SHARED_LIBS", false}}); // Source membership comes from conventions and globs, not explicit file lists: @@ -24,8 +27,12 @@ void build(Void::Build::Project &project) { } auto core = project.static_library("VoidBuildCore"); + // The entry points (src/Main.cpp, src/Describe.cpp) are not part of the core + // library: they define main() and Describe.cpp references the example + // description's build()/profiles(). Glob only the subdirectories. core.cxx_standard(Void::Build::CxxStandard::Cxx26) - .sources(project.glob("src/**/*.cpp")) + .sources(project.glob("src/*/*.cpp")) + .sources(project.glob("src/*/*/*.cpp")) .sources(project.glob("recipes/**/*.cpp")) .include_directory("include", Void::Build::Visibility::Public) .include_directory("recipes", Void::Build::Visibility::Public) @@ -55,7 +62,7 @@ void build(Void::Build::Project &project) { "#pragma once\n" "#include \n" "namespace Void::Build::Bootstrap {\n" - "inline constexpr std::string_view version = \"0.1.0\";\n" + "inline constexpr std::string_view version = \"1.0.0\";\n" "inline constexpr std::string_view os = \"" + ctx.os + "\";\n" diff --git a/src/Main.cpp b/src/Main.cpp index ee94be2..ea50a3e 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -2652,6 +2652,92 @@ int execute_install_command(const InstallCmdOptions &opts) { std::cerr << "vbs install: " << desc.error().message() << '\n'; return 1; } + auto state = State::StateStore::open(build_root / ".vbs"); + if (!state) { + std::cerr << "vbs install: " << state.error().message() << '\n'; + return 1; + } + + // Import declared dependencies like `vbs build`, so projects with external + // dependencies (e.g. VoidLibrary) can be installed too. + std::vector toml_deps; + for (const auto &dep_file : desc->dependency_files) { + const auto dep_path = std::filesystem::path{dep_file}.is_absolute() + ? std::filesystem::path{dep_file} + : (project_root / dep_file); + auto loaded = Package::load_dependencies_toml(dep_path); + if (!loaded) { + std::cerr << "vbs install: " << loaded.error().message() << '\n'; + return 1; + } + toml_deps.insert(toml_deps.end(), loaded->begin(), loaded->end()); + } + auto merged_deps = Package::merge_dependencies(desc->dependencies, toml_deps); + if (!merged_deps) { + std::cerr << "vbs install: " << merged_deps.error().message() << '\n'; + return 1; + } + std::map> imported_targets; + if (!merged_deps->empty()) { + auto pinned_lock = Package::load_pinned_lock(project_root / "vbs.lock"); + if (!pinned_lock) { + std::cerr << "vbs install: " << pinned_lock.error().message() << '\n'; + return 1; + } + auto trusted_keys = combine_trusted_keys({}, {}, project_root); + if (!trusted_keys) { + std::cerr << "vbs install: " << trusted_keys.error().message() << '\n'; + return 1; + } + auto resolved = + resolve_and_materialize_deps(ctx, *merged_deps, project_root, build_root, + *pinned_lock, false, false, *trusted_keys); + if (!resolved) { + std::cerr << "vbs install: " << resolved.error().message() << '\n'; + return 1; + } + for (const auto &[dep_rec, mat] : resolved->materialized) { + DependencyRecord effective_dep = dep_rec; + if (effective_dep.builder.empty() && + effective_dep.source_kind == DependencySourceKind::Package) { + std::error_code 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)) { + effective_dep.builder = "meson"; + } + } + if (effective_dep.builder == "cmake" || effective_dep.builder == "meson" || + 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), + 0}; + auto exported = Provider::resolve_foreign_provider(preq); + if (!exported) { + std::cerr << "vbs install: " << exported.error().message() << '\n'; + return 1; + } + for (const auto &[name, target] : exported->targets) { + imported_targets[name] = target; + } + } + } + } const auto snap_inputs = collect_snapshot_inputs(*desc, project_root); Snapshot::SnapshotOptions sopts; @@ -2664,22 +2750,29 @@ int execute_install_command(const InstallCmdOptions &opts) { std::cerr << "vbs install: " << snap.error().message() << '\n'; return 1; } - auto graph = - Graph::lower_project_graph(*desc, *tc, {project_root, build_root, &(*snap), {}, 32768}); + auto graph = Graph::lower_project_graph( + *desc, *tc, + {project_root, build_root, &(*snap), std::move(imported_targets), 32768}); if (!graph) { std::cerr << "vbs install: " << graph.error().message() << '\n'; return 1; } - auto state = State::StateStore::open(build_root / ".vbs"); - if (!state) { - std::cerr << "vbs install: " << state.error().message() << '\n'; - return 1; - } auto exec = Execution::execute_graph(*graph, *state); if (!exec || !exec->succeeded) { std::cerr << "vbs install: build failed before staging\n"; if (!exec) { std::cerr << exec.error().message() << '\n'; + } else { + for (const auto &result : exec->results) { + if (result.succeeded) { + continue; + } + std::cerr << "vbs install: action '" << result.action_id + << "' failed: " << result.error_message << '\n'; + if (!result.stderr_data.empty()) { + std::cerr << result.stderr_data << '\n'; + } + } } return 1; } diff --git a/src/Provider/Provider.cpp b/src/Provider/Provider.cpp index 10ca64b..c13a646 100644 --- a/src/Provider/Provider.cpp +++ b/src/Provider/Provider.cpp @@ -1069,6 +1069,9 @@ run_native_provider(const ProviderRequest &request, const std::filesystem::path fopts.extra_environment["VBS_DEP_NAME"] = request.dependency.name; for (const auto &[key, value] : request.dependency.options) { fopts.extra_environment["VBS_DEP_OPTION_" + key] = cmake_option_value(value); + // Dependencies may read their options from the plain environment + // (VoidLibrary's build.cpp reads VOID_ENABLED_MODULES directly). + fopts.extra_environment[key] = cmake_option_value(value); } auto compiled = Config::compile_descriptor(fopts); if (!compiled) {