Exemple #1
0
        private ObjectInfo DirectoryArtifactInfo(DirectoryArtifact d)
        {
            if (!d.IsValid)
            {
                return(new ObjectInfo("Invalid"));
            }

            var name    = d.Path.GetName(PathTable).ToString(StringTable);
            var kind    = d.IsSharedOpaque ? "shared opaque" : d.IsOutputDirectory() ? "exclusive opaque" : "source";
            var members = d.IsOutputDirectory()
                ? Analyzer.GetDirMembers(d, PipGraph.GetProducer(d))
                : d.PartialSealId > 0
                    ? PipGraph.ListSealedDirectoryContents(d).Select(f => f.Path)
                    : CollectionUtilities.EmptyArray <AbsolutePath>();

            return(new ObjectInfo(
                       preview: $"{name} [{kind}]",
                       properties: new[]
            {
                new Property("Path", d.Path.ToString(PathTable)),
                new Property("PartialSealId", d.PartialSealId),
                new Property("Kind", kind),
                d.IsOutputDirectory() ? new Property("Producer", () => Analyzer.GetPip(PipGraph.GetProducer(d))) : null,
                new Property("Consumers", PipGraph.GetConsumingPips(d)),
                new Property("Members", members)
            }
                       .Where(p => p != null)));
        }
Exemple #2
0
        private ObjectInfo FileArtifactInfo(FileArtifact f)
        {
            if (!f.IsValid)
            {
                return(new ObjectInfo("Invalid"));
            }

            return(new ObjectInfoBuilder()
                   .Preview(FileArtifactPreview(f))
                   .Prop("Path", f.Path.ToString(PathTable))
                   .Prop("Kind", f.IsSourceFile ? "source" : "output")
                   .Prop("RewriteCount", f.RewriteCount)
                   .Prop("FileContentInfo", () => Analyzer.TryGetFileContentInfo(f))
                   .Prop("Producer", () => f.IsOutputFile ? Analyzer.GetPip(PipGraph.GetProducer(f)) : null)
                   .Prop("Consumers", () => PipGraph.GetConsumingPips(f.Path))
                   .Build());
        }
Exemple #3
0
        private ObjectInfo FileArtifactInfo(FileArtifact f)
        {
            if (!f.IsValid)
            {
                return(new ObjectInfo("Invalid"));
            }

            return(new ObjectInfo(
                       preview: FileArtifactPreview(f),
                       properties: new[]
            {
                new Property("Path", f.Path.ToString(PathTable)),
                new Property("Kind", f.IsSourceFile ? "source" : "output"),
                new Property("RewriteCount", f.RewriteCount),
                new Property("FileContentInfo", () => Analyzer.TryGetFileContentInfo(f)),
                f.IsOutputFile ? new Property("Producer", () => Analyzer.GetPip(PipGraph.GetProducer(f))) : null,
                new Property("Consumers", () => PipGraph.GetConsumingPips(f.Path))
            }
                       .Where(p => p != null)));
        }
Exemple #4
0
        /// <nodoc />
        public ObjectInfo Render(Renderer renderer, object ctx, object obj)
        {
            switch (obj)
            {
            case AbsolutePath p:               return(new ObjectInfo(p.ToString(PathTable)));

            case Result result:                return(renderer.GetObjectInfo(ctx, result.IsScalar ? result.Value.First() : result.Value.ToArray()));

            case Function func:                return(new ObjectInfo("fun"));

            case PipsScope ps:                 return(PipsInfo(ps));

            case FileArtifact f:               return(FileArtifactInfo(f));

            case DirectoryArtifact d:          return(DirectoryArtifactInfo(d));

            case AnalyzePath ap:               return(AnalyzePathInfo(ap));

            case AnalyzeCriticalPath cp:       return(AnalyzeCriticalPathInfo());

            case PipId pipId:                  return(Render(renderer, ctx, Analyzer.GetPip(pipId)).WithPreview(pipId.ToString()));

            case PipReference pipRef:          return(Render(renderer, ctx, Analyzer.GetPip(pipRef.PipId)));

            case Process proc:                 return(ProcessInfo(proc));

            case Pip pip:                      return(PipInfo(pip).Build());

            case FileArtifactWithAttributes f: return(FileArtifactInfo(f.ToFileArtifact()));    // return GenericObjectInfo(f, preview: FileArtifactPreview(f.ToFileArtifact()));

            case ProcessMonitoringData m:      return(ProcessMonitoringInfo(m));

            case string s:                     return(new ObjectInfo(s));

            default:
                return(null);
            }
        }
Exemple #5
0
        private ObjectInfo DirectoryArtifactInfo(DirectoryArtifact d)
        {
            if (!d.IsValid)
            {
                return(new ObjectInfo("Invalid"));
            }

            var name = d.Path.GetName(PathTable).ToString(StringTable);
            var kind = d.IsSharedOpaque ? "shared opaque" : d.IsOutputDirectory() ? "exclusive opaque" : "source";

            return(new ObjectInfoBuilder()
                   .Preview($"{name} [{kind}]")
                   .Prop("Path", d.Path.ToString(PathTable))
                   .Prop("PartialSealId", d.PartialSealId)
                   .Prop("Kind", kind)
                   .Prop("Producer", () => d.IsOutputDirectory() ? Analyzer.GetPip(PipGraph.TryGetProducer(d)) : null)
                   .Prop("Consumers", PipGraph.GetConsumingPips(d))
                   .Prop("Members", () => d.IsOutputDirectory()
                    ? (object)Analyzer.GetDirMembers(d)
                    : d.PartialSealId > 0
                        ? PipGraph.ListSealedDirectoryContents(d).Select(f => f.Path)
                        : CollectionUtilities.EmptyArray <AbsolutePath>())
                   .Build());
        }
Exemple #6
0
        private ObjectInfoBuilder PipInfo(Pip pip)
        {
            var obi = new ObjectInfoBuilder();

            obi = s_pipProperties.Aggregate(obi, (acc, pi) => acc.Prop(pi.Name, () => pi.GetValue(pip)));
            obi = s_pipFields.Aggregate(obi, (acc, fi) => acc.Prop(fi.Name, () => fi.GetValue(pip)));
            return(obi
                   .Prop("DownstreamPips", CachedGraph.DataflowGraph.GetOutgoingEdges(pip.PipId.ToNodeId()).Cast <Edge>().Select(e => Analyzer.GetPip(e.OtherNode.ToPipId())))
                   .Prop("UpstreamPips", CachedGraph.DataflowGraph.GetIncomingEdges(pip.PipId.ToNodeId()).Cast <Edge>().Select(e => Analyzer.GetPip(e.OtherNode.ToPipId())))
                   .Preview(PipPreview(pip)));
        }
Exemple #7
0
 private IEnumerable <Property> GetPipDownAndUpStreamProperties(Pip pip)
 {
     return(new[]
     {
         new Property("DownstreamPips", CachedGraph.DataflowGraph.GetOutgoingEdges(pip.PipId.ToNodeId()).Cast <Edge>().Select(e => Analyzer.GetPip(e.OtherNode.ToPipId()))),
         new Property("UpstreamPips", CachedGraph.DataflowGraph.GetIncomingEdges(pip.PipId.ToNodeId()).Cast <Edge>().Select(e => Analyzer.GetPip(e.OtherNode.ToPipId()))),
     });
 }