@@ -14,26 +14,35 @@ namespace GitVersion
14
14
public class GitVersionTool : IGitVersionTool
15
15
{
16
16
private readonly ILog log ;
17
+ private readonly IFileSystem fileSystem ;
17
18
private readonly IGitVersionCache gitVersionCache ;
18
19
private readonly INextVersionCalculator nextVersionCalculator ;
19
20
private readonly IVariableProvider variableProvider ;
20
21
private readonly IGitVersionCacheKeyFactory cacheKeyFactory ;
21
- private readonly IFileSystem fileSystem ;
22
+ private readonly IWixVersionFileUpdater wixVersionFileUpdater ;
23
+ private readonly IGitVersionInformationGenerator gitVersionInformationGenerator ;
24
+
22
25
private readonly IOptions < Arguments > options ;
23
26
private readonly GitVersionContext context ;
27
+
24
28
private readonly IBuildServer buildServer ;
25
29
26
- public GitVersionTool ( ILog log , IGitVersionCache gitVersionCache , INextVersionCalculator nextVersionCalculator , IVariableProvider variableProvider ,
27
- IGitVersionCacheKeyFactory cacheKeyFactory , IBuildServerResolver buildServerResolver , IFileSystem fileSystem ,
30
+ public GitVersionTool ( ILog log , IFileSystem fileSystem , IGitVersionCache gitVersionCache , INextVersionCalculator nextVersionCalculator , IVariableProvider variableProvider ,
31
+ IGitVersionCacheKeyFactory cacheKeyFactory , IBuildServerResolver buildServerResolver ,
32
+ IWixVersionFileUpdater wixVersionFileUpdater , IGitVersionInformationGenerator gitVersionInformationGenerator ,
28
33
IOptions < Arguments > options , IOptions < GitVersionContext > versionContext )
29
34
{
30
35
this . log = log ?? throw new ArgumentNullException ( nameof ( log ) ) ;
36
+ this . fileSystem = fileSystem ?? throw new ArgumentNullException ( nameof ( fileSystem ) ) ;
31
37
this . gitVersionCache = gitVersionCache ?? throw new ArgumentNullException ( nameof ( gitVersionCache ) ) ;
32
38
this . nextVersionCalculator = nextVersionCalculator ?? throw new ArgumentNullException ( nameof ( nextVersionCalculator ) ) ;
33
39
this . variableProvider = variableProvider ?? throw new ArgumentNullException ( nameof ( variableProvider ) ) ;
34
40
this . options = options ?? throw new ArgumentNullException ( nameof ( options ) ) ;
35
41
this . cacheKeyFactory = cacheKeyFactory ?? throw new ArgumentNullException ( nameof ( cacheKeyFactory ) ) ;
36
- this . fileSystem = fileSystem ?? throw new ArgumentNullException ( nameof ( fileSystem ) ) ;
42
+
43
+ this . wixVersionFileUpdater = wixVersionFileUpdater ?? throw new ArgumentNullException ( nameof ( wixVersionFileUpdater ) ) ;
44
+ this . gitVersionInformationGenerator = gitVersionInformationGenerator ?? throw new ArgumentNullException ( nameof ( gitVersionInformationGenerator ) ) ;
45
+
37
46
context = versionContext . Value ;
38
47
buildServer = buildServerResolver . Resolve ( ) ;
39
48
}
@@ -107,15 +116,16 @@ public void UpdateWixVersionFile(VersionVariables variables)
107
116
108
117
if ( arguments . UpdateWixVersionFile )
109
118
{
110
- using var wixVersionFileUpdater = new WixVersionFileUpdater ( arguments . TargetPath , variables , fileSystem , log ) ;
111
- wixVersionFileUpdater . Update ( ) ;
119
+ using ( wixVersionFileUpdater )
120
+ {
121
+ wixVersionFileUpdater . Update ( variables , arguments . TargetPath ) ;
122
+ }
112
123
}
113
124
}
114
125
115
126
public void GenerateGitVersionInformation ( VersionVariables variables , FileWriteInfo fileWriteInfo )
116
127
{
117
- var generator = new GitVersionInformationGenerator ( fileSystem ) ;
118
- generator . Generate ( variables , fileWriteInfo ) ;
128
+ gitVersionInformationGenerator . Generate ( variables , fileWriteInfo ) ;
119
129
}
120
130
121
131
private VersionVariables ExecuteInternal ( )
0 commit comments