Skip to content

Commit c43fdb9

Browse files
authored
Merge pull request #3226 from HHobeck/feature/3101_rename-config-to-configuration
Feature/3101 rename config to configuration
2 parents 8428d40 + dc94627 commit c43fdb9

File tree

155 files changed

+2275
-1632
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+2275
-1632
lines changed

src/GitVersion.App.Tests/ArgumentParserTests.cs

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
using GitTools.Testing;
2+
using GitVersion.Configuration;
23
using GitVersion.Core.Tests.Helpers;
34
using GitVersion.Extensions;
45
using GitVersion.Helpers;
56
using GitVersion.Logging;
6-
using GitVersion.Model;
7-
using GitVersion.Model.Configuration;
87
using GitVersion.VersionCalculation;
98
using Microsoft.Extensions.DependencyInjection;
109
using NUnit.Framework;
@@ -410,7 +409,7 @@ private static IEnumerable<TestCaseData> OverrideconfigWithInvalidOptionTestData
410409
}
411410

412411
[TestCaseSource(nameof(OverrideConfigWithSingleOptionTestData))]
413-
public void OverrideConfigWithSingleOptions(string options, Config expected)
412+
public void OverrideConfigWithSingleOptions(string options, GitVersionConfiguration expected)
414413
{
415414
var arguments = this.argumentParser.ParseArguments($"/overrideconfig {options}");
416415
arguments.OverrideConfig.ShouldBeEquivalentTo(expected);
@@ -420,134 +419,134 @@ private static IEnumerable<TestCaseData> OverrideConfigWithSingleOptionTestData(
420419
{
421420
yield return new TestCaseData(
422421
"assembly-versioning-scheme=MajorMinor",
423-
new Config
422+
new GitVersionConfiguration
424423
{
425424
AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinor
426425
}
427426
);
428427
yield return new TestCaseData(
429428
"assembly-file-versioning-scheme=\"MajorMinorPatch\"",
430-
new Config
429+
new GitVersionConfiguration
431430
{
432431
AssemblyFileVersioningScheme = AssemblyFileVersioningScheme.MajorMinorPatch
433432
}
434433
);
435434
yield return new TestCaseData(
436435
"assembly-informational-format=\"{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}\"",
437-
new Config
436+
new GitVersionConfiguration
438437
{
439438
AssemblyInformationalFormat = "{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}"
440439
}
441440
);
442441
yield return new TestCaseData(
443442
"assembly-versioning-format=\"{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}\"",
444-
new Config
443+
new GitVersionConfiguration
445444
{
446445
AssemblyVersioningFormat = "{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}"
447446
}
448447
);
449448
yield return new TestCaseData(
450449
"assembly-file-versioning-format=\"{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}\"",
451-
new Config
450+
new GitVersionConfiguration
452451
{
453452
AssemblyFileVersioningFormat = "{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}"
454453
}
455454
);
456455
yield return new TestCaseData(
457456
"mode=ContinuousDelivery",
458-
new Config
457+
new GitVersionConfiguration
459458
{
460459
VersioningMode = VersioningMode.ContinuousDelivery
461460
}
462461
);
463462
yield return new TestCaseData(
464463
"tag-prefix=sample",
465-
new Config
464+
new GitVersionConfiguration
466465
{
467466
TagPrefix = "sample"
468467
}
469468
);
470469
yield return new TestCaseData(
471470
"continuous-delivery-fallback-tag=cd-tag",
472-
new Config
471+
new GitVersionConfiguration
473472
{
474473
ContinuousDeploymentFallbackTag = "cd-tag"
475474
}
476475
);
477476
yield return new TestCaseData(
478477
"next-version=1",
479-
new Config
478+
new GitVersionConfiguration
480479
{
481480
NextVersion = "1"
482481
}
483482
);
484483
yield return new TestCaseData(
485484
"major-version-bump-message=\"This is major version bump message.\"",
486-
new Config
485+
new GitVersionConfiguration
487486
{
488487
MajorVersionBumpMessage = "This is major version bump message."
489488
}
490489
);
491490
yield return new TestCaseData(
492491
"minor-version-bump-message=\"This is minor version bump message.\"",
493-
new Config
492+
new GitVersionConfiguration
494493
{
495494
MinorVersionBumpMessage = "This is minor version bump message."
496495
}
497496
);
498497
yield return new TestCaseData(
499498
"patch-version-bump-message=\"This is patch version bump message.\"",
500-
new Config
499+
new GitVersionConfiguration
501500
{
502501
PatchVersionBumpMessage = "This is patch version bump message."
503502
}
504503
);
505504
yield return new TestCaseData(
506505
"no-bump-message=\"This is no bump message.\"",
507-
new Config
506+
new GitVersionConfiguration
508507
{
509508
NoBumpMessage = "This is no bump message."
510509
}
511510
);
512511
yield return new TestCaseData(
513512
"tag-pre-release-weight=2",
514-
new Config
513+
new GitVersionConfiguration
515514
{
516515
TagPreReleaseWeight = 2
517516
}
518517
);
519518
yield return new TestCaseData(
520519
"commit-message-incrementing=MergeMessageOnly",
521-
new Config
520+
new GitVersionConfiguration
522521
{
523522
CommitMessageIncrementing = CommitMessageIncrementMode.MergeMessageOnly
524523
}
525524
);
526525
yield return new TestCaseData(
527526
"increment=Minor",
528-
new Config
527+
new GitVersionConfiguration
529528
{
530529
Increment = IncrementStrategy.Minor
531530
}
532531
);
533532
yield return new TestCaseData(
534533
"commit-date-format=\"MM/dd/yyyy h:mm tt\"",
535-
new Config
534+
new GitVersionConfiguration
536535
{
537536
CommitDateFormat = "MM/dd/yyyy h:mm tt"
538537
}
539538
);
540539
yield return new TestCaseData(
541540
"update-build-number=true",
542-
new Config
541+
new GitVersionConfiguration
543542
{
544543
UpdateBuildNumber = true
545544
}
546545
);
547546
}
548547

549548
[TestCaseSource(nameof(OverrideconfigWithMultipleOptionsTestData))]
550-
public void OverrideconfigWithMultipleOptions(string options, Config expected)
549+
public void OverrideconfigWithMultipleOptions(string options, GitVersionConfiguration expected)
551550
{
552551
var arguments = this.argumentParser.ParseArguments(options);
553552
arguments.OverrideConfig.ShouldBeEquivalentTo(expected);
@@ -557,23 +556,23 @@ private static IEnumerable<TestCaseData> OverrideconfigWithMultipleOptionsTestDa
557556
{
558557
yield return new TestCaseData(
559558
"/overrideconfig tag-prefix=sample /overrideconfig assembly-versioning-scheme=MajorMinor",
560-
new Config
559+
new GitVersionConfiguration
561560
{
562561
TagPrefix = "sample",
563562
AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinor
564563
}
565564
);
566565
yield return new TestCaseData(
567566
"/overrideconfig tag-prefix=sample /overrideconfig assembly-versioning-format=\"{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}\"",
568-
new Config
567+
new GitVersionConfiguration
569568
{
570569
TagPrefix = "sample",
571570
AssemblyVersioningFormat = "{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}"
572571
}
573572
);
574573
yield return new TestCaseData(
575574
"/overrideconfig tag-prefix=sample /overrideconfig assembly-versioning-format=\"{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}\" /overrideconfig update-build-number=true /overrideconfig assembly-versioning-scheme=MajorMinorPatchTag /overrideconfig mode=ContinuousDelivery /overrideconfig tag-pre-release-weight=4",
576-
new Config
575+
new GitVersionConfiguration
577576
{
578577
TagPrefix = "sample",
579578
AssemblyVersioningFormat = "{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}",

src/GitVersion.App/ArgumentParser.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using GitVersion.Extensions;
33
using GitVersion.Helpers;
44
using GitVersion.Logging;
5-
using GitVersion.Model;
65
using GitVersion.OutputVariables;
76

87
namespace GitVersion;
@@ -420,7 +419,7 @@ private static void ParseOverrideConfig(Arguments arguments, IReadOnlyCollection
420419
if (values == null || values.Count == 0)
421420
return;
422421

423-
var parser = new OverrideConfigOptionParser();
422+
var parser = new OverrideConfigurationOptionParser();
424423

425424
// key=value
426425
foreach (var keyValueOption in values)
@@ -432,7 +431,7 @@ private static void ParseOverrideConfig(Arguments arguments, IReadOnlyCollection
432431
}
433432

434433
var optionKey = keyAndValue[0].ToLowerInvariant();
435-
if (!OverrideConfigOptionParser.SupportedProperties.Contains(optionKey))
434+
if (!OverrideConfigurationOptionParser.SupportedProperties.Contains(optionKey))
436435
{
437436
throw new WarningException($"Could not parse /overrideconfig option: {keyValueOption}. Unsupported 'key'.");
438437
}

src/GitVersion.App/Arguments.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1+
using GitVersion.Configuration;
12
using GitVersion.Logging;
2-
using GitVersion.Model;
3-
using GitVersion.Model.Configuration;
43

54
namespace GitVersion;
65

@@ -9,7 +8,7 @@ public class Arguments
98
public AuthenticationInfo Authentication = new();
109

1110
public string? ConfigFile;
12-
public Config? OverrideConfig;
11+
public GitVersionConfiguration? OverrideConfig;
1312
public bool ShowConfig;
1413

1514
public string? TargetPath;

src/GitVersion.App/GitVersionExecutor.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
11
using GitVersion.Configuration;
22
using GitVersion.Extensions;
33
using GitVersion.Logging;
4-
using GitVersion.Model;
54

65
namespace GitVersion;
76

87
public class GitVersionExecutor : IGitVersionExecutor
98
{
109
private readonly ILog log;
1110
private readonly IConsole console;
12-
private readonly IConfigFileLocator configFileLocator;
11+
private readonly IConfigurationFileLocator configFileLocator;
1312
private readonly IHelpWriter helpWriter;
1413
private readonly IGitRepositoryInfo repositoryInfo;
15-
private readonly IConfigProvider configProvider;
14+
private readonly IConfigurationProvider configurationProvider;
1615
private readonly IGitVersionCalculateTool gitVersionCalculateTool;
1716
private readonly IGitVersionOutputTool gitVersionOutputTool;
1817
private readonly IVersionWriter versionWriter;
1918

2019
public GitVersionExecutor(ILog log, IConsole console,
21-
IConfigFileLocator configFileLocator, IConfigProvider configProvider,
20+
IConfigurationFileLocator configFileLocator, IConfigurationProvider configurationProvider,
2221
IGitVersionCalculateTool gitVersionCalculateTool, IGitVersionOutputTool gitVersionOutputTool,
2322
IVersionWriter versionWriter, IHelpWriter helpWriter, IGitRepositoryInfo repositoryInfo)
2423
{
2524
this.log = log.NotNull();
2625
this.console = console.NotNull();
2726
this.configFileLocator = configFileLocator.NotNull();
28-
this.configProvider = configProvider.NotNull();
27+
this.configurationProvider = configurationProvider.NotNull();
2928

3029
this.gitVersionCalculateTool = gitVersionCalculateTool.NotNull();
3130
this.gitVersionOutputTool = gitVersionOutputTool.NotNull();
@@ -65,7 +64,7 @@ private int RunGitVersionTool(GitVersionOptions gitVersionOptions)
6564

6665
var variables = this.gitVersionCalculateTool.CalculateVersionVariables();
6766

68-
var configuration = this.configProvider.Provide(gitVersionOptions.ConfigInfo.OverrideConfig);
67+
var configuration = this.configurationProvider.Provide(gitVersionOptions.ConfigInfo.OverrideConfig);
6968

7069
this.gitVersionOutputTool.OutputVariables(variables, configuration.UpdateBuildNumber ?? true);
7170
this.gitVersionOutputTool.UpdateAssemblyInfo(variables);
@@ -148,15 +147,15 @@ private bool HandleNonMainCommand(GitVersionOptions gitVersionOptions, out int e
148147

149148
if (gitVersionOptions.Init)
150149
{
151-
this.configProvider.Init(workingDirectory);
150+
this.configurationProvider.Init(workingDirectory);
152151
exitCode = 0;
153152
return true;
154153
}
155154

156155
if (gitVersionOptions.ConfigInfo.ShowConfig)
157156
{
158-
var config = this.configProvider.Provide(workingDirectory);
159-
this.console.WriteLine(config.ToString());
157+
var configuration = this.configurationProvider.Provide(workingDirectory);
158+
this.console.WriteLine(configuration.ToString());
160159
exitCode = 0;
161160
return true;
162161
}

src/GitVersion.App/OverrideConfigOptionParser.cs renamed to src/GitVersion.App/OverrideConfigurationOptionParser.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
using GitVersion.Model.Configuration;
1+
using GitVersion.Configuration;
22
using YamlDotNet.Serialization;
33

44
namespace GitVersion;
55

6-
internal class OverrideConfigOptionParser
6+
internal class OverrideConfigurationOptionParser
77
{
88
private static readonly Lazy<ILookup<string?, PropertyInfo>> _lazySupportedProperties =
99
new(GetSupportedProperties, true);
1010

11-
private readonly Lazy<Config> lazyConfig = new();
11+
private readonly Lazy<GitVersionConfiguration> lazyConfig = new();
1212

1313
internal static ILookup<string?, PropertyInfo> SupportedProperties => _lazySupportedProperties.Value;
1414

1515
/// <summary>
1616
/// Dynamically creates <see cref="System.Linq.ILookup{TKey, TElement}"/> of
17-
/// <see cref="Config"/> properties supported as a part of command line '/overrideconfig' option.
17+
/// <see cref="GitVersionConfiguration"/> properties supported as a part of command line '/overrideconfig' option.
1818
/// </summary>
1919
/// <returns></returns>
2020
/// <remarks>
2121
/// Lookup keys are created from <see cref="YamlDotNet.Serialization.YamlMemberAttribute"/> to match 'GitVersion.yml'
2222
/// options as close as possible.
2323
/// </remarks>
24-
private static ILookup<string?, PropertyInfo> GetSupportedProperties() => typeof(Config).GetProperties(BindingFlags.Public | BindingFlags.Instance)
24+
private static ILookup<string?, PropertyInfo> GetSupportedProperties() => typeof(GitVersionConfiguration).GetProperties(BindingFlags.Public | BindingFlags.Instance)
2525
.Where(
2626
pi => IsSupportedPropertyType(pi.PropertyType)
2727
&& pi.CanWrite
@@ -33,7 +33,7 @@ internal class OverrideConfigOptionParser
3333
);
3434

3535
/// <summary>
36-
/// Checks if property <see cref="Type"/> of <see cref="Config"/>
36+
/// Checks if property <see cref="Type"/> of <see cref="GitVersionConfiguration"/>
3737
/// is supported as a part of command line '/overrideconfig' option.
3838
/// </summary>
3939
/// <param name="propertyType">Type we want to check.</param>
@@ -97,5 +97,5 @@ internal void SetValue(string key, string value)
9797
}
9898
}
9999

100-
internal Config? GetConfig() => this.lazyConfig.IsValueCreated ? this.lazyConfig.Value : null;
100+
internal GitVersionConfiguration? GetConfig() => this.lazyConfig.IsValueCreated ? this.lazyConfig.Value : null;
101101
}

src/GitVersion.App/PublicAPI.Shipped.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ GitVersion.Arguments.LogFilePath -> string?
1818
GitVersion.Arguments.NoCache -> bool
1919
GitVersion.Arguments.NoFetch -> bool
2020
GitVersion.Arguments.NoNormalize -> bool
21-
GitVersion.Arguments.Output -> System.Collections.Generic.ISet<GitVersion.Model.OutputType>!
21+
GitVersion.Arguments.Output -> System.Collections.Generic.ISet<GitVersion.OutputType>!
2222
GitVersion.Arguments.OutputFile -> string?
23-
GitVersion.Arguments.OverrideConfig -> GitVersion.Model.Configuration.Config?
23+
GitVersion.Arguments.OverrideConfig -> GitVersion.Configuration.GitVersionConfiguration?
2424
GitVersion.Arguments.ShowConfig -> bool
2525
GitVersion.Arguments.ShowVariable -> string?
2626
GitVersion.Arguments.TargetBranch -> string?
@@ -37,7 +37,7 @@ GitVersion.GitVersionAppModule.GitVersionAppModule() -> void
3737
GitVersion.GitVersionAppModule.RegisterTypes(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> void
3838
GitVersion.GitVersionExecutor
3939
GitVersion.GitVersionExecutor.Execute(GitVersion.GitVersionOptions! gitVersionOptions) -> int
40-
GitVersion.GitVersionExecutor.GitVersionExecutor(GitVersion.Logging.ILog! log, GitVersion.Logging.IConsole! console, GitVersion.Configuration.IConfigFileLocator! configFileLocator, GitVersion.Configuration.IConfigProvider! configProvider, GitVersion.IGitVersionCalculateTool! gitVersionCalculateTool, GitVersion.IGitVersionOutputTool! gitVersionOutputTool, GitVersion.IVersionWriter! versionWriter, GitVersion.IHelpWriter! helpWriter, GitVersion.IGitRepositoryInfo! repositoryInfo) -> void
40+
GitVersion.GitVersionExecutor.GitVersionExecutor(GitVersion.Logging.ILog! log, GitVersion.Logging.IConsole! console, GitVersion.Configuration.IConfigurationFileLocator! configFileLocator, GitVersion.Configuration.IConfigurationProvider! configurationProvider, GitVersion.IGitVersionCalculateTool! gitVersionCalculateTool, GitVersion.IGitVersionOutputTool! gitVersionOutputTool, GitVersion.IVersionWriter! versionWriter, GitVersion.IHelpWriter! helpWriter, GitVersion.IGitRepositoryInfo! repositoryInfo) -> void
4141
GitVersion.GlobbingResolver
4242
GitVersion.GlobbingResolver.GlobbingResolver() -> void
4343
GitVersion.GlobbingResolver.Resolve(string! workingDirectory, string! pattern) -> System.Collections.Generic.IEnumerable<string!>!

src/GitVersion.Core.Tests/BuildAgents/BitBucketPipelinesTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ private void AssertVariablesAreWrittenToFile(string file)
150150
semanticVersion.BuildMetaData.CommitDate = new DateTimeOffset(2022, 4, 6, 16, 10, 59, TimeSpan.FromHours(10));
151151
semanticVersion.BuildMetaData.Sha = "f28807e615e9f06aec8a33c87780374e0c1f6fb8";
152152

153-
var config = new TestEffectiveConfiguration();
153+
var configuration = new TestEffectiveConfiguration();
154154
var variableProvider = this.sp.GetRequiredService<IVariableProvider>();
155155

156-
var variables = variableProvider.GetVariablesFor(semanticVersion, config, false);
156+
var variables = variableProvider.GetVariablesFor(semanticVersion, configuration, false);
157157

158158
this.buildServer.WithPropertyFile(file);
159159

0 commit comments

Comments
 (0)