From 0aa8059f9b9377c7b39e4ceb2df85a4e7b6fec0f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 10 Feb 2022 11:56:34 +0200 Subject: Add build context to package_skeleton --- bpkg/package-skeleton.hxx | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'bpkg/package-skeleton.hxx') diff --git a/bpkg/package-skeleton.hxx b/bpkg/package-skeleton.hxx index 889a937..00be6a3 100644 --- a/bpkg/package-skeleton.hxx +++ b/bpkg/package-skeleton.hxx @@ -4,6 +4,8 @@ #ifndef BPKG_PACKAGE_SKELETON_HXX #define BPKG_PACKAGE_SKELETON_HXX +#include // build2::context + #include #include @@ -79,7 +81,10 @@ namespace bpkg // reflect_.push_back (r); - dirty (); + // Mark the build system state as needing reloading since some computed + // values in root.build may depend on the new configuration values. + // + dirty_ = true; } // Return the accumulated reflect values. @@ -93,6 +98,18 @@ namespace bpkg const package_name& name () const {return available_.get ().id.name;} + // Implementation details. + // + // We have to define these because context is forward-declared. Also, copy + // constructor has some special logic. + // + ~package_skeleton (); + package_skeleton (package_skeleton&&); + package_skeleton& operator= (package_skeleton&&); + + package_skeleton (const package_skeleton&); + package_skeleton& operator= (package_skeleton&) = delete; + private: // Create the skeleton if necessary and (re)load the build system state. // @@ -101,18 +118,9 @@ namespace bpkg void load (); - // Mark the build system state as needing reloading. - // - // Call this function after evaluating the reflect clause (since some - // computed values in root.build may depend on the new value). - // - void - dirty () - { - dirty_ = true; - } - private: + // NOTE: remember to update move/copy constructors! + // reference_wrapper db_; reference_wrapper available_; strings config_vars_; @@ -120,7 +128,8 @@ namespace bpkg optional src_root_; optional out_root_; - bool loaded_ = false; + unique_ptr ctx_; + bool created_ = false; bool dirty_ = false; strings reflect_; -- cgit v1.1