Skip to content

Commit

Permalink
use IBranchConfiguration instead of BranchConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
arturcic committed Mar 29, 2023
1 parent 8b6f878 commit 458090a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class ConfigurationExtensionsTests : TestBase
[Test]
public void GetReleaseBranchConfigReturnsAllReleaseBranches()
{
var configuration = new GitVersionConfiguration()
var configuration = new GitVersionConfiguration
{
Branches = new Dictionary<string, BranchConfiguration>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace GitVersion.Configuration;

public class BranchConfigurationBuilder
internal class BranchConfigurationBuilder
{
public static BranchConfigurationBuilder New => new();

Expand Down Expand Up @@ -148,7 +148,7 @@ public virtual BranchConfigurationBuilder WithConfiguration(IBranchConfiguration
return this;
}

public BranchConfiguration Build() => new()
public IBranchConfiguration Build() => new BranchConfiguration
{
VersioningMode = versioningMode,
Label = label,
Expand Down
8 changes: 4 additions & 4 deletions src/GitVersion.Core/Configuration/ConfigurationBuilderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public virtual TConfigurationBuilder WithLabelPreReleaseWeight(int? value)

public virtual TConfigurationBuilder WithIgnoreConfiguration(IIgnoreConfiguration value)
{
this.ignore = (IgnoreConfiguration) value;
this.ignore = (IgnoreConfiguration)value;
return (TConfigurationBuilder)this;
}

Expand Down Expand Up @@ -346,7 +346,7 @@ public virtual IGitVersionConfiguration Build()
Dictionary<string, BranchConfiguration> branches = new();
foreach (var (name, branchConfigurationBuilder) in this.branchConfigurationBuilders)
{
branches.Add(name, branchConfigurationBuilder.Build());
branches.Add(name, (BranchConfiguration)branchConfigurationBuilder.Build());
}

IGitVersionConfiguration configuration = new GitVersionConfiguration
Expand Down Expand Up @@ -411,10 +411,10 @@ private static void FinalizeConfiguration(IGitVersionConfiguration configuration
private static void FinalizeBranchConfiguration(IGitVersionConfiguration configuration, string branchName,
IBranchConfiguration branchConfiguration)
{
var branches = configuration.Branches.ToDictionary(x => x.Key, x => (BranchConfiguration)x.Value);
var branches = configuration.Branches;
foreach (var targetBranchName in branchConfiguration.IsSourceBranchFor)
{
var targetBranchConfiguration = branches[targetBranchName];
var targetBranchConfiguration = (BranchConfiguration)branches[targetBranchName];
targetBranchConfiguration.SourceBranches.Add(branchName);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public IgnoreConfigurationBuilder WithShas(HashSet<string> value)
return this;
}

public IgnoreConfiguration Build() => new()
public IIgnoreConfiguration Build() => new IgnoreConfiguration()
{
Before = before,
Shas = shas
Expand Down
27 changes: 0 additions & 27 deletions src/GitVersion.Core/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ GitVersion.Configuration.BranchConfiguration.TrackMergeMessage.get -> bool?
GitVersion.Configuration.BranchConfiguration.TrackMergeTarget.get -> bool?
GitVersion.Configuration.BranchConfiguration.TracksReleaseBranches.get -> bool?
GitVersion.Configuration.BranchConfiguration.VersioningMode.get -> GitVersion.VersionCalculation.VersioningMode?
GitVersion.Configuration.BranchConfigurationBuilder
GitVersion.Configuration.BranchConfigurationBuilder.Build() -> GitVersion.Configuration.BranchConfiguration!
GitVersion.Configuration.ConfigurationConstants
GitVersion.Configuration.ConfigurationException
GitVersion.Configuration.ConfigurationException.ConfigurationException() -> void
Expand Down Expand Up @@ -225,8 +223,6 @@ GitVersion.Configuration.IgnoreConfiguration.Before.init -> void
GitVersion.Configuration.IgnoreConfiguration.Shas.get -> System.Collections.Generic.HashSet<string!>!
GitVersion.Configuration.IgnoreConfiguration.Shas.init -> void
GitVersion.Configuration.IgnoreConfigurationExtensions
GitVersion.Configuration.Init.EditConfigStep
GitVersion.Configuration.Init.EditConfigStep.EditConfigStep(GitVersion.Logging.IConsole! console, GitVersion.IFileSystem! fileSystem, GitVersion.Logging.ILog! log, GitVersion.Configuration.Init.Wizard.IConfigInitStepFactory! stepFactory) -> void
GitVersion.Configuration.Init.GitVersionInitModule
GitVersion.Configuration.Init.GitVersionInitModule.GitVersionInitModule() -> void
GitVersion.Configuration.Init.GitVersionInitModule.RegisterTypes(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> void
Expand Down Expand Up @@ -939,10 +935,6 @@ GitVersion.WixInfo.WixInfo() -> void
abstract GitVersion.Agents.BuildAgentBase.EnvironmentVariable.get -> string!
abstract GitVersion.Agents.BuildAgentBase.GenerateSetParameterMessage(string! name, string? value) -> string![]!
abstract GitVersion.Agents.BuildAgentBase.GenerateSetVersionMessage(GitVersion.OutputVariables.GitVersionVariables! variables) -> string?
abstract GitVersion.Configuration.Init.Wizard.ConfigInitWizardStep.DefaultResult.get -> string?
abstract GitVersion.Configuration.Init.Wizard.ConfigInitWizardStep.GetPrompt(GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> string!
abstract GitVersion.Configuration.Init.Wizard.ConfigInitWizardStep.HandleResult(string? result, System.Collections.Generic.Queue<GitVersion.Configuration.Init.Wizard.ConfigInitWizardStep!>! steps, GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult!
abstract GitVersion.GitVersionModule.RegisterTypes(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> void
abstract GitVersion.VersionCalculation.VersionStrategyBase.GetBaseVersions(GitVersion.Configuration.EffectiveBranchConfiguration! configuration) -> System.Collections.Generic.IEnumerable<GitVersion.VersionCalculation.BaseVersion!>!
const GitVersion.Configuration.ConfigurationConstants.BranchNamePlaceholder = "{BranchName}" -> string!
const GitVersion.Configuration.ConfigurationConstants.DefaultLabelPrefix = "[vV]?" -> string!
Expand Down Expand Up @@ -1011,7 +1003,6 @@ override GitVersion.VersionCalculation.VersionInBranchNameVersionStrategy.GetBas
readonly GitVersion.Agents.BuildAgentBase.Log -> GitVersion.Logging.ILog!
static GitVersion.BranchCommit.operator !=(GitVersion.BranchCommit left, GitVersion.BranchCommit right) -> bool
static GitVersion.BranchCommit.operator ==(GitVersion.BranchCommit left, GitVersion.BranchCommit right) -> bool
static GitVersion.Configuration.BranchConfigurationBuilder.New.get -> GitVersion.Configuration.BranchConfigurationBuilder!
static GitVersion.Configuration.ConfigurationExtensions.FindGitDir(this string! path) -> (string! GitDirectory, string! WorkingTreeDirectory)?
static GitVersion.Configuration.ConfigurationExtensions.GetBranchConfiguration(this GitVersion.Configuration.IGitVersionConfiguration! configuration, GitVersion.IBranch! branch) -> GitVersion.Configuration.IBranchConfiguration!
static GitVersion.Configuration.ConfigurationExtensions.GetBranchConfiguration(this GitVersion.Configuration.IGitVersionConfiguration! configuration, GitVersion.ReferenceName! branchName) -> GitVersion.Configuration.IBranchConfiguration!
Expand Down Expand Up @@ -1144,23 +1135,5 @@ virtual GitVersion.Agents.BuildAgentBase.PreventFetch() -> bool
virtual GitVersion.Agents.BuildAgentBase.ShouldCleanUpRemotes() -> bool
virtual GitVersion.Agents.BuildAgentBase.WriteIntegration(System.Action<string?>! writer, GitVersion.OutputVariables.GitVersionVariables! variables, bool updateBuildNumber = true) -> void
virtual GitVersion.Configuration.BranchConfiguration.Inherit(GitVersion.Configuration.IBranchConfiguration! configuration) -> GitVersion.Configuration.IBranchConfiguration!
virtual GitVersion.Configuration.BranchConfigurationBuilder.WithCommitMessageIncrementing(GitVersion.VersionCalculation.CommitMessageIncrementMode? value) -> GitVersion.Configuration.BranchConfigurationBuilder!
virtual GitVersion.Configuration.BranchConfigurationBuilder.WithConfiguration(GitVersion.Configuration.IBranchConfiguration! value) -> GitVersion.Configuration.BranchConfigurationBuilder!
virtual GitVersion.Configuration.BranchConfigurationBuilder.WithIncrement(GitVersion.IncrementStrategy value) -> GitVersion.Configuration.BranchConfigurationBuilder!
virtual GitVersion.Configuration.BranchConfigurationBuilder.WithIsMainline(bool? value) -> GitVersion.Configuration.BranchConfigurationBuilder!
virtual GitVersion.Configuration.BranchConfigurationBuilder.WithIsReleaseBranch(bool? value) -> GitVersion.Configuration.BranchConfigurationBuilder!
virtual GitVersion.Configuration.BranchConfigurationBuilder.WithIsSourceBranchFor(System.Collections.Generic.IEnumerable<string!>! values) -> GitVersion.Configuration.BranchConfigurationBuilder!
virtual GitVersion.Configuration.BranchConfigurationBuilder.WithIsSourceBranchFor(params string![]! values) -> GitVersion.Configuration.BranchConfigurationBuilder!
virtual GitVersion.Configuration.BranchConfigurationBuilder.WithLabel(string? value) -> GitVersion.Configuration.BranchConfigurationBuilder!
virtual GitVersion.Configuration.BranchConfigurationBuilder.WithLabelNumberPattern(string? value) -> GitVersion.Configuration.BranchConfigurationBuilder!
virtual GitVersion.Configuration.BranchConfigurationBuilder.WithPreReleaseWeight(int? value) -> GitVersion.Configuration.BranchConfigurationBuilder!
virtual GitVersion.Configuration.BranchConfigurationBuilder.WithPreventIncrementOfMergedBranchVersion(bool? value) -> GitVersion.Configuration.BranchConfigurationBuilder!
virtual GitVersion.Configuration.BranchConfigurationBuilder.WithRegularExpression(string? value) -> GitVersion.Configuration.BranchConfigurationBuilder!
virtual GitVersion.Configuration.BranchConfigurationBuilder.WithSourceBranches(System.Collections.Generic.IEnumerable<string!>! values) -> GitVersion.Configuration.BranchConfigurationBuilder!
virtual GitVersion.Configuration.BranchConfigurationBuilder.WithSourceBranches(params string![]! values) -> GitVersion.Configuration.BranchConfigurationBuilder!
virtual GitVersion.Configuration.BranchConfigurationBuilder.WithTrackMergeMessage(bool? value) -> GitVersion.Configuration.BranchConfigurationBuilder!
virtual GitVersion.Configuration.BranchConfigurationBuilder.WithTrackMergeTarget(bool? value) -> GitVersion.Configuration.BranchConfigurationBuilder!
virtual GitVersion.Configuration.BranchConfigurationBuilder.WithTracksReleaseBranches(bool? value) -> GitVersion.Configuration.BranchConfigurationBuilder!
virtual GitVersion.Configuration.BranchConfigurationBuilder.WithVersioningMode(GitVersion.VersionCalculation.VersioningMode? value) -> GitVersion.Configuration.BranchConfigurationBuilder!
virtual GitVersion.VersionCalculation.EffectiveBranchConfigurationFinder.GetConfigurations(GitVersion.IBranch! branch, GitVersion.Configuration.IGitVersionConfiguration! configuration) -> System.Collections.Generic.IEnumerable<GitVersion.Configuration.EffectiveBranchConfiguration!>!
virtual GitVersion.VersionCalculation.NextVersionCalculator.FindVersion() -> GitVersion.VersionCalculation.NextVersion!

0 comments on commit 458090a

Please sign in to comment.