#pragma once #include #include #include #include #include #include #include #include "LanguageSettings.h" #include "ProcessRunner.h" class Builder { public: Builder(const boost::property_tree::ptree& ptree, const std::string& target); void build(); void run_tests(); void clean(); private: std::unordered_map> get_dependencies(const boost::property_tree::ptree& ptree, bool include_sources = true) const; std::vector dependencies_of(const std::filesystem::path& p) const; std::vector include_paths_of_object(const std::filesystem::path& p) const; std::filesystem::path target_from_object(const std::filesystem::path& object) const; std::vector link_libs_of(const std::filesystem::path& p) const; bool is_outdated(const std::filesystem::path& p) const; bool is_outdated(const std::filesystem::path& p, const std::vector &dependencies) const; std::vector make_depfile_from(const std::filesystem::path& p) const; std::filesystem::path get_compile_unit_source_from_object(const std::filesystem::path& path); std::unordered_set get_buildlist(std::function outdated_pred); void build_file(const std::filesystem::path& p); void build_filelist(); void cleanup_buildlist(); const boost::property_tree::ptree _ptree; std::string _target; std::vector _all_targets; std::vector _all_objects; std::unordered_map> _dependencies; std::unordered_map> _include_paths; std::unordered_map> _link_libs; LanguageSettings _lang; ProcessRunner _runner; std::unordered_set _buildlist; // build done std::unordered_set _activelist; // currently building std::unordered_set _donelist; // build done };