From 08cc7dc1016ccceb8d41681a230c90a1f7197d29 Mon Sep 17 00:00:00 2001 From: "Aleksei (Faumaray) Selikhov" Date: Sun, 6 Dec 2026 12:05:26 +0300 Subject: [PATCH] feat(install): --jobs option; bound the CI installer build The nested dependency build ran at full parallelism and large translation units failed on the runner without a visible diagnostic. vbs install accepts --jobs (also forwarded to the provider build and the parent graph) and the installers use 4. --- .gitea/workflows/ci.yml | 4 ++-- src/Main.cpp | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 4ef2a74..c9f4397 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -301,7 +301,7 @@ jobs: local attempt=1 while true; do if "${vbs}" install --project . --build-dir "${build_dir}" --profile release \ - --prefix "${prefix}" --package-name VoidBuildSystem \ + --jobs 4 --prefix "${prefix}" --package-name VoidBuildSystem \ --package-version "${version}" \ --archive "${out}/vbs-${label}-linux-x86_64-${fmt}.${ext}" \ --archive-format "${fmt}"; then @@ -383,7 +383,7 @@ jobs: *) ext="${fmt}" ;; esac "${vbs}" install --project . --build-dir "${build_dir}" --profile release \ - --target-os windows --target-arch x86_64 \ + --jobs 4 --target-os windows --target-arch x86_64 \ --prefix "${prefix}" --package-name VoidBuildSystem \ --package-version "${version}" \ --archive "${out}/vbs-${label}-windows-x86_64-${fmt}.${ext}" \ diff --git a/src/Main.cpp b/src/Main.cpp index 4fe31d4..92cf9be 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -2571,6 +2571,7 @@ struct InstallCmdOptions { std::optional compiler_arg; std::optional target_os_arg; std::optional target_arch_arg; + std::optional jobs_arg; std::optional prefix_arg; std::optional pkg_name_arg; std::string pkg_ver{"0.1.0"}; @@ -2598,6 +2599,15 @@ int execute_install_command(const InstallCmdOptions &opts) { return 2; } } + std::size_t jobs = 0; + if (opts.jobs_arg) { + int parsed_jobs = 0; + if (!Void::Str::to_int(*opts.jobs_arg, parsed_jobs) || parsed_jobs < 0) { + std::cerr << "vbs install: invalid --jobs value '" << *opts.jobs_arg << "'\n"; + return 2; + } + jobs = static_cast(parsed_jobs); + } // Absolute roots: the self-hosted dependency build runs actions with their // own working directory, so relative graph paths would not resolve. @@ -2762,7 +2772,7 @@ int execute_install_command(const InstallCmdOptions &opts) { ? std::nullopt : std::optional{fopts.sdk_library_path}, &(*state), - 0}; + jobs}; auto exported = Provider::resolve_foreign_provider(preq); if (!exported) { std::cerr << "vbs install: " << exported.error().message() << '\n'; @@ -2797,6 +2807,7 @@ int execute_install_command(const InstallCmdOptions &opts) { // need to be built: test executables and tools without install rules are // not part of the package. Execution::ExecutionOptions eopts; + eopts.jobs = jobs; for (const auto &target : desc->targets) { if (target.install_rule) { eopts.selected_targets.push_back(target.name); @@ -3939,6 +3950,7 @@ int main(int argc, char **argv) { install_opts.target_os_arg) .option("--target-arch", "", "Target architecture (default: host, e.g. x86_64)", install_opts.target_arch_arg) + .option("--jobs", "-j", "Parallel job count (0 = auto)", install_opts.jobs_arg) .option("--prefix", "", "Install destination prefix (required)", install_opts.prefix_arg) .option("--package-name", "", "Exported package name", install_opts.pkg_name_arg) .option_default("--package-version", "", "Exported package version", install_opts.pkg_ver,