// Value getting / setting public bool TryValueRecovery(out BuiltItem val) { // Need to be able to distinguish between "not cached" // and "error in checking build readiness" (~ "error // evaluating deps") val = BuiltItem.Null; proj.Log.PushLocation(target); if (CheckBuildReadiness()) { proj.Log.PopLocation(); return(true); } val = pi.pp.GetItem(basename); if (!val.IsValid) { goto done; } if (!val.Result.Check(pi.context)) { proj.Log.Log("project.external_invalid", basename); proj.Log.Warning(3008, "The cached result was not valid; rebuilding.", val.Result.ToString()); val = BuiltItem.Null; goto done; } if (val.IsFixed) { goto done; } if (cur_build_fp != val.BuildPrint) { val = BuiltItem.Null; goto done; } // Update the fingerprint in case that's needed. This can only // happen with results stored external to the state file (eg MBFiles); // might want a flag on Results to indicate whether they reference // data outside the cache. Save the new FP ASAP so any other references // this catch any changes to the value (so build fp's get updated // and things depending on this result get rebuilt). val.ResultPrint = val.Result.GetFingerprint(pi.context, val.ResultPrint); CacheValue(val); // We got it from the cache successfully we can do so in the future. proj.SetTargetState(tid, WrenchProject.TargetState.BuiltOk); done: proj.Log.PopLocation(); return(false); }
public void SetItem(string name, BuiltItem bi) { if (name == null) { throw new ArgumentNullException("Result with null name in StateTable.AddResult"); } items[name] = bi; }
public void FixValue(string basename, Result r, Fingerprint fp) { if (fp == null) { fp = r.GetFingerprint(context, null); } BuiltItem bi = new BuiltItem(r, fp, GenericFingerprints.Null); pp.SetItem(basename, bi); }
public BuiltItem[] EvaluateTargets(int[] targets) { BuiltItem[] bis = new BuiltItem[targets.Length]; for (int i = 0; i < targets.Length; i++) { //proj.Log.PushLocation (targets[i]); BuildServices bs = proj.GetTargetServices(targets[i]); //proj.Log.PopLocation (); if (bs == null) { return(null); } switch (proj.GetTargetState(targets[i])) { case WrenchProject.TargetState.BuiltOk: //Console.WriteLine ("EVAL {0}: from cache", targets[i]); bis[i] = bs.GetRawCachedValue(); break; case WrenchProject.TargetState.BuiltError: //Console.WriteLine ("EVAL {0}: errored", targets[i]); return(null); case WrenchProject.TargetState.Building: //Console.WriteLine ("EVAL {0}: recursed", targets[i]); bs.Logger.Error(2048, "Recursion in build; this target depends on " + targets[i] + " which is currently being built", null); return(null); default: //Console.WriteLine ("EVAL {0}: build it", targets[i]); // State unknown. Load from cache if possible, otherwise build. proj.Log.PushLocation(bs.FullName); bis[i] = WrenchOperations.BuildValue(proj, bs); proj.Log.PopLocation(); if (!bis[i].IsValid) { return(null); } break; } } return(bis); }
public static bool Clean(WrenchProject proj, BuildServices bs) { BuiltItem bi = bs.GetRawCachedValue(); if (!bi.IsValid) { return(false); } bs.Logger.Log("operation.clean", bs.FullName); if (bi.Result.Clean(bs.Context)) { // FIXME: rename to After DoBeforeClean(proj, bs); } bs.UncacheValue(); return(false); }
public void FixValue (string basename, Result r, Fingerprint fp) { if (fp == null) fp = r.GetFingerprint (context, null); BuiltItem bi = new BuiltItem (r, fp, GenericFingerprints.Null); pp.SetItem (basename, bi); }
public void CacheValue(BuiltItem res) { pi.pp.SetItem(basename, res); }
public void CacheValue (BuiltItem res) { pi.pp.SetItem (basename, res); }
// Value getting / setting public bool TryValueRecovery (out BuiltItem val) { // Need to be able to distinguish between "not cached" // and "error in checking build readiness" (~ "error // evaluating deps") val = BuiltItem.Null; proj.Log.PushLocation (target); if (CheckBuildReadiness ()) { proj.Log.PopLocation (); return true; } val = pi.pp.GetItem (basename); if (!val.IsValid) goto done; if (!val.Result.Check (pi.context)) { proj.Log.Log ("project.external_invalid", basename); proj.Log.Warning (3008, "The cached result was not valid; rebuilding.", val.Result.ToString ()); val = BuiltItem.Null; goto done; } if (val.IsFixed) goto done; if (cur_build_fp != val.BuildPrint) { val = BuiltItem.Null; goto done; } // Update the fingerprint in case that's needed. This can only // happen with results stored external to the state file (eg MBFiles); // might want a flag on Results to indicate whether they reference // data outside the cache. Save the new FP ASAP so any other references // this catch any changes to the value (so build fp's get updated // and things depending on this result get rebuilt). val.ResultPrint = val.Result.GetFingerprint (pi.context, val.ResultPrint); CacheValue (val); // We got it from the cache successfully we can do so in the future. proj.SetTargetState (tid, WrenchProject.TargetState.BuiltOk); done: proj.Log.PopLocation (); return false; }
public BuiltItem[] EvaluateTargets (int[] targets) { BuiltItem[] bis = new BuiltItem[targets.Length]; for (int i = 0; i < targets.Length; i++) { //proj.Log.PushLocation (targets[i]); BuildServices bs = proj.GetTargetServices (targets[i]); //proj.Log.PopLocation (); if (bs == null) return null; switch (proj.GetTargetState (targets[i])) { case WrenchProject.TargetState.BuiltOk: //Console.WriteLine ("EVAL {0}: from cache", targets[i]); bis[i] = bs.GetRawCachedValue (); break; case WrenchProject.TargetState.BuiltError: //Console.WriteLine ("EVAL {0}: errored", targets[i]); return null; case WrenchProject.TargetState.Building: //Console.WriteLine ("EVAL {0}: recursed", targets[i]); bs.Logger.Error (2048, "Recursion in build; this target depends on " + targets[i] + " which is currently being built", null); return null; default: //Console.WriteLine ("EVAL {0}: build it", targets[i]); // State unknown. Load from cache if possible, otherwise build. proj.Log.PushLocation (bs.FullName); bis[i] = WrenchOperations.BuildValue (proj, bs); proj.Log.PopLocation (); if (!bis[i].IsValid) return null; break; } } return bis; }
public void SetItem (string name, BuiltItem bi) { if (name == null) throw new ArgumentNullException ("Result with null name in StateTable.AddResult"); items[name] = bi; }