void blessInternal(BuildObject obj, string hashIfKnown, Disposition disp, VirtualContents contents) { Util.Assert(!theCache.ContainsKey(obj)); //- I don't think we should ever write the same file twice in one run. string hash = hashIfKnown; if (hash == null && disp is Fresh && !(obj is VirtualBuildObject)) { hash = _hasher.hash(obj.getFilesystemPath()); } theCache[obj] = new NuObjValue(hash, disp, contents); }
/// <summary> /// Add information about an object to the Repository. /// </summary> /// <param name="obj">The object to add.</param> /// <param name="disposition"> /// Disposition of the verb which created this object. /// </param> /// <param name="hash">Hash of the object's contents.</param> /// <param name="contents">Contents of the object (if virtual).</param> private void Add(BuildObject obj, Disposition disposition, string hash, VirtualContents contents) { // Every object in the repository should either have a hash value // or virtual contents, but not both. Util.Assert((string.IsNullOrEmpty(hash) && contents != null) || (!string.IsNullOrEmpty(hash) && (contents == null))); // Check to see if the object is already in this repository. if (this.entries.ContainsKey(obj)) { // We shouldn't be adding conflicting information for // the same object during the same build run. RepositoryEntry entry = this.entries[obj]; Util.Assert(entry.Disposition.GetType() == disposition.GetType()); Util.Assert(entry.Hash.Equals(hash, StringComparison.Ordinal)); Util.Assert(entry.VirtualContents == contents); // Don't replace existing entry with equivalent. return; } this.entries[obj] = new RepositoryEntry(disposition, hash, contents); }
/// <summary> /// Initializes a new instance of the RepositoryEntry class. /// </summary> /// <param name="disposition"> /// Disposition of the verb that created this object. /// </param> /// <param name="hash">Hash of the object's contents.</param> /// <param name="virtualContents"> /// Computed value of the object (if virtual, null otherwise). /// </param> public RepositoryEntry(Disposition disposition, string hash, VirtualContents virtualContents) { this.hash = hash; this.disposition = disposition; this.virtualContents = virtualContents; }
/// <summary> /// Add information about a virtual object to the Repository, /// including its contents. /// </summary> /// <param name="obj">The object in question.</param> /// <param name="disposition"> /// Disposition of the verb which created this object. /// </param> /// <param name="contents">Contents of the object.</param> public void StoreVirtual(BuildObject obj, Disposition disposition, VirtualContents contents) { Util.Assert(obj is VirtualBuildObject); this.Add(obj, disposition, null, contents); }
public void storeVirtual(BuildObject obj, Disposition disp, VirtualContents contents) { Util.Assert(obj is VirtualBuildObject); blessInternal(obj, null, disp, contents); }
public NuObjValue(string hash, Disposition disp, VirtualContents virtualContents) { this._hash = hash; this._disp = disp; this._virtualContents = virtualContents; }