diff options
Diffstat (limited to 'task.h')
-rw-r--r-- | task.h | 60 |
1 files changed, 0 insertions, 60 deletions
@@ -1,60 +0,0 @@ -// -*- c++ -*- -#pragma once - -#include <vector> -#include <string> -#include <atomic> -#include <list> -#include <memory> - -#include "libcppbuild.h" - -enum class State -{ - Unknown, - Ready, - Running, - Done, - Error, -}; - -class Task -{ -public: - Task(const BuildConfiguration& config, - const std::vector<std::string>& depends = {}); - - int registerDepTasks(const std::list<std::shared_ptr<Task>>& tasks); - - virtual std::string name() const; - bool dirty(); - bool ready(); - int run(); - State state() const; - virtual int clean() = 0 ; - virtual std::vector<std::string> depends() const = 0; - virtual std::string target() const = 0; - - virtual std::string toJSON() const { return {}; }; - - const BuildConfiguration& buildConfig() const; - - TargetType targetType() const; - Language sourceLanguage() const; - OutputSystem outputSystem() const; - std::string compiler() const; - - std::list<std::shared_ptr<Task>> getDependsTasks(); - -protected: - std::atomic<State> task_state{State::Unknown}; - virtual int runInner() { return 0; }; - virtual bool dirtyInner() { return false; } - - std::vector<std::string> dependsStr; - std::list<std::shared_ptr<Task>> dependsTasks; - const BuildConfiguration& config; - TargetType target_type{TargetType::Auto}; - Language source_language{Language::Auto}; - OutputSystem output_system{OutputSystem::Host}; -}; |