Ejemplo n.º 1
0
        private Dictionary <PipId, AbsolutePath> GetSealDirectoryToProjectMap(IEnumerable <Process> allProcesses)
        {
            return(Measure(
                       "Linking processes to sealed directories",
                       () =>
            {
                var sealDirectoryToProjectMap = new Dictionary <PipId, AbsolutePath>();
                foreach (var process in allProcesses)
                {
                    var processFolder = GetProjectFolder(process);
                    foreach (var dependent in PipGraph.RetrievePipReferenceImmediateDependents(process.PipId, PipType.SealDirectory))
                    {
                        if (processFolder == GetProjectFolder(dependent.HydratePip()))
                        {
                            if (!sealDirectoryToProjectMap.ContainsKey(dependent.PipId))
                            {
                                sealDirectoryToProjectMap.Add(dependent.PipId, processFolder);
                            }
                        }
                    }
                }

                return sealDirectoryToProjectMap;
            }));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Generates the PipMetadata for a given Pip
        /// </summary>
        public PipMetadata GeneratePipMetadata(Pip pip)
        {
            PipMetadata pipMetadata = new PipMetadata
            {
                PipId          = pip.PipId.Value,
                SemiStableHash = pip.FormattedSemiStableHash,
                PipType        = pip.PipType,
                Tags           = pip.Tags.IsValid ? pip.Tags.Select(tag => tag.ToString(StringTable)).ToList() : null
            };

            pipMetadata.Tags = pipMetadata.Tags.Any() ? pipMetadata.Tags : null;

            PipProvenance provenance = pip.Provenance;

            pipMetadata.Qualifier         = PipGraph.Context.QualifierTable.GetCanonicalDisplayString(provenance.QualifierId);
            pipMetadata.Usage             = provenance.Usage.IsValid ? provenance.Usage.ToString(PathTable) : null;
            pipMetadata.SpecFilePath      = provenance.Token.Path.ToString(PathTable);
            pipMetadata.OutputValueSymbol = provenance.OutputValueSymbol.ToString(SymbolTable);
            pipMetadata.ModuleId          = provenance.ModuleId.Value;
            pipMetadata.SpecFilePath      = provenance.Token.Path.ToString(PathTable);

            pipMetadata.PipDependencies = PipGraph.RetrievePipReferenceImmediateDependencies(pip.PipId, null)
                                          .Where(pipRef => pipRef.PipType != PipType.HashSourceFile)
                                          .Select(pipRef => pipRef.PipId)
                                          .Select(pipId => PipTable.HydratePip(pipId, PipQueryContext.ViewerAnalyzer))
                                          .Select(pipHash => pipHash.FormattedSemiStableHash)
                                          .ToList();

            pipMetadata.PipDependents = PipGraph.RetrievePipReferenceImmediateDependents(pip.PipId, null)
                                        .Select(pipRef => pipRef.PipId)
                                        .Select(pipId => PipTable.HydratePip(pipId, PipQueryContext.ViewerAnalyzer))
                                        .Select(pipData => pipData.FormattedSemiStableHash)
                                        .ToList();
            pipMetadata.PipDependencies = pipMetadata.PipDependencies.Any() ? pipMetadata.PipDependencies : null;
            pipMetadata.PipDependents   = pipMetadata.PipDependents.Any() ? pipMetadata.PipDependents : null;

            return(pipMetadata);
        }