/* $Id$
This file is part of builder
-Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
+Copyright © 2007-2009 Mikko Rasa, Mikkosoft Productions
Distributed under the LGPL
*/
changed(false)
{ }
+void DependencyCache::set_deps(const string &tgt, const StringList &d)
+{
+ deps[tgt] = d;
+ changed = true;
+}
+
const StringList &DependencyCache::get_deps(const string &tgt) const
{
- DepsMap::const_iterator i=deps.find(tgt);
+ DepsMap::const_iterator i = deps.find(tgt);
if(i==deps.end())
throw KeyError("Unknown dependencies", tgt);
return i->second;
}
-void DependencyCache::set_deps(const string &tgt, const StringList &d)
-{
- deps[tgt]=d;
- changed=true;
-}
-
-/**
-Saves the depencency cache. If there are no cached dependencies or they
-haven't been changed, does nothing.
-*/
void DependencyCache::save() const
{
if(deps.empty() || !changed || package.get_builder().get_dry_run())
void DependencyCache::load()
{
- string fn=(package.get_source()/".deps").str();
+ string fn = (package.get_source()/".deps").str();
try
{
string line;
while(in.getline(line))
{
- vector<string> parts=split(line, '|');
- deps[parts[0]]=StringList(parts.begin()+1, parts.end());
+ vector<string> parts = split(line, '|');
+ deps[parts[0]] = StringList(parts.begin()+1, parts.end());
}
- mtime=Time::TimeStamp::from_unixtime(FS::stat(fn).st_mtime);
+ mtime = Time::TimeStamp::from_unixtime(FS::stat(fn).st_mtime);
}
- catch(const IO::FileNotFound &)
+ catch(const IO::file_not_found &)
{ }
}