public static BuildVersion Calculate(Context context) { context.Information("Calculating semantic version..."); if (context.CoreOnly) { context.Information("Skipping GitVersion query for local build"); return(new BuildVersion("0.0.0", "dev")); } if (!context.IsLocalBuild) { // Run to set the version properties inside the CI server GitVersionRunner.Run(context, GitVersionOutput.BuildServer); } // Run in interactive mode to get the properties for the rest of the script var assertedversions = GitVersionRunner.Run(context, GitVersionOutput.Json); var version = assertedversions.MajorMinorPatch; var semVersion = assertedversions.LegacySemVerPadded; if (string.IsNullOrWhiteSpace(version)) { throw new CakeException("Could not calculate version of build."); } return(new BuildVersion(version, semVersion.Substring(version.Length).TrimStart('-'))); }
public static BuildVersion Calculate(Context context) { string version = null; string semVersion = null; string fullSemVer = null; context.Information("Calculating semantic version..."); if (!context.IsLocalBuild) { // Run to set the version properties inside the CI server GitVersionRunner.Run(context, GitVersionOutput.BuildServer); } // Run in interactive mode to get the properties for the rest of the script var assertedversions = GitVersionRunner.Run(context, GitVersionOutput.Json); version = assertedversions.MajorMinorPatch; semVersion = assertedversions.LegacySemVerPadded; fullSemVer = assertedversions.FullSemVer; if (string.IsNullOrWhiteSpace(version)) { throw new CakeException("Could not calculate version of build."); } return(new BuildVersion(version, semVersion.Substring(version.Length).TrimStart('-'), fullSemVer)); }
public static GitVersion GitVersion(this ICakeContext context, GitVersionSettings settings) { if (context == null) { throw new ArgumentNullException(nameof(context)); } var gitVersionRunner = new GitVersionRunner(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools, context.Log); return(gitVersionRunner.Run(settings)); }
protected override void RunTool() { var tool = new GitVersionRunner(FileSystem, Environment, ProcessRunner, Tools, Log); tool.Run(Settings); }
public GitVersion RunGitVersion() { var tool = new GitVersionRunner(FileSystem, Environment, ProcessRunner, Tools, Log); return(tool.Run(Settings)); }