Exemplo n.º 1
0
        private static void IndexSolutions(IEnumerable <string> solutionFilePaths, Dictionary <string, string> properties, Federation federation)
        {
            var assemblyNames = new HashSet <string>(StringComparer.OrdinalIgnoreCase);

            foreach (var path in solutionFilePaths)
            {
                using (Disposable.Timing("Reading assembly names from " + path))
                {
                    foreach (var assemblyName in AssemblyNameExtractor.GetAssemblyNames(path))
                    {
                        assemblyNames.Add(assemblyName);
                    }
                }
            }

            foreach (var path in solutionFilePaths)
            {
                using (Disposable.Timing("Generating " + path))
                {
                    using (var solutionGenerator = new SolutionGenerator(
                               path,
                               Paths.SolutionDestinationFolder,
                               properties: properties.ToImmutableDictionary(),
                               federation: federation))
                    {
                        solutionGenerator.GlobalAssemblyList = assemblyNames;
                        solutionGenerator.Generate(solutionExplorerRoot: mergedSolutionExplorerRoot);
                    }
                }

                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();
            }
        }
Exemplo n.º 2
0
        private static void IndexSolutions(
            IEnumerable <string> solutionFilePaths,
            Dictionary <string, string> properties,
            Federation federation,
            Dictionary <string, string> serverPathMappings,
            IEnumerable <string> pluginBlacklist,
            bool doNotIncludeReferencedProjects = false)
        {
            var assemblyNames = new HashSet <string>(StringComparer.OrdinalIgnoreCase);

            foreach (var path in solutionFilePaths)
            {
                using (Disposable.Timing("Reading assembly names from " + path))
                {
                    foreach (var assemblyName in AssemblyNameExtractor.GetAssemblyNames(path))
                    {
                        assemblyNames.Add(assemblyName);
                    }
                }
            }

            var processedAssemblyList = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
            var typeForwards          = new Dictionary <ValueTuple <string, string>, string>();

            var domain = AppDomain.CreateDomain("TypeForwards");

            foreach (var path in solutionFilePaths)
            {
                using (Disposable.Timing($"Reading type forwards from {path}"))
                {
                    GetTypeForwards(path, properties, typeForwards, domain);
                }
            }
            AppDomain.Unload(domain);
            domain = null;

            foreach (var path in solutionFilePaths)
            {
                using (Disposable.Timing("Generating " + path))
                {
                    using (var solutionGenerator = new SolutionGenerator(
                               path,
                               Paths.SolutionDestinationFolder,
                               properties: properties.ToImmutableDictionary(),
                               federation: federation,
                               serverPathMappings: serverPathMappings,
                               pluginBlacklist: pluginBlacklist,
                               doNotIncludeReferencedProjects: doNotIncludeReferencedProjects,
                               typeForwards: typeForwards))
                    {
                        solutionGenerator.GlobalAssemblyList = assemblyNames;
                        solutionGenerator.Generate(processedAssemblyList, mergedSolutionExplorerRoot);
                    }
                }

                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();
            }
        }
Exemplo n.º 3
0
        private static IEnumerable <string> GetAssemblyNames(string filePath)
        {
            if (filePath.EndsWith(".binlog", System.StringComparison.OrdinalIgnoreCase) ||
                filePath.EndsWith(".buildlog", System.StringComparison.OrdinalIgnoreCase))
            {
                var invocations = BinLogCompilerInvocationsReader.ExtractInvocations(filePath);
                return(invocations.Select(i => Path.GetFileNameWithoutExtension(i.Parsed.OutputFileName)).ToArray());
            }

            return(AssemblyNameExtractor.GetAssemblyNames(filePath));
        }
Exemplo n.º 4
0
        private static void IndexSolutions(IEnumerable <string> solutionFilePaths, ISet <string> excludedProjects, Dictionary <string, string> properties, Federation federation, Dictionary <string, string> serverPathMappings, IEnumerable <string> pluginBlacklist)
        {
            var assemblyNames = new HashSet <string>(StringComparer.OrdinalIgnoreCase);

            foreach (var path in solutionFilePaths)
            {
                using (Disposable.Timing("Reading assembly names from " + path))
                {
                    if (IsExludedProject(excludedProjects, path))
                    {
                        Log.Write("The project/solution is excluded: " + path, ConsoleColor.Yellow);
                        continue;
                    }

                    foreach (var assemblyName in AssemblyNameExtractor.GetAssemblyNames(path, excludedProjects))
                    {
                        assemblyNames.Add(assemblyName);
                        Log.Write("Assembly to process: " + assemblyName, ConsoleColor.Gray);
                    }
                }
            }

            var processedAssemblyList = new HashSet <string>(StringComparer.OrdinalIgnoreCase);

            foreach (var path in solutionFilePaths)
            {
                using (Disposable.Timing("Generating " + path))
                {
                    if (IsExludedProject(excludedProjects, path))
                    {
                        Log.Write("The project/solution is excluded: " + path, ConsoleColor.Yellow);
                        continue;
                    }

                    using (var solutionGenerator = new SolutionGenerator(
                               path,
                               Paths.SolutionDestinationFolder,
                               properties: properties.ToImmutableDictionary(),
                               federation: federation,
                               serverPathMappings: serverPathMappings,
                               pluginBlacklist: pluginBlacklist))
                    {
                        solutionGenerator.GlobalAssemblyList = assemblyNames;
                        solutionGenerator.Generate(processedAssemblyList, mergedSolutionExplorerRoot);
                    }
                }

                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();
            }
        }