public string GetFullSemVersion() { if (_env.IsProduction()) { var result = Assembly.GetEntryAssembly() .GetCustomAttribute <AssemblyInformationalVersionAttribute>() .InformationalVersion; return(result); } else { var data = _gitVersion.CalculateVersionVariables(); return(data.FullSemVer); } }
private int RunGitVersionTool(GitVersionOptions gitVersionOptions) { try { var variables = gitVersionTool.CalculateVersionVariables(); gitVersionTool.OutputVariables(variables); gitVersionTool.UpdateAssemblyInfo(variables); gitVersionTool.UpdateWixVersionFile(variables); execCommand.Execute(variables); } catch (WarningException exception) { var error = $"An error occurred:{System.Environment.NewLine}{exception.Message}"; log.Warning(error); return(1); } catch (Exception exception) { var error = $"An unexpected error occurred:{System.Environment.NewLine}{exception}"; log.Error(error); if (gitVersionOptions == null) { return(1); } log.Info("Attempting to show the current git graph (please include in issue): "); log.Info("Showing max of 100 commits"); try { LibGitExtensions.DumpGraph(gitVersionOptions.WorkingDirectory, mess => log.Info(mess), 100); } catch (Exception dumpGraphException) { log.Error("Couldn't dump the git graph due to the following error: " + dumpGraphException); } return(1); } return(0); }
public GitVersionTaskExecutor(IGitVersionTool gitVersionTool, IOptions <Arguments> options) { this.gitVersionTool = gitVersionTool ?? throw new ArgumentNullException(nameof(gitVersionTool)); this.options = options ?? throw new ArgumentNullException(nameof(options)); versionVariables = gitVersionTool.CalculateVersionVariables(); }