From 5267c62f8c1f483c5348d4a2e498088a41c2e945 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 12 Apr 2023 07:34:39 +0200 Subject: Implement in-process package configuration --- bpkg/bpkg.cxx | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'bpkg/bpkg.cxx') diff --git a/bpkg/bpkg.cxx b/bpkg/bpkg.cxx index 21cbefc..4af4140 100644 --- a/bpkg/bpkg.cxx +++ b/bpkg/bpkg.cxx @@ -1,6 +1,8 @@ // file : bpkg/bpkg.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file +#include + #include #include // getenv() #include // strcmp() @@ -15,9 +17,6 @@ #include #include #include -#include -#include -#include #include #include @@ -34,6 +33,9 @@ #include #include +#include +#include + #include #include @@ -109,8 +111,6 @@ namespace bpkg static const char* build2_argv0; - // Use build2_sched.started() to check if already initialized. - // void build2_init (const common_options& co) { @@ -174,13 +174,12 @@ namespace bpkg bo.no_column (), bpkg::stderr_term.has_value ()); - // Note that we pretend to be in the serial-stop mode even though we may - // build build system modules in parallel in order to get better - // diagnostics for the common case. + // Also note that we now use this in pkg_configure(), but serial-stop + // is good for it as well. // init (&build2_terminate, build2_argv0, - true /* serial_stop */, + false /* serial_stop */, bc.mtime_check, bc.config_sub, bc.config_guess); @@ -197,6 +196,9 @@ namespace bpkg load_builtin_module (&build2::version::build2_version_load); load_builtin_module (&build2::in::build2_in_load); + load_builtin_module (&build2::bash::build2_bash_load); + load_builtin_module (&build2::cli::build2_cli_load); + // Note that while all we need is serial execution (all we do is load), // in the process we may need to update some build system modules (while // we only support built-in and standard pre-installed modules here, we @@ -206,6 +208,10 @@ namespace bpkg // serial execution, which is relatively cheap. The module building // logic will then re-tune it to parallel if and when necessary. // + // Note that we now also use this in pkg_configure() where we re-tune + // the scheduler (it may already have been initialized as part of the + // package skeleton work). + // build2_sched.startup (1 /* max_active */, 1 /* init_active */, bc.max_jobs, @@ -218,7 +224,7 @@ namespace bpkg } catch (const build2::failed&) { - throw failed (); // Assume the diagnostics has already been issued. + throw bpkg::failed (); // Assume the diagnostics has already been issued. } } -- cgit v1.1