public Generate ( HashSet |
||
processedAssemblyList | HashSet |
|
solutionExplorerRoot | Folder |
|
return | bool |
private static void IndexSolutions(IEnumerable<string> solutionFilePaths) { 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 federation = new Federation(); foreach (var path in solutionFilePaths) { using (Disposable.Timing("Generating " + path)) { using (var solutionGenerator = new SolutionGenerator( path, Paths.SolutionDestinationFolder, federation: federation)) { solutionGenerator.GlobalAssemblyList = assemblyNames; solutionGenerator.Generate(solutionExplorerRoot: mergedSolutionExplorerRoot); } } GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); } }
public void GenerateExternalReferences(HashSet <string> assemblyList) { var externalReferences = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); foreach (var project in solution.Projects) { var references = project.MetadataReferences .OfType <PortableExecutableReference>() .Where(m => File.Exists(m.FilePath) && !assemblyList.Contains(Path.GetFileNameWithoutExtension(m.FilePath)) && !IsPartOfSolution(Path.GetFileNameWithoutExtension(m.FilePath)) && GetExternalAssemblyIndex(Path.GetFileNameWithoutExtension(m.FilePath)) == -1 ) .Select(m => Path.GetFullPath(m.FilePath)); foreach (var reference in references) { externalReferences[Path.GetFileNameWithoutExtension(reference)] = reference; } } foreach (var externalReference in externalReferences) { Log.Write(externalReference.Key, ConsoleColor.Magenta); var solutionGenerator = new SolutionGenerator( externalReference.Value, Paths.SolutionDestinationFolder, pluginBlacklist: PluginBlacklist); solutionGenerator.Generate(assemblyList); } }
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) { var solutionGenerators = new List<SolutionGenerator>(); var assemblyNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase); foreach (var path in solutionFilePaths) { using (Disposable.Timing("Loading " + path)) { var solutionGenerator = new SolutionGenerator( path, Paths.SolutionDestinationFolder); solutionGenerators.Add(solutionGenerator); foreach (var assemblyName in solutionGenerator.GetAssemblyNames()) { assemblyNames.Add(assemblyName); } } } foreach (var solutionGenerator in solutionGenerators) { using (Disposable.Timing("Generating " + solutionGenerator.ProjectFilePath)) { solutionGenerator.GlobalAssemblyList = assemblyNames; solutionGenerator.Generate(solutionExplorerRoot: mergedSolutionExplorerRoot); } } }
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 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(); } }
public static void GenerateInvocation(CompilerInvocation invocation, IReadOnlyDictionary <string, string> serverPathMappings = null, HashSet <string> processedAssemblyList = null, HashSet <string> assemblyNames = null, Folder <ProjectSkeleton> solutionExplorerRoot = null) { try { if (invocation.Language == "TypeScript") { Log.Write("TypeScript invocation", ConsoleColor.Magenta); var typeScriptGenerator = new TypeScriptSupport(); typeScriptGenerator.Generate(invocation.TypeScriptFiles, Paths.SolutionDestinationFolder); } else if (invocation.ProjectFilePath != "-") { Log.Write(invocation.ProjectFilePath, ConsoleColor.Cyan); var solutionGenerator = new SolutionGenerator( invocation.ProjectFilePath, invocation.CommandLineArguments, invocation.OutputAssemblyPath, invocation.SolutionRoot, Paths.SolutionDestinationFolder, invocation.ServerPath, invocation.NetworkShare); solutionGenerator.ServerPathMappings = serverPathMappings; solutionGenerator.GlobalAssemblyList = assemblyNames; solutionGenerator.Generate(processedAssemblyList, solutionExplorerRoot); } else { Log.Write(invocation.OutputAssemblyPath, ConsoleColor.Magenta); var solutionGenerator = new SolutionGenerator( invocation.OutputAssemblyPath, Paths.SolutionDestinationFolder); solutionGenerator.Generate(); } } catch (Exception ex) { Log.Exception(ex, "Generating invocation: " + invocation.ProjectFilePath + " - " + invocation.OutputAssemblyPath); } }
public static void IndexSolutions(IEnumerable<string> solutionFilePaths, Dictionary<string, string> properties) { 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 federation = new Federation(); 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); if (Configuration.ProcessReferencies) Extend.ExtendGenerator.TopReferencedAssemblies(solutionGenerator, federation, mergedSolutionExplorerRoot); } } GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); } }
private static void IndexSolution(SolutionInfo solutionInfo, HashSet<string> assemblyList) { using (Disposable.Timing("Generating projects for " + Path.GetFileName(solutionInfo.SlnPath))) { bool needToCallAgain = false; // we need to call several times because it only processes projects one batch at a time // to avoid OutOfMemory on really large solutions do { GC.Collect(); var solutionGenerator = new SolutionGenerator( solutionInfo.SlnPath, Paths.SolutionDestinationFolder, solutionInfo.UrlRoot, solutionInfo.MSBuildProperties != null ? solutionInfo.MSBuildProperties.ToImmutableDictionary() : null, new Federation(Federation.FederatedIndexUrls)); needToCallAgain = solutionGenerator.Generate(assemblyList, mergedSolutionExplorerRoot); solutionGenerator.GenerateResultsHtml(assemblyList); } while (needToCallAgain); } }
public static void GenerateInvocation(CompilerInvocation invocation) { try { if (invocation.Language == "TypeScript") { Log.Write("TypeScript invocation", ConsoleColor.Magenta); var typeScriptGenerator = new TypeScriptSupport(); typeScriptGenerator.Generate(invocation.TypeScriptFiles, Paths.SolutionDestinationFolder); } else if (invocation.ProjectFilePath != "-") { Log.Write(invocation.ProjectFilePath, ConsoleColor.Cyan); var solutionGenerator = new SolutionGenerator( invocation.ProjectFilePath, invocation.CommandLineArguments, invocation.OutputAssemblyPath, invocation.SolutionRoot, Paths.SolutionDestinationFolder, invocation.ServerPath, invocation.NetworkShare); solutionGenerator.Generate(); } else { Log.Write(invocation.OutputAssemblyPath, ConsoleColor.Magenta); var solutionGenerator = new SolutionGenerator( invocation.OutputAssemblyPath, Paths.SolutionDestinationFolder); solutionGenerator.Generate(); } } catch (Exception ex) { Log.Exception(ex, "Generating invocation: " + invocation.ProjectFilePath + " - " + invocation.OutputAssemblyPath); } }
public static void GenerateInvocation(CompilerInvocation invocation) { try { if (invocation.Language == "TypeScript") { Log.Write("TypeScript invocation", ConsoleColor.Magenta); var typeScriptGenerator = new TypeScriptSupport(); typeScriptGenerator.Generate(invocation.TypeScriptFiles); } else if (invocation.ProjectFilePath != "-") { Log.Write(invocation.ProjectFilePath, ConsoleColor.Cyan); var solutionGenerator = new SolutionGenerator( invocation.ProjectFilePath, invocation.CommandLineArguments, invocation.OutputAssemblyPath, invocation.SolutionRoot, Paths.SolutionDestinationFolder, invocation.ServerPath, invocation.NetworkShare); solutionGenerator.Generate(); } else { Log.Write(invocation.OutputAssemblyPath, ConsoleColor.Magenta); var solutionGenerator = new SolutionGenerator( invocation.OutputAssemblyPath, Paths.SolutionDestinationFolder); solutionGenerator.Generate(); } } catch (Exception ex) { Log.Exception(ex, "Generating invocation: " + invocation.ProjectFilePath + " - " + invocation.OutputAssemblyPath); } }
private static void IndexSolutions(IEnumerable<string> solutionFilePaths, Dictionary<string, string> properties, Federation federation, Dictionary<string, string> serverPathMappings) { 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, serverPathMappings: serverPathMappings)) { 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 GetAssemblyNames(path)) { assemblyNames.Add(assemblyName); } } } var processedAssemblyList = new HashSet <string>(StringComparer.OrdinalIgnoreCase); foreach (var path in solutionFilePaths) { using (Disposable.Timing("Generating " + path)) { if (path.EndsWith(".binlog", StringComparison.OrdinalIgnoreCase) || path.EndsWith(".buildlog", StringComparison.OrdinalIgnoreCase)) { var invocations = BinLogCompilerInvocationsReader.ExtractInvocations(path); foreach (var invocation in invocations) { GenerateFromBuildLog.GenerateInvocation( invocation, serverPathMappings, processedAssemblyList, assemblyNames, mergedSolutionExplorerRoot); } continue; } using (var solutionGenerator = new SolutionGenerator( path, Paths.SolutionDestinationFolder, hostingPrefix: "/tools/game-scripts/", properties: properties.ToImmutableDictionary(), federation: federation, serverPathMappings: serverPathMappings, pluginBlacklist: pluginBlacklist, doNotIncludeReferencedProjects: doNotIncludeReferencedProjects)) { solutionGenerator.GlobalAssemblyList = assemblyNames; solutionGenerator.Generate(processedAssemblyList, mergedSolutionExplorerRoot); } } GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); } }
private static void IndexSolutions( IEnumerable <string> solutionFilePaths, IReadOnlyDictionary <string, string> properties, Federation federation, IReadOnlyDictionary <string, string> serverPathMappings, IEnumerable <string> pluginBlacklist, bool doNotIncludeReferencedProjects = false, string rootPath = null) { var assemblyNames = new HashSet <string>(StringComparer.OrdinalIgnoreCase); foreach (var path in solutionFilePaths) { using (Disposable.Timing("Reading assembly names from " + path)) { foreach (var assemblyName in GetAssemblyNames(path)) { assemblyNames.Add(assemblyName); } } } var processedAssemblyList = new HashSet <string>(StringComparer.OrdinalIgnoreCase); foreach (var path in solutionFilePaths) { var solutionFolder = mergedSolutionExplorerRoot; if (rootPath is object) { var relativePath = Paths.MakeRelativeToFolder(Path.GetDirectoryName(path), rootPath); var segments = relativePath.Split(new[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries); foreach (var segment in segments) { solutionFolder = solutionFolder.GetOrCreateFolder(segment); } } using (Disposable.Timing("Generating " + path)) { if (path.EndsWith(".binlog", StringComparison.OrdinalIgnoreCase) || path.EndsWith(".buildlog", StringComparison.OrdinalIgnoreCase)) { var invocations = BinLogCompilerInvocationsReader.ExtractInvocations(path); foreach (var invocation in invocations) { GenerateFromBuildLog.GenerateInvocation( invocation, serverPathMappings, processedAssemblyList, assemblyNames, solutionFolder); } continue; } using (var solutionGenerator = new SolutionGenerator( path, Paths.SolutionDestinationFolder, properties: properties.ToImmutableDictionary(), federation: federation, serverPathMappings: serverPathMappings, pluginBlacklist: pluginBlacklist, doNotIncludeReferencedProjects: doNotIncludeReferencedProjects)) { solutionGenerator.GlobalAssemblyList = assemblyNames; solutionGenerator.Generate(processedAssemblyList, solutionFolder); } } GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); } }
public void GenerateExternalReferences(HashSet<string> assemblyList) { var externalReferences = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); //Extend.ExtendGenerator.ExternalReferencesPrepare(this, assemblyList); foreach (var project in solution.Projects) { var references = project.MetadataReferences .OfType<PortableExecutableReference>() .Where(m => File.Exists(m.FilePath)) .Where(m => !assemblyList.Contains(Path.GetFileNameWithoutExtension(m.FilePath))) .Where(m => !IsPartOfSolution(Path.GetFileNameWithoutExtension(m.FilePath))) .Where(m => GetExternalAssemblyIndex(Path.GetFileNameWithoutExtension(m.FilePath)) == -1) .Select(m => Path.GetFullPath(m.FilePath)); foreach (var reference in references) { externalReferences[Path.GetFileNameWithoutExtension(reference)] = reference; } } foreach (var externalReference in externalReferences) { Log.Write(externalReference.Key, ConsoleColor.Magenta); var solutionGenerator = new SolutionGenerator( externalReference.Value, Paths.SolutionDestinationFolder); solutionGenerator.Generate(assemblyList); Extend.ExtendGenerator.ExternalReferences(solutionGenerator, assemblyList); } }
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 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) { if ( path.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) || path.EndsWith(".exe", StringComparison.OrdinalIgnoreCase) ) { continue; } 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)) { if (path.EndsWith(".binlog", StringComparison.OrdinalIgnoreCase) || path.EndsWith(".buildlog", StringComparison.OrdinalIgnoreCase)) { var invocations = BinLogCompilerInvocationsReader.ExtractInvocations(path); foreach (var invocation in invocations) { if (Path.GetFileName(invocation.ProjectDirectory) == "ref") { Log.Write($"Skipping Ref Assembly project {invocation.ProjectFilePath}"); continue; } if (Path.GetFileName(Path.GetDirectoryName(invocation.ProjectDirectory)) == "cycle-breakers") { Log.Write($"Skipping Wpf Cycle-Breaker project {invocation.ProjectFilePath}"); continue; } Log.Write($"Indexing Project: {invocation.ProjectFilePath}"); GenerateFromBuildLog.GenerateInvocation( invocation, serverPathMappings, processedAssemblyList, assemblyNames, mergedSolutionExplorerRoot, typeForwards); } continue; } 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(); } }