/// <summary> /// Executes the increment. /// </summary> /// <param name="context">The context of the increment.</param> /// <param name="versionComponent">The version component that needs to be incremented.</param> /// <remarks> /// Use the method <see cref="IncrementContext.SetNewVersionComponentValue"/> to set the new version component value. /// Set the <see cref="IncrementContext.Continue"/> property to <c>false</c> to skip updating the other component values. /// </remarks> public override void Increment(IncrementContext context, VersionComponent versionComponent) { // Find out the directory String projectPath = context.ProjectFilename; String projectPathDirectory = Directory.GetParent(projectPath).FullName; //Logger.Write("PATH: " + projectPath, LogLevel.Debug); //Logger.Write("PATH: " + projectPathDirectory, LogLevel.Debug); if (!String.IsNullOrEmpty(projectPath) && !String.IsNullOrEmpty(projectPathDirectory)) { try { long svnRevision = GetRevision(projectPathDirectory); Logger.Write("Revision retrieved from the working copy: " + svnRevision, LogLevel.Info); // Return the head revision or "0" if not under version control context.SetNewVersionComponentValue(versionComponent, svnRevision.ToString()); } catch (Exception ex) { Logger.Write("Error while retrieving revision: " + ex.ToString(), LogLevel.Error); } } }
public override void Increment(IncrementContext context, VersionComponent versionComponent) { string currentVersionComponentValue = context.GetCurrentVersionComponentValue(versionComponent); string value = this.Increment(currentVersionComponentValue, context.BuildStartDate, context.ProjectStartDate, context.ProjectFilename); context.SetNewVersionComponentValue(versionComponent, value); }
public override void Execute(IncrementContext context, VersionComponent versionComponent) { var currentValue = context.GetCurrentVersionComponentValue(versionComponent); var newValue = IncrementImpl(currentValue, context.BuildStartDate, context.ProjectStartDate); context.SetNewVersionComponentValue(versionComponent, newValue); }
internal StringVersion Increment(StringVersion currentVersion, DateTime buildStartDate, DateTime projectStartDate, SolutionItem solutionItem) { IncrementContext incrementContext = new IncrementContext(currentVersion, buildStartDate, projectStartDate, solutionItem.Filename); BaseIncrementor[] array = new BaseIncrementor[] { this.Major, this.Minor, this.Build, this.Revision }; for (int i = 0; i < 4; i++) { BaseIncrementor baseIncrementor = array[i]; if (baseIncrementor != null) { VersionComponent versionComponent = (VersionComponent)i; baseIncrementor.Increment(incrementContext, versionComponent); if (!incrementContext.Continue) { break; } } } return incrementContext.NewVersion; }
public abstract void Increment(IncrementContext context, VersionComponent versionComponent);
public abstract void Increment(IncrementContext context, VersionComponent versionComponent);
public override void Increment(IncrementContext context, VersionComponent versionComponent) { string currentVersionComponentValue = context.GetCurrentVersionComponentValue(versionComponent); string value = this.Increment(currentVersionComponentValue, context.BuildStartDate, context.ProjectStartDate, context.ProjectFilename); context.SetNewVersionComponentValue(versionComponent, value); }