private string GetAssemblyNameFromProject(string projectFilePath) { string assemblyName = null; lock (projectFilePathToAssemblyNameCache) { if (projectFilePathToAssemblyNameCache.TryGetValue(projectFilePath, out assemblyName)) { return(assemblyName); } } assemblyName = AssemblyNameExtractor.GetAssemblyNameFromProject(projectFilePath); if (assemblyName == null) { Log.Exception("Couldn't extract AssemblyName from project: " + projectFilePath); } else { lock (projectFilePathToAssemblyNameCache) { projectFilePathToAssemblyNameCache[projectFilePath] = assemblyName; } } return(assemblyName); }
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(); } }
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(); } }
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)); }
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(); } }