/// <summary> /// Computes a concrete identifier for a verb operation and its /// specific inputs. /// </summary> /// <param name="verb">The verb to compute the hash for.</param> /// <param name="assertHashAvailable"> /// Whether to assert if we can't compute the hash. /// </param> /// <returns> /// A concrete identifier for a verb operation and its specific inputs. /// </returns> private string computeInputHash(IVerb verb, bool assertHashAvailable) { StringBuilder sb = new StringBuilder(); sb.Append(verb.getAbstractIdentifier().getConcreteId()); DependencyDisposition ddisp; foreach (BuildObject obj in this.depCache.getDependencies(verb, out ddisp)) { sb.Append(","); string hash = this.repository.GetHash(obj); Util.Assert(!assertHashAvailable || (hash != null)); sb.Append(hash); } if (ddisp == DependencyDisposition.Failed) { // This happens when we're trying to markFailed, // but the upstream has failed and we can't compute // our dependencies. In that case, markFailed // settles for noting the failure in-process, // but not caching the result. (Okay, since this // failure propagation is cheap to rediscover.) Util.Assert(!assertHashAvailable); return(null); } Util.Assert(ddisp == DependencyDisposition.Complete); string rc = Util.hashString(sb.ToString()); return(rc); }
/// <summary> /// Prepares the working directory tree for a verb's execution. /// </summary> /// <param name="verb">The verb whose execution we're preparing for.</param> private void PrepareForVerb(WorkingDirectory workingDirectory, IVerb verb) { // Debugging aide: write out the abstract id for this verb. File.WriteAllText(workingDirectory.PathTo("Debug.txt"), verb.getAbstractIdentifier().ToString()); Repository repository = BuildEngine.theEngine.Repository; // Copy all verb inputs from the item cache to here. DependencyDisposition ddisp; foreach (BuildObject input in verb.getDependencies(out ddisp)) { if (!(input is VirtualBuildObject)) { workingDirectory.CreateDirectoryFor(input); // REVIEW: No longer needed? repository.Fetch(workingDirectory, input); } } // Ensures that the directory tree for each of the verb's outputs exists. foreach (BuildObject output in verb.getOutputs()) { workingDirectory.CreateDirectoryFor(output); } }
public override bool Equals(object obj) { IVerb other = obj as IVerb; if (other != null) { return(this.getAbstractIdentifier().Equals(other.getAbstractIdentifier())); } else { return(false); } }
public VerbOutputsContextVerb(IVerb parent, bool assertSuspiciousDafnyImpls) : base(parent.getAbstractIdentifier().ToString(), null) { this.parent = parent; this.assertSuspiciousDafnyImpls = assertSuspiciousDafnyImpls; }
/// <summary> /// Computes a concrete identifier for a verb operation and its /// specific inputs. /// </summary> /// <param name="verb">The verb to compute the hash for.</param> /// <param name="assertHashAvailable"> /// Whether to assert if we can't compute the hash. /// </param> /// <returns> /// A concrete identifier for a verb operation and its specific inputs. /// </returns> private string computeInputHash(IVerb verb, bool assertHashAvailable) { StringBuilder sb = new StringBuilder(); sb.Append(verb.getAbstractIdentifier().getConcreteId()); DependencyDisposition ddisp; foreach (BuildObject obj in this.depCache.getDependencies(verb, out ddisp)) { sb.Append(","); string hash = this.repository.GetHash(obj); Util.Assert(!assertHashAvailable || (hash != null)); sb.Append(hash); } if (ddisp == DependencyDisposition.Failed) { // This happens when we're trying to markFailed, // but the upstream has failed and we can't compute // our dependencies. In that case, markFailed // settles for noting the failure in-process, // but not caching the result. (Okay, since this // failure propagation is cheap to rediscover.) Util.Assert(!assertHashAvailable); return null; } Util.Assert(ddisp == DependencyDisposition.Complete); string rc = Util.hashString(sb.ToString()); return rc; }