Skip to content

Commit d5a2545

Browse files
committed
Removed LastMinorVersionFinder and OriginalDate from the assembly info builder in GitVersionTask and removed unneeded tests
1 parent a31b530 commit d5a2545

12 files changed

+17
-184
lines changed

GitVersionCore.Tests/IntegrationTests/GitFlow/MetaDataByCommitScenarios.cs

Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System;
2-
using GitVersion;
3-
using GitVersionCore.Tests;
4-
using LibGit2Sharp;
1+
using LibGit2Sharp;
52
using NUnit.Framework;
63
using Shouldly;
74

@@ -80,89 +77,6 @@ public void CanCorrectlyDetectCommitCountsSemVer()
8077
}
8178
}
8279

83-
84-
/*
85-
* hotfix-1.2.1 -----------C--
86-
* / \
87-
* master A----------------F-----H-------N
88-
* \ / \ /
89-
* hotfix-1.3.1 \ / ----L
90-
* \ / \
91-
* release-1.3.0 \ -D----G--- \
92-
* \ / \ \
93-
* develop -----B----E-------I-----M--O--P
94-
* \ /
95-
* feature -------J-K-
96-
*
97-
*
98-
* - A is tagged `1.2.0`
99-
* - F is tagged `1.2.1`
100-
* - H is tagged `1.3.0`
101-
* - N is tagged `1.3.1`
102-
*/
103-
104-
[Test]
105-
public void CanCorrectlyDetectCommitCountsAndReleaseDataWhenThatApplies()
106-
{
107-
using (var f = new CommitCountingRepoFixture())
108-
{
109-
ResetToP(f.Repository);
110-
EnsureBranchMatch(f, "develop");
111-
112-
ResetToO(f.Repository);
113-
EnsureBranchMatch(f, "develop");
114-
115-
ResetToN(f.Repository);
116-
EnsureBranchMatch(f, "master", r => (Commit)r.Tags["1.3.0"].Target);
117-
118-
ResetToM(f.Repository);
119-
EnsureBranchMatch(f, "develop");
120-
121-
ResetToL(f.Repository);
122-
EnsureBranchMatch(f, "hotfix-1.3.1", r => (Commit)r.Tags["1.3.0"].Target);
123-
124-
ResetToK(f.Repository);
125-
EnsureBranchMatch(f, "feature");
126-
127-
ResetToJ(f.Repository);
128-
EnsureBranchMatch(f, "feature");
129-
130-
ResetToI(f.Repository);
131-
EnsureBranchMatch(f, "develop");
132-
133-
ResetToH(f.Repository);
134-
EnsureBranchMatch(f, "master", r => (Commit)r.Tags["1.3.0"].Target);
135-
136-
ResetToG(f.Repository);
137-
EnsureBranchMatch(f, "release-1.3.0");
138-
139-
ResetToF(f.Repository);
140-
EnsureBranchMatch(f, "master", r => (Commit)r.Tags["1.2.0"].Target);
141-
142-
ResetToE(f.Repository);
143-
EnsureBranchMatch(f, "develop");
144-
145-
ResetToD(f.Repository);
146-
EnsureBranchMatch(f, "release-1.3.0");
147-
148-
ResetToC(f.Repository);
149-
EnsureBranchMatch(f, "hotfix-1.2.1", r => (Commit)r.Tags["1.2.0"].Target);
150-
151-
ResetToB(f.Repository);
152-
EnsureBranchMatch(f, "develop");
153-
}
154-
}
155-
156-
static void EnsureBranchMatch(CommitCountingRepoFixture fixture, string branchName, Func<IRepository, Commit> commitFinder = null)
157-
{
158-
var referenceCommitFinder = commitFinder ?? (r => r.FindBranch(branchName).Tip);
159-
160-
var commit = referenceCommitFinder(fixture.Repository);
161-
var releaseDate = LastMinorVersionFinder.Execute(fixture.Repository, new TestEffectiveConfiguration(), commit);
162-
releaseDate.ShouldBe(commit.When());
163-
}
164-
165-
16680
static void EnsureMetaDataMatch(CommitCountingRepoFixture fixture,string expectedSemVer)
16781
{
16882
var result = fixture.ExecuteGitVersion();

GitVersionCore/GitVersionCore.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@
8484
<Compile Include="Helpers\FileSystem.cs" />
8585
<Compile Include="Helpers\IFileSystem.cs" />
8686
<Compile Include="Helpers\ProcessHelper.cs" />
87-
<Compile Include="LastMinorVersionFinder.cs" />
8887
<Compile Include="OutputVariables\CommitsAsFourthVersionPartFormatter.cs" />
8988
<Compile Include="OutputVariables\VersionVariables.cs" />
9089
<Compile Include="Extensions\ExtensionMethods.git.cs" />

GitVersionCore/LastMinorVersionFinder.cs

Lines changed: 0 additions & 61 deletions
This file was deleted.

GitVersionTask.Tests/AssemblyInfoBuilderTests.VerifyAssemblyVersion_Major.approved.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@ using System.Reflection;
55
[assembly: AssemblyVersion("2.0.0.0")]
66
[assembly: AssemblyFileVersion("2.0.0.0")]
77
[assembly: AssemblyInformationalVersion("2.3.4+5.Branch.master.Sha.commitSha")]
8-
[assembly: ReleaseDate("2014-03-01", "2014-03-06")]
8+
[assembly: ReleaseDate("2014-03-06")]
99

1010
[System.Runtime.CompilerServices.CompilerGenerated]
1111
sealed class ReleaseDateAttribute : System.Attribute
1212
{
13-
public string OriginalDate { get; private set; }
1413
public string Date { get; private set; }
1514

16-
public ReleaseDateAttribute(string originalDate, string date)
15+
public ReleaseDateAttribute(string date)
1716
{
18-
OriginalDate = originalDate;
1917
Date = date;
2018
}
2119
}

GitVersionTask.Tests/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor.approved.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@ using System.Reflection;
55
[assembly: AssemblyVersion("2.3.0.0")]
66
[assembly: AssemblyFileVersion("2.3.0.0")]
77
[assembly: AssemblyInformationalVersion("2.3.4+5.Branch.master.Sha.commitSha")]
8-
[assembly: ReleaseDate("2014-03-01", "2014-03-06")]
8+
[assembly: ReleaseDate("2014-03-06")]
99

1010
[System.Runtime.CompilerServices.CompilerGenerated]
1111
sealed class ReleaseDateAttribute : System.Attribute
1212
{
13-
public string OriginalDate { get; private set; }
1413
public string Date { get; private set; }
1514

16-
public ReleaseDateAttribute(string originalDate, string date)
15+
public ReleaseDateAttribute(string date)
1716
{
18-
OriginalDate = originalDate;
1917
Date = date;
2018
}
2119
}

GitVersionTask.Tests/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatch.approved.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@ using System.Reflection;
55
[assembly: AssemblyVersion("2.3.4.0")]
66
[assembly: AssemblyFileVersion("2.3.4.0")]
77
[assembly: AssemblyInformationalVersion("2.3.4+5.Branch.master.Sha.commitSha")]
8-
[assembly: ReleaseDate("2014-03-01", "2014-03-06")]
8+
[assembly: ReleaseDate("2014-03-06")]
99

1010
[System.Runtime.CompilerServices.CompilerGenerated]
1111
sealed class ReleaseDateAttribute : System.Attribute
1212
{
13-
public string OriginalDate { get; private set; }
1413
public string Date { get; private set; }
1514

16-
public ReleaseDateAttribute(string originalDate, string date)
15+
public ReleaseDateAttribute(string date)
1716
{
18-
OriginalDate = originalDate;
1917
Date = date;
2018
}
2119
}

GitVersionTask.Tests/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatchMetadata.approved.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@ using System.Reflection;
55
[assembly: AssemblyVersion("2.3.4.5")]
66
[assembly: AssemblyFileVersion("2.3.4.5")]
77
[assembly: AssemblyInformationalVersion("2.3.4+5.Branch.master.Sha.commitSha")]
8-
[assembly: ReleaseDate("2014-03-01", "2014-03-06")]
8+
[assembly: ReleaseDate("2014-03-06")]
99

1010
[System.Runtime.CompilerServices.CompilerGenerated]
1111
sealed class ReleaseDateAttribute : System.Attribute
1212
{
13-
public string OriginalDate { get; private set; }
1413
public string Date { get; private set; }
1514

16-
public ReleaseDateAttribute(string originalDate, string date)
15+
public ReleaseDateAttribute(string date)
1716
{
18-
OriginalDate = originalDate;
1917
Date = date;
2018
}
2119
}

GitVersionTask.Tests/AssemblyInfoBuilderTests.VerifyCreatedCode.approved.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@ using System.Reflection;
55
[assembly: AssemblyVersion("1.2.3.0")]
66
[assembly: AssemblyFileVersion("1.2.3.0")]
77
[assembly: AssemblyInformationalVersion("1.2.3-unstable.4+5.Branch.feature1.Sha.commitSha")]
8-
[assembly: ReleaseDate("2014-03-01", "2014-03-06")]
8+
[assembly: ReleaseDate("2014-03-06")]
99

1010
[System.Runtime.CompilerServices.CompilerGenerated]
1111
sealed class ReleaseDateAttribute : System.Attribute
1212
{
13-
public string OriginalDate { get; private set; }
1413
public string Date { get; private set; }
1514

16-
public ReleaseDateAttribute(string originalDate, string date)
15+
public ReleaseDateAttribute(string date)
1716
{
18-
OriginalDate = originalDate;
1917
Date = date;
2018
}
2119
}

GitVersionTask.Tests/AssemblyInfoBuilderTests.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ public void VerifyCreatedCode()
2929
{
3030
CachedVersion = new CachedVersion
3131
{
32-
SemanticVersion = semanticVersion,
33-
MasterReleaseDate = DateTimeOffset.Parse("2014-03-01 00:00:01Z"),
32+
SemanticVersion = semanticVersion
3433
}
3534
};
3635
var assemblyInfoText = assemblyInfoBuilder.GetAssemblyInfoText(new TestEffectiveConfiguration());
@@ -84,8 +83,7 @@ static void VerifyAssemblyVersion(AssemblyVersioningScheme avs)
8483
{
8584
CachedVersion = new CachedVersion
8685
{
87-
SemanticVersion = semanticVersion,
88-
MasterReleaseDate = DateTimeOffset.Parse("2014-03-01 00:00:01Z")
86+
SemanticVersion = semanticVersion
8987
},
9088
};
9189

GitVersionTask/AssemblyInfoBuilder/AssemblyInfoBuilder.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,29 @@ public string GetAssemblyInfoText(EffectiveConfiguration configuration)
1717
[assembly: AssemblyVersion(""{0}"")]
1818
[assembly: AssemblyFileVersion(""{1}"")]
1919
[assembly: AssemblyInformationalVersion(""{2}"")]
20-
[assembly: ReleaseDate(""{3}"", ""{4}"")]
20+
[assembly: ReleaseDate(""{3}"")]
2121
2222
[System.Runtime.CompilerServices.CompilerGenerated]
2323
sealed class ReleaseDateAttribute : System.Attribute
2424
{{
25-
public string OriginalDate {{ get; private set; }}
2625
public string Date {{ get; private set; }}
2726
28-
public ReleaseDateAttribute(string originalDate, string date)
27+
public ReleaseDateAttribute(string date)
2928
{{
30-
OriginalDate = originalDate;
3129
Date = date;
3230
}}
3331
}}
3432
3533
[System.Runtime.CompilerServices.CompilerGenerated]
3634
static class GitVersionInformation
3735
{{
38-
{5}
36+
{4}
3937
}}
4038
4139
4240
", vars.AssemblySemVer,
4341
vars.AssemblySemVer,
4442
semanticVersion.ToString("i"),
45-
CachedVersion.MasterReleaseDate.UtcDateTime.ToString("yyyy-MM-dd"),
4643
semanticVersion.BuildMetaData.CommitDate.UtcDateTime.ToString("yyyy-MM-dd"),
4744
GenerateVariableMembers(vars));
4845

GitVersionTask/CachedVersion.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
using System;
2-
using GitVersion;
1+
using GitVersion;
32

43
public class CachedVersion
54
{
65
public SemanticVersion SemanticVersion;
76
public long Timestamp;
8-
public DateTimeOffset MasterReleaseDate;
97
}

GitVersionTask/VersionCache.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public static Tuple<CachedVersion, GitVersionContext> GetVersion(string gitDirec
2222
{
2323
Logger.WriteInfo("Change detected. flushing cache.");
2424
result.Item1.SemanticVersion = versionFinder.FindVersion(context);
25-
result.Item1.MasterReleaseDate = LastMinorVersionFinder.Execute(repo, context.Configuration, repo.Head.Tip);
2625
}
2726
return result;
2827
}
@@ -31,7 +30,6 @@ public static Tuple<CachedVersion, GitVersionContext> GetVersion(string gitDirec
3130
return versionCacheVersions[key] = Tuple.Create(new CachedVersion
3231
{
3332
SemanticVersion = versionFinder.FindVersion(context),
34-
MasterReleaseDate = LastMinorVersionFinder.Execute(repo, context.Configuration, repo.Head.Tip),
3533
Timestamp = ticks
3634
}, context);
3735
}

0 commit comments

Comments
 (0)