Skip to content

Commit 61e150e

Browse files
committed
(cleanup) some minor changes
1 parent 1430eab commit 61e150e

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

src/GitVersionTask/FileHelper.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,21 @@ public static void DeleteTempFiles()
4444
}
4545
}
4646

47+
public static string GetFileExtension(string language)
48+
{
49+
switch (language)
50+
{
51+
case "C#":
52+
return "cs";
53+
case "F#":
54+
return "fs";
55+
case "VB":
56+
return "vb";
57+
default:
58+
throw new ArgumentException($"Unknown language detected: '{language}'");
59+
}
60+
}
61+
4762
public static void CheckForInvalidFiles(IEnumerable<string> compileFiles, string projectFile)
4863
{
4964
foreach (var compileFile in GetInvalidFiles(compileFiles, projectFile))

src/GitVersionTask/GitVersionTaskUtils.cs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,6 @@ internal static TOutput ExecuteGitVersionTask<TInput, TOutput>(TInput input, Fun
4141
public static bool GetVersionVariables(InputBase input, out VersionVariables versionVariables)
4242
=> new ExecuteCore(new FileSystem()).TryGetVersion(input.SolutionDirectory, out versionVariables, input.NoFetch, new Authentication());
4343

44-
private static string GetFileExtension(this string language)
45-
{
46-
switch (language)
47-
{
48-
case "C#":
49-
return "cs";
50-
51-
case "F#":
52-
return "fs";
53-
54-
case "VB":
55-
return "vb";
56-
57-
default:
58-
throw new ArgumentException($"Unknown language detected: '{language}'");
59-
}
60-
}
61-
6244
public static FileWriteInfo GetFileWriteInfo(
6345
this string intermediateOutputPath,
6446
string language,
@@ -67,7 +49,7 @@ public static FileWriteInfo GetFileWriteInfo(
6749
Func<string, string, string> fileNameNoIntermediatePath
6850
)
6951
{
70-
var fileExtension = language.GetFileExtension();
52+
var fileExtension = FileHelper.GetFileExtension(language);
7153
string workingDirectory, fileName;
7254
if (intermediateOutputPath == null)
7355
{

src/GitVersionTask/UpdateAssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ private static Output CreateTempAssemblyInfo(Input input, VersionVariables versi
2828
var fileWriteInfo = input.IntermediateOutputPath.GetFileWriteInfo(
2929
input.Language,
3030
input.ProjectFile,
31-
(pf, ext) => $"GitVersionTaskAssemblyInfo.g.{ext}",
31+
(pf, ext) => $"AssemblyInfo.g.{ext}",
3232
(pf, ext) => $"AssemblyInfo_{Path.GetFileNameWithoutExtension(pf)}_{Path.GetRandomFileName()}.g.{ext}"
3333
);
3434

0 commit comments

Comments
 (0)