if(!needs_rebuild() && package && package->get_config().get_mtime()>mtime)
mark_rebuild("Package options changed");
}
+
+Task *FileTarget::build()
+{
+ if(tool && !builder.get_dry_run() && mtime)
+ FS::unlink(path);
+
+ return Target::build();
+}
protected:
virtual void check_rebuild();
+
+public:
+ virtual Task *build();
};
#endif
return 0;
}
- // XXX Minor breach of OO here
- if(FileTarget *ft = dynamic_cast<FileTarget *>(this))
- if(!builder.get_dry_run() && FS::exists(ft->get_path()))
- FS::unlink(ft->get_path());
-
Task *task = tool->run(*this);
task->signal_finished.connect(sigc::mem_fun(this, &Target::build_finished));
state = BUILDING;
/** Invokes the associated Tool to build the target and returns the
resulting Task. The task must be started by the caller. */
- Task *build();
+ virtual Task *build();
protected:
/** Handler for Task::signal_finished. */