private void PopulateBuild(Dictionary <FileArtifact, FileContentInfo> samples, BxlBuild build) { int processed = 0; int errors = 0; Console.WriteLine($"Populating build with samples"); var stopWatch = Stopwatch.StartNew(); foreach (var artifactEntry in samples) { try { var artifact = artifactEntry.Key; var artifactInfo = artifactEntry.Value; var bxlArtifact = new BxlArtifact { Hash = artifactInfo.Hash.ToHex(), ReportedFile = artifact.Path.ToString(CachedGraph.Context.PathTable), ReportedSize = artifactInfo.Length }; if (m_artifactInputPips.TryGetValue(artifact, out var inputPipsForThisArtifact)) { foreach (var artifactPip in inputPipsForThisArtifact) { if (m_scheduledPipExecutionData.TryGetValue(artifactPip.PipId.Value, out var pipExecutionData)) { var executions = BuildBxlPipsFromExecutionData(artifactPip, pipExecutionData, m_scheduledPipDependencyCount, m_scheduledPipInputCount, m_scheduledPipOutputCount); foreach (var exec in executions) { bxlArtifact.InputPips.Add(exec); } } } } if (m_artifactOutputPips.TryGetValue(artifact, out var outputPipsForThisArtifact)) { foreach (var artifactPip in outputPipsForThisArtifact) { if (m_scheduledPipExecutionData.TryGetValue(artifactPip.PipId.Value, out var pipExecutionData)) { var executions = BuildBxlPipsFromExecutionData(artifactPip, pipExecutionData, m_scheduledPipDependencyCount, m_scheduledPipInputCount, m_scheduledPipOutputCount); foreach (var exec in executions) { bxlArtifact.OutputPips.Add(exec); } } } } build.Artifacts.Add(bxlArtifact); } #pragma warning disable ERP022 catch { ++errors; } #pragma warning restore ERP022 ++processed; } stopWatch.Stop(); Console.WriteLine($"Done, {processed} artifacts added in {stopWatch.ElapsedMilliseconds}ms ({errors} errors)"); }
/// <summary> /// Constructor /// </summary> public ArtifactWithBuildMeta(BxlBuildMeta meta, BxlArtifact artifact) { Meta = meta; Artifact = artifact; }