Beispiel #1
0
        private void ReportPreBuildDependency(List <FileModel> models, IHostService host, int parallelism, HashSet <string> includedTocs)
        {
            var nearest = new ConcurrentDictionary <string, RelativeInfo>(FilePathComparer.OSPlatformSensitiveStringComparer);

            models.RunAll(model =>
            {
                var item = (TocItemViewModel)model.Content;
                UpdateNearestToc(host, item, model, nearest);
            },
                          parallelism);

            // handle not-in-toc items
            UpdateNearestTocForNotInTocItem(models, host, nearest, parallelism);

            foreach (var item in nearest)
            {
                if (includedTocs.Contains(item.Key))
                {
                    host.ReportDependencyTo(item.Value.TocInfo.Model, item.Key, DependencyTypeName.Include);
                }
                else
                {
                    host.ReportDependencyFrom(item.Value.TocInfo.Model, item.Key, DependencyTypeName.Metadata);
                }
            }
        }
Beispiel #2
0
        private void ReportDependency(ImmutableList <FileModel> models, IHostService host, ImmutableDictionary <string, TocItemInfo> tocModelCache, int parallelism)
        {
            var nearest = new ConcurrentDictionary <string, Toc>(FilePathComparer.OSPlatformSensitiveStringComparer);

            models.RunAll(model =>
            {
                var wrapper = tocModelCache[model.OriginalFileAndType.FullPath];

                // If the TOC file is referenced by other TOC, not report dependency
                if (wrapper.IsReferenceToc)
                {
                    return;
                }
                var item = wrapper.Content;
                UpdateNearestToc(host, item, model, nearest);
            },
                          parallelism);

            // handle not-in-toc items
            UpdateNearestTocForNotInTocItem(models, host, nearest);

            foreach (var item in nearest)
            {
                host.ReportDependencyFrom(item.Value.Model, item.Key, DependencyTypeName.Metadata);
            }
        }
 public virtual void ReportUidDependency(FileModel model, IHostService host, TocItemViewModel item)
 {
     if (item.TopicUid != null)
     {
         host.ReportDependencyFrom(model, item.TopicUid, DependencyItemSourceType.Uid, DependencyTypeName.Metadata);
     }
     if (item.Items != null && item.Items.Count > 0)
     {
         foreach (var i in item.Items)
         {
             ReportUidDependency(model, host, i);
         }
     }
 }
Beispiel #4
0
 private void ReportUidDependency(IHostService host, TocItemViewModel item, FileModel toc)
 {
     if (item.TopicUid != null)
     {
         host.ReportDependencyFrom(toc, item.TopicUid, DependencyItemSourceType.Uid, DependencyTypeName.Metadata);
     }
     if (item.Items != null && item.Items.Count > 0)
     {
         foreach (var i in item.Items)
         {
             ReportUidDependency(host, i, toc);
         }
     }
 }