X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftarget.h;h=d6ed43860315b1508356d66024d8852258f70af7;hb=9ab7e80ccd0a8043609d6a09f4119fa6e1d4ad9c;hp=d971a55bbd46f7dd8a444903a3477c69c02a8a2b;hpb=a176997a1377cf8260ab362d9df8f975035da0f5;p=builder.git diff --git a/source/target.h b/source/target.h index d971a55..d6ed438 100644 --- a/source/target.h +++ b/source/target.h @@ -7,12 +7,13 @@ #include #include -class Action; class Builder; +class Component; class Package; +class Task; +class Tool; class Target; -typedef std::list TargetList; /** Targets make up the build graph. This class is a base for all target types and @@ -20,29 +21,39 @@ handles many common tasks. See also FileTarget and VirtualTarget. */ class Target { +public: + typedef std::list Dependencies; + protected: + enum State + { + INIT, + PREPARING, + REBUILD, + BUILDING, + UPTODATE + }; + Builder &builder; const Package *package; + const Component *component; std::string name; - bool buildable; - bool building; - bool rebuild; + const Tool *tool; + State state; std::string rebuild_reason; + std::string install_location; - TargetList depends; - bool deps_ready; + Dependencies depends; - bool preparing; - bool prepared; - - Target(Builder &, const Package *, const std::string &); + Target(Builder &, const std::string &); public: virtual ~Target() { } virtual const char *get_type() const = 0; const std::string &get_name() const { return name; } const Package *get_package() const { return package; } + const Component *get_component() const { return component; } /** Tries to locate a target that will help getting this target built. If all @@ -59,18 +70,19 @@ public: */ virtual Target *get_real_target() { return this; } - bool is_buildable() const { return buildable; } - bool get_rebuild() const { return rebuild; } + void set_tool(const Tool &); + const Tool *get_tool() const { return tool; } + + bool is_buildable() const { return tool!=0; } + bool needs_rebuild() const { return state>PREPARING && state