public DataHash DeriveHashKey(ICompiler comp, IEnumerable <string> args)
{
Logging.Emit("compiler is {0}", comp.CompilerExe);
var comphash = DigestCompiler(comp.CompilerExe);
if (comphash.Result == DataHashResult.Ok)
{
var srchash = hasher.DigestBinaryFile(comp.SingleSourceFile);
if (srchash.Result == DataHashResult.Ok)
{
var buf = new StringBuilder();
buf.AppendLine(CacheInfo.CacheFormat);
buf.AppendLine(srchash.Hash);
buf.AppendLine(comp.WorkingDirectory);
string incs = null;
comp.EnvironmentVariables.TryGetValue("INCLUDE", out incs);
if (incs != null)
{
buf.AppendLine(incs);
}
foreach (var a in args)
{
buf.AppendLine(a);
}
buf.AppendLine(comphash.Hash);
comphash = hasher.DigestString(buf.ToString());
}
}
return(comphash);
}