let digest_rule r dyndeps action =
let buf = Buffer.create 1024 in
Buffer.add_string buf action.digest;
let add_resource r = Buffer.add_string buf (Resource.digest r) in
Buffer.add_string buf "prods:";
List.iter add_resource r.prods;
Buffer.add_string buf "deps:";
List.iter add_resource r.deps;
Buffer.add_string buf "dyndeps:";
Resources.iter add_resource dyndeps;
Digest.string (Buffer.contents buf)