From dafd592cf44c184f9d24e2216bbed5c23e4b23c2 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 7 Jun 2022 18:06:57 +0200 Subject: Refactor the way task names are looked up. --- src/task.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/task.h') diff --git a/src/task.h b/src/task.h index 47f4d1b..a43e08f 100644 --- a/src/task.h +++ b/src/task.h @@ -8,6 +8,7 @@ #include #include #include +#include #include "libctor.h" @@ -20,13 +21,18 @@ enum class State Error, }; +struct Settings; + class Task { public: - Task(const BuildConfiguration& config); + Task(const BuildConfiguration& config, const Settings& settings, + const std::string& sourceDir); int registerDepTasks(const std::set>& tasks); + bool operator==(const std::string& dep); + virtual std::string name() const; bool dirty(); bool ready(); @@ -34,8 +40,14 @@ public: State state() const; virtual int clean() = 0 ; virtual std::vector depends() const = 0; + + //! Raw target name as stated in ctor.cc config file or (in case of a derived + //! target) the calculated target without builddir prefix. virtual std::string target() const = 0; + //! Target file with full path prefix + virtual std::filesystem::path targetFile() const = 0; + //! Returns true for tasks that are non-target tasks, ie. for example derived //! objects files from target sources. virtual bool derived() const = 0; @@ -67,4 +79,6 @@ protected: TargetType target_type{TargetType::Auto}; Language source_language{Language::Auto}; OutputSystem output_system{OutputSystem::Host}; + const Settings& settings; + std::string sourceDir; }; -- cgit v1.2.3