public static PrepareDestinationFolder ( bool forceOverwrite = false ) : void | ||
forceOverwrite | bool | |
Результат | void |
private static void Main(string[] args) { var options = CommandLineOptions.Parse(args); if (options.Projects.Count == 0) { PrintUsage(); return; } Paths.SolutionDestinationFolder = options.SolutionDestinationFolder; SolutionGenerator.LoadPlugins = options.LoadPlugins; SolutionGenerator.ExcludeTests = options.ExcludeTests; AssertTraceListener.Register(); AppDomain.CurrentDomain.FirstChanceException += FirstChanceExceptionHandler.HandleFirstChanceException; // This loads the real MSBuild from the toolset so that all targets and SDKs can be found // as if a real build is happening MSBuildLocator.RegisterDefaults(); if (Paths.SolutionDestinationFolder == null) { Paths.SolutionDestinationFolder = Path.Combine(Microsoft.SourceBrowser.Common.Paths.BaseAppFolder, "index"); } var websiteDestination = Paths.SolutionDestinationFolder; // Warning, this will delete and recreate your destination folder Paths.PrepareDestinationFolder(options.Force); Paths.SolutionDestinationFolder = Path.Combine(Paths.SolutionDestinationFolder, "index"); //The actual index files need to be written to the "index" subdirectory Directory.CreateDirectory(Paths.SolutionDestinationFolder); Log.ErrorLogFilePath = Path.Combine(Paths.SolutionDestinationFolder, Log.ErrorLogFile); Log.MessageLogFilePath = Path.Combine(Paths.SolutionDestinationFolder, Log.MessageLogFile); using (Disposable.Timing("Generating website")) { var federation = new Federation(); if (!options.NoBuiltInFederations) { federation.AddFederations(Federation.DefaultFederatedIndexUrls); } federation.AddFederations(options.Federations); foreach (var entry in options.OfflineFederations) { federation.AddFederation(entry.Key, entry.Value); } IndexSolutions(options.Projects, options.Properties, federation, options.ServerPathMappings, options.PluginBlacklist, options.DoNotIncludeReferencedProjects, options.RootPath); FinalizeProjects(options.EmitAssemblyList, federation); WebsiteFinalizer.Finalize(websiteDestination, options.EmitAssemblyList, federation); } Log.Close(); }
private static void Main(string[] args) { if (args.Length == 0) { PrintUsage(); return; } var projects = new List <string>(); var properties = new Dictionary <string, string>(); var emitAssemblyList = false; var doNotIncludeReferencedProjects = false; var force = false; var noBuiltInFederations = false; var offlineFederations = new Dictionary <string, string>(); var federations = new HashSet <string>(); var serverPathMappings = new Dictionary <string, string>(); var pluginBlacklist = new List <string>(); foreach (var arg in args) { if (arg.StartsWith("/out:")) { Paths.SolutionDestinationFolder = Path.GetFullPath(arg.Substring("/out:".Length).StripQuotes()); continue; } if (arg.StartsWith("/serverPath:")) { var mapping = arg.Substring("/serverPath:".Length).StripQuotes(); var parts = mapping.Split('='); if (parts.Length != 2) { Log.Write($"Invalid Server Path: '{mapping}'", ConsoleColor.Red); continue; } serverPathMappings.Add(Path.GetFullPath(parts[0]), parts[1]); continue; } if (arg == "/force") { force = true; continue; } if (arg.StartsWith("/in:")) { string inputPath = arg.Substring("/in:".Length).StripQuotes(); try { if (!File.Exists(inputPath)) { continue; } string[] paths = File.ReadAllLines(inputPath); foreach (string path in paths) { AddProject(projects, path); } } catch { Log.Write("Invalid argument: " + arg, ConsoleColor.Red); } continue; } if (arg.StartsWith("/p:")) { var match = Regex.Match(arg, "/p:(?<name>[^=]+)=(?<value>.+)"); if (match.Success) { var propertyName = match.Groups["name"].Value; var propertyValue = match.Groups["value"].Value; properties.Add(propertyName, propertyValue); continue; } } if (arg == "/assemblylist") { emitAssemblyList = true; continue; } if (string.Equals(arg, "/donotincludereferencedprojects", StringComparison.OrdinalIgnoreCase)) { doNotIncludeReferencedProjects = true; continue; } if (arg == "/nobuiltinfederations") { noBuiltInFederations = true; Log.Message("Disabling built-in federations."); continue; } if (arg.StartsWith("/federation:")) { string server = arg.Substring("/federation:".Length); Log.Message($"Adding federation '{server}'."); federations.Add(server); continue; } if (arg.StartsWith("/offlinefederation:")) { var match = Regex.Match(arg, "/offlinefederation:(?<server>[^=]+)=(?<file>.+)"); if (match.Success) { var server = match.Groups["server"].Value; var assemblyListFileName = match.Groups["file"].Value; offlineFederations[server] = assemblyListFileName; Log.Message($"Adding federation '{server}' (offline from '{assemblyListFileName}')."); continue; } continue; } if (string.Equals(arg, "/noplugins", StringComparison.OrdinalIgnoreCase)) { SolutionGenerator.LoadPlugins = false; continue; } if (string.Equals(arg, "/useplugins", StringComparison.OrdinalIgnoreCase)) { SolutionGenerator.LoadPlugins = true; continue; } if (arg.StartsWith("/noplugin:")) { pluginBlacklist.Add(arg.Substring("/noplugin:".Length)); continue; } if (arg == "/excludetests") { SolutionGenerator.ExcludeTests = true; continue; } try { AddProject(projects, arg); } catch (Exception ex) { Log.Write("Exception: " + ex.ToString(), ConsoleColor.Red); } } if (projects.Count == 0) { PrintUsage(); return; } AssertTraceListener.Register(); AppDomain.CurrentDomain.FirstChanceException += FirstChanceExceptionHandler.HandleFirstChanceException; // This loads the real MSBuild from the toolset so that all targets and SDKs can be found // as if a real build is happening MSBuildLocator.RegisterDefaults(); if (Paths.SolutionDestinationFolder == null) { Paths.SolutionDestinationFolder = Path.Combine(Microsoft.SourceBrowser.Common.Paths.BaseAppFolder, "index"); } var websiteDestination = Paths.SolutionDestinationFolder; // Warning, this will delete and recreate your destination folder Paths.PrepareDestinationFolder(force); Paths.SolutionDestinationFolder = Path.Combine(Paths.SolutionDestinationFolder, "index"); //The actual index files need to be written to the "index" subdirectory Directory.CreateDirectory(Paths.SolutionDestinationFolder); Log.ErrorLogFilePath = Path.Combine(Paths.SolutionDestinationFolder, Log.ErrorLogFile); Log.MessageLogFilePath = Path.Combine(Paths.SolutionDestinationFolder, Log.MessageLogFile); using (Disposable.Timing("Generating website")) { var federation = new Federation(); if (!noBuiltInFederations) { federation.AddFederations(Federation.DefaultFederatedIndexUrls); } federation.AddFederations(federations); foreach (var entry in offlineFederations) { federation.AddFederation(entry.Key, entry.Value); } IndexSolutions(projects, properties, federation, serverPathMappings, pluginBlacklist, doNotIncludeReferencedProjects); FinalizeProjects(emitAssemblyList, federation); WebsiteFinalizer.Finalize(websiteDestination, emitAssemblyList, federation); } Log.Close(); }
private static void Main(string[] args) { if (args.Length == 0) { PrintUsage(); return; } var projects = new List <string>(); var properties = new Dictionary <string, string>(); foreach (var arg in args) { if (arg.StartsWith("/out:")) { Paths.SolutionDestinationFolder = Path.GetFullPath(arg.Substring("/out:".Length).StripQuotes()); continue; } if (arg.StartsWith("/in:")) { string inputPath = arg.Substring("/in:".Length).StripQuotes(); try { if (!File.Exists(inputPath)) { continue; } string[] paths = File.ReadAllLines(inputPath); foreach (string path in paths) { AddProject(projects, path); } } catch { Log.Write("Invalid argument: " + arg, ConsoleColor.Red); } continue; } if (arg.StartsWith("/p:")) { var match = Regex.Match(arg, "/p:(?<name>[^=]+)=(?<value>.+)"); if (match.Success) { var propertyName = match.Groups["name"].Value; var propertyValue = match.Groups["value"].Value; properties.Add(propertyName, propertyValue); continue; } } try { AddProject(projects, arg); } catch (Exception ex) { Log.Write("Exception: " + ex.ToString(), ConsoleColor.Red); } } if (projects.Count == 0) { PrintUsage(); return; } AssertTraceListener.Register(); AppDomain.CurrentDomain.FirstChanceException += FirstChanceExceptionHandler.HandleFirstChanceException; if (Paths.SolutionDestinationFolder == null) { Paths.SolutionDestinationFolder = Path.Combine(Microsoft.SourceBrowser.Common.Paths.BaseAppFolder, "Index"); } Log.ErrorLogFilePath = Path.Combine(Paths.SolutionDestinationFolder, Log.ErrorLogFile); Log.MessageLogFilePath = Path.Combine(Paths.SolutionDestinationFolder, Log.MessageLogFile); // Warning, this will delete and recreate your destination folder Paths.PrepareDestinationFolder(); using (Disposable.Timing("Generating website")) { IndexSolutions(projects, properties); FinalizeProjects(); } }
private static void Main(string[] args) { if (args.Length == 0) { PrintUsage(); return; } var projects = new List <string>(); var properties = new Dictionary <string, string>(); var emitAssemblyList = false; var force = false; var noBuiltInFederations = false; var offlineFederations = new Dictionary <string, string>(); var federations = new HashSet <string>(); var serverPathMappings = new Dictionary <string, string>(); foreach (var arg in args) { if (arg.StartsWith("/out:")) { Paths.SolutionDestinationFolder = Path.GetFullPath(arg.Substring("/out:".Length).StripQuotes()); continue; } if (arg.StartsWith("/serverPath:")) { var mapping = arg.Substring("/serverPath:".Length).StripQuotes(); var parts = mapping.Split('='); if (parts.Length != 2) { Log.Write($"Invalid Server Path: '{mapping}'", ConsoleColor.Red); continue; } serverPathMappings.Add(Path.GetFullPath(parts[0]), parts[1]); continue; } if (arg == "/force") { force = true; continue; } if (arg.StartsWith("/in:")) { string inputPath = arg.Substring("/in:".Length).StripQuotes(); try { if (!File.Exists(inputPath)) { continue; } string[] paths = File.ReadAllLines(inputPath); foreach (string path in paths) { AddProject(projects, path); } } catch { Log.Write("Invalid argument: " + arg, ConsoleColor.Red); } continue; } if (arg.StartsWith("/p:")) { var match = Regex.Match(arg, "/p:(?<name>[^=]+)=(?<value>.+)"); if (match.Success) { var propertyName = match.Groups["name"].Value; var propertyValue = match.Groups["value"].Value; properties.Add(propertyName, propertyValue); continue; } } if (arg == "/assemblylist") { emitAssemblyList = true; continue; } if (arg == "/nobuiltinfederations") { noBuiltInFederations = true; Log.Message("Disabling built-in federations."); continue; } if (arg.StartsWith("/federation:")) { string server = arg.Substring("/federation:".Length); Log.Message($"Adding federation '{server}'."); federations.Add(server); continue; } if (arg.StartsWith("/offlinefederation:")) { var match = Regex.Match(arg, "/offlinefederation:(?<server>[^=]+)=(?<file>.+)"); if (match.Success) { var server = match.Groups["server"].Value; var assemblyListFileName = match.Groups["file"].Value; offlineFederations[server] = assemblyListFileName; Log.Message($"Adding federation '{server}' (offline from '{assemblyListFileName}')."); continue; } continue; } try { AddProject(projects, arg); } catch (Exception ex) { Log.Write("Exception: " + ex.ToString(), ConsoleColor.Red); } } if (projects.Count == 0) { PrintUsage(); return; } AssertTraceListener.Register(); AppDomain.CurrentDomain.FirstChanceException += FirstChanceExceptionHandler.HandleFirstChanceException; if (Paths.SolutionDestinationFolder == null) { Paths.SolutionDestinationFolder = Path.Combine(Microsoft.SourceBrowser.Common.Paths.BaseAppFolder, "Index"); } Log.ErrorLogFilePath = Path.Combine(Paths.SolutionDestinationFolder, Log.ErrorLogFile); Log.MessageLogFilePath = Path.Combine(Paths.SolutionDestinationFolder, Log.MessageLogFile); // Warning, this will delete and recreate your destination folder Paths.PrepareDestinationFolder(force); using (Disposable.Timing("Generating website")) { var federation = noBuiltInFederations ? new Federation(null) : new Federation(federations); foreach (var entry in offlineFederations) { federation.AddFederation(entry.Key, entry.Value); } IndexSolutions(projects, properties, federation, serverPathMappings); FinalizeProjects(emitAssemblyList, federation); } }
private static void Main(string[] args) { if (args.Length == 0) { PrintUsage(); return; } var versionDisplayText = string.Empty; var projects = new List <string>(); foreach (var arg in args) { if (arg.StartsWith("/ver:")) { versionDisplayText = arg.Substring("/ver:".Length).StripQuotes().Trim(); continue; } if (arg.StartsWith("/out:")) { Paths.SolutionDestinationFolder = arg.Substring("/out:".Length).StripQuotes(); continue; } if (arg.StartsWith("/in:")) { string inputPath = arg.Substring("/in:".Length).StripQuotes(); try { if (!File.Exists(inputPath)) { continue; } string[] paths = File.ReadAllLines(inputPath); foreach (string path in paths) { AddProject(projects, path); } } catch { Log.Write("Invalid argument: " + arg, ConsoleColor.Red); } continue; } try { AddProject(projects, arg); } catch (Exception ex) { Log.Write("Exception: " + ex.ToString(), ConsoleColor.Red); } } if (projects.Count == 0) { PrintUsage(); return; } AssertTraceListener.Register(); AppDomain.CurrentDomain.FirstChanceException += FirstChanceExceptionHandler.HandleFirstChanceException; if (Paths.SolutionDestinationFolder == null) { Paths.SolutionDestinationFolder = Path.Combine(Microsoft.SourceBrowser.Common.Paths.BaseAppFolder, "Index"); } Log.ErrorLogFilePath = Path.Combine(Paths.SolutionDestinationFolder, Log.ErrorLogFile); Log.MessageLogFilePath = Path.Combine(Paths.SolutionDestinationFolder, Log.MessageLogFile); // Warning, this will delete and recreate your destination folder Paths.PrepareDestinationFolder(); using (Disposable.Timing("Generating website")) { IndexSolutions(projects); FinalizeProjects(new Dictionary <string, string> { { SolutionFinalizer.VERSION_KEY, versionDisplayText } }); } }