Пример #1
0
        private static void LoadItems(
            ProjectAssets projectAssets,
            Dictionary <string, TargetItemAssets> map,
            TargetItemAssets item,
            HashSet <string> compileItems,
            HashSet <TargetItemAssets> loaded,
            Func <TargetItemAssets, IEnumerable <string> > itemsGetter)
        {
            loaded.Add(item);

            if (item.Dependencies != null)
            {
                foreach (var dependency in item.Dependencies)
                {
                    // var depItem = map[$"{dependency.Key}/{dependency.Value}"];
                    var depItem = map[$"{dependency.Key}"];
                    if (!loaded.Contains(depItem))
                    {
                        LoadItems(projectAssets, map, depItem, compileItems, loaded, itemsGetter);
                    }
                }
            }

            var dllItems = itemsGetter(item);

            if (dllItems != null)
            {
                foreach (var dllItem in dllItems.Where(s => !s.EndsWith("_._", StringComparison.InvariantCulture)))
                {
                    compileItems.Add(Path.Combine(projectAssets.Libraries[item.Name].Path, dllItem));
                }
            }
        }
Пример #2
0
        private IEnumerable <string> GetAllPackageDllItems(
            ProjectAssets projectAssets,
            Func <TargetItemAssets, IEnumerable <string> > itemsGetter)
        {
            if (projectAssets == null)
            {
                throw new ArgumentNullException(nameof(projectAssets));
            }

            var map = new Dictionary <string, TargetItemAssets>();

            foreach (var item in this.GetAllTargetItemAssets())
            {
                // map.Add(item.Name, item);
                map.Add(item.Name.Split('/').First(), item);
            }

            var compileItems = new HashSet <string>();
            var loaded       = new HashSet <TargetItemAssets>();

            foreach (var item in map.Values)
            {
                LoadItems(projectAssets, map, item, compileItems, loaded, itemsGetter);
            }

            return(compileItems);
        }
Пример #3
0
 /// <summary>
 /// Gets all package compile items.
 /// </summary>
 /// <param name="projectAssets">The project assets.</param>
 /// <returns>All package compile items.</returns>
 public IEnumerable <string> GetAllPackageCompileItems(ProjectAssets projectAssets)
 {
     return(this.GetAllPackageDllItems(projectAssets, item => item.CompileItems));
 }