private static int Main(string[] args) { #if DEBUG LogManager.AddDebugListener(true); #endif var consoleLogListener = new OutputLogListener(); LogManager.AddListener(consoleLogListener); Uri remoteGitUrl = null; string commitId = null; string baseDir = null; string pdbPath = null; bool skipVerify = false; LinkMethod method = LinkMethod.Http; var arguments = ArgumentSyntax.Parse(args, syntax => { syntax.DefineOption("m|method", ref method, v => (LinkMethod)Enum.Parse(typeof(LinkMethod), v, true), "The method for SRCSRV to retrieve source code. One of <" + string.Join("|", Enum.GetNames(typeof(LinkMethod))) + ">. Default is " + method + "."); syntax.DefineOption("u|url", ref remoteGitUrl, s => new Uri(s, UriKind.Absolute), "Url to remote git repository."); syntax.DefineOption("commit", ref commitId, "The git ref to assume all the source code belongs to."); syntax.DefineOption("baseDir", ref baseDir, "The path to the root of the git repo."); syntax.DefineOption("s|skipVerify", ref skipVerify, "Verify all source files are available in source control."); syntax.DefineParameter("pdb", ref pdbPath, "The PDB to add source indexing to."); if (!string.IsNullOrEmpty(pdbPath) && !File.Exists(pdbPath)) { syntax.ReportError($"File not found: \"{pdbPath}\""); } if (!string.IsNullOrEmpty(baseDir) && !Directory.Exists(baseDir)) { syntax.ReportError($"Directory not found: \"{baseDir}\""); } }); if (string.IsNullOrEmpty(pdbPath)) { Log.Info(arguments.GetHelpText()); return(1); } var options = new LinkOptions { GitRemoteUrl = remoteGitUrl, GitWorkingDirectory = baseDir != null?Catel.IO.Path.GetFullPath(baseDir, Environment.CurrentDirectory) : null, CommitId = commitId, SkipVerify = skipVerify, Method = method, }; if (!Linker.Link(pdbPath, options)) { return(1); } WaitForKeyPressWhenDebugging(); return(0); }
private static int Main(string[] args) { #if DEBUG LogManager.AddDebugListener(true); #endif var consoleLogListener = new OutputLogListener(); LogManager.AddListener(consoleLogListener); try { HelpWriter.WriteAppHeader(s => Log.Write(LogEvent.Info, s)); Log.Info("Arguments: {0}", string.Join(" ", args)); Log.Info(string.Empty); var context = ArgumentParser.ParseArguments(args); if (context.IsHelp) { HelpWriter.WriteHelp(s => Log.Write(LogEvent.Info, s)); WaitForKeyPress(); return(0); } var parameters = new List <IParameter>(); var typeFactory = TypeFactory.Default; var initTypes = TypeCache.GetTypes(x => typeof(RuleBase).IsAssignableFromEx(x) && !x.IsAbstract); foreach (var initType in initTypes) { var initializer = (RuleBase)typeFactory.CreateInstance(initType); parameters.Add(initializer.GetParameter(context)); } foreach (var buildServer in BuildServerList.GetApplicableBuildServers(context)) { buildServer.WriteIntegration(parameters, x => Log.Info(x)); } #if DEBUG if (Debugger.IsAttached) { WaitForKeyPress(); } #endif return(0); } catch (Exception) { return(-1); } }
private static int Main(string[] args) { #if DEBUG LogManager.AddDebugListener(true); #endif var consoleLogListener = new OutputLogListener(); LogManager.AddListener(consoleLogListener); try { HelpWriter.WriteAppHeader(s => Log.Write(LogEvent.Info, s)); Log.Info("Arguments: {0}", string.Join(" ", args)); Log.Info(string.Empty); var context = ArgumentParser.ParseArguments(args); if (context.IsHelp) { HelpWriter.WriteHelp(s => Log.Write(LogEvent.Info, s)); WaitForKeyPress(); return 0; } var parameters = new List<Parameter>(); var typeFactory = TypeFactory.Default; var initTypes = TypeCache.GetTypes(x => typeof (RuleBase).IsAssignableFromEx(x) && !x.IsAbstract); foreach (var initType in initTypes) { var initializer = (RuleBase)typeFactory.CreateInstance(initType); parameters.Add(initializer.GetParameter(context)); } foreach (var buildServer in BuildServerList.GetApplicableBuildServers(context)) { buildServer.WriteIntegration(parameters, x => Log.Info(x)); } #if DEBUG if (Debugger.IsAttached) { WaitForKeyPress(); } #endif return 0; } catch (Exception) { return -1; } }
private static int Main(string[] args) { #if DEBUG LogManager.AddDebugListener(true); #endif var consoleLogListener = new OutputLogListener(); LogManager.AddListener(consoleLogListener); try { HelpWriter.WriteAppHeader(s => Log.Write(LogEvent.Info, s)); Log.Info("Arguments: {0}", string.Join(" ", args)); Log.Info(string.Empty); var context = ArgumentParser.ParseArguments(args); if (context.IsHelp) { HelpWriter.WriteHelp(s => Log.Write(LogEvent.Info, s)); WaitForKeyPress(); return 0; } consoleLogListener.IsDebugEnabled = context.IsDebug; var result = Linker.Link(context); #if DEBUG WaitForKeyPress(); #endif return result; } catch (Exception ex) { Log.Error(ex, "An unexpected error occurred"); #if DEBUG WaitForKeyPress(); #endif return -1; } }
private static int Main(string[] args) { #if DEBUG LogManager.AddDebugListener(true); #endif var consoleLogListener = new OutputLogListener(); LogManager.AddListener(consoleLogListener); try { HelpWriter.WriteAppHeader(s => Log.Write(LogEvent.Info, s)); Log.Info("Arguments: {0}", string.Join(" ", args)); Log.Info(string.Empty); var context = ArgumentParser.ParseArguments(args); if (context.IsHelp) { HelpWriter.WriteHelp(s => Log.Write(LogEvent.Info, s)); WaitForKeyPress(); return(0); } consoleLogListener.IsDebugEnabled = context.IsDebug; var result = Linker.Link(context); #if DEBUG WaitForKeyPress(); #endif return(result); } catch (Exception ex) { Log.Error(ex, "An unexpected error occurred"); #if DEBUG WaitForKeyPress(); #endif return(-1); } }
private static int Main(string[] args) { #if DEBUG LogManager.AddDebugListener(true); #endif var consoleLogListener = new OutputLogListener(); LogManager.AddListener(consoleLogListener); var exitCode = 0; try { var jiraAutomation = TypeFactory.Default.CreateInstance <JiraAutomation>(); var task = jiraAutomation.Run(args, WaitForKeyPress); task.Wait(); exitCode = task.Result; } catch (JiraCliException) { // Known exception exitCode = -1; } catch (Exception ex) { Log.Error(ex, "An unknown exception occurred"); exitCode = -1; } #if DEBUG if (Debugger.IsAttached) { WaitForKeyPress(); } #endif return(exitCode); }
private static int Main(string[] args) { #if DEBUG LogManager.AddDebugListener(true); #endif var consoleLogListener = new OutputLogListener(); LogManager.AddListener(consoleLogListener); var exitCode = 0; try { var jiraAutomation = TypeFactory.Default.CreateInstance<JiraAutomation>(); var task = jiraAutomation.Run(args, WaitForKeyPress); task.Wait(); exitCode = task.Result; } catch (JiraCliException) { // Known exception exitCode = -1; } catch (Exception ex) { Log.Error(ex, "An unknown exception occurred"); exitCode = -1; } #if DEBUG if (Debugger.IsAttached) { WaitForKeyPress(); } #endif return exitCode; }