/// <summary> /// Creates a new PipConstructionHelper /// </summary> /// <remarks> /// Ideally this function would take ModuleId, FullSymbol QualifierId and compute uniqueOutputLocation itself. Unfortunately today the data is not yet /// exposed via IPipGraph, therefore the responsibility is on the call site for now. /// </remarks> public static PipConstructionHelper Create( PipExecutionContext context, AbsolutePath objectRoot, AbsolutePath redirectedRoot, AbsolutePath tempRoot, IMutablePipGraph pipGraph, ModuleId moduleId, string moduleName, RelativePath specRelativePath, FullSymbol symbol, LocationData thunkLocation, QualifierId qualifierId) { var stringTable = context.StringTable; var pathTable = context.PathTable; // We have to manually compute the pipPipUniqueString here, Ideally we pass PackageId, SpecFile, FullSymbol and qualiferId and have it computed inside, but the IPipGraph does not allow querying it for now. string hashString; long semiStableHashSeed = 0; using (var builderWrapper = Pools.GetStringBuilder()) { var builder = builderWrapper.Instance; builder.Append(moduleName); builder.Append('/'); semiStableHashSeed = HashCodeHelper.GetOrdinalHashCode64(moduleName); if (specRelativePath.IsValid) { string specPath = specRelativePath.ToString(stringTable); builder.Append(specPath); builder.Append('/'); semiStableHashSeed = HashCodeHelper.Combine(semiStableHashSeed, HashCodeHelper.GetOrdinalHashCode64(specPath)); } var symbolName = symbol.ToStringAsCharArray(context.SymbolTable); builder.Append(symbolName); builder.Append('/'); semiStableHashSeed = HashCodeHelper.Combine(semiStableHashSeed, HashCodeHelper.GetOrdinalHashCode64(symbolName)); var qualifierDisplayValue = context.QualifierTable.GetCanonicalDisplayString(qualifierId); builder.Append(qualifierDisplayValue); semiStableHashSeed = HashCodeHelper.Combine(semiStableHashSeed, HashCodeHelper.GetOrdinalHashCode64(qualifierDisplayValue)); var pipPipUniqueString = builder.ToString(); hashString = Hash(pipPipUniqueString); } var pipRelativePath = RelativePath.Create( PathAtom.Create(stringTable, hashString.Substring(0, 1)), PathAtom.Create(stringTable, hashString.Substring(1, 1)), PathAtom.Create(stringTable, hashString.Substring(2))); var valuePip = new ValuePip(symbol, qualifierId, thunkLocation); return(new PipConstructionHelper( context, objectRoot, redirectedRoot, tempRoot, pipGraph, moduleId, moduleName, valuePip, pipRelativePath, semiStableHashSeed)); }