From ffdb7fb194412db7edeb739e375eb5c11fce6a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Wed, 29 Jun 2016 12:13:44 +0200 Subject: [PATCH] Replace the command line argument switches for GitVersion Replace slash with dash in the command line argument switches for gitversion.exe, so it is more Unix friendly. It will still fail exeucting on OS X due to GitTools/GitVersion#890, but once that has been fixed, this should ensure that GitVersion executes successfully on OS X. --- .../Tools/GitVersion/GitVersionRunnerTests.cs | 16 ++++++------- .../Tools/GitVersion/GitVersionRunner.cs | 24 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Cake.Common.Tests/Unit/Tools/GitVersion/GitVersionRunnerTests.cs b/src/Cake.Common.Tests/Unit/Tools/GitVersion/GitVersionRunnerTests.cs index d0b2a8e4ed..44a167c850 100644 --- a/src/Cake.Common.Tests/Unit/Tools/GitVersion/GitVersionRunnerTests.cs +++ b/src/Cake.Common.Tests/Unit/Tools/GitVersion/GitVersionRunnerTests.cs @@ -93,7 +93,7 @@ public void Should_Add_OutputType_To_Arguments_If_Set() var result = fixture.Run(); // Then - Assert.Equal("/output json", result.Args); + Assert.Equal("-output json", result.Args); } [Fact] @@ -107,7 +107,7 @@ public void Should_Add_ShowVariable_To_Arguments_If_Set() var result = fixture.Run(); // Then - Assert.Equal("/showvariable FullSemVer", result.Args); + Assert.Equal("-showvariable FullSemVer", result.Args); } [Fact] @@ -122,7 +122,7 @@ public void Should_Add_Username_And_Password_To_Arguments_If_Set() var result = fixture.Run(); // Then - Assert.Equal("/u \"bob\" /p \"password\"", result.Args); + Assert.Equal("-u \"bob\" -p \"password\"", result.Args); } [Fact] @@ -136,7 +136,7 @@ public void Should_Add_UpdateAssemblyInfo_To_Arguments_If_Set() var result = fixture.Run(); // Then - Assert.Equal("/updateassemblyinfo", result.Args); + Assert.Equal("-updateassemblyinfo", result.Args); } [Fact] @@ -151,7 +151,7 @@ public void Should_Add_UpdateAssemblyInfoFilePath_To_Arguments_If_Set() var result = fixture.Run(); // Then - Assert.Equal("/updateassemblyinfo \"c:/temp/assemblyinfo.cs\"", result.Args); + Assert.Equal("-updateassemblyinfo \"c:/temp/assemblyinfo.cs\"", result.Args); } [Fact] @@ -165,7 +165,7 @@ public void Should_Add_RepositoryPath_To_Arguments_If_Set() var result = fixture.Run(); // Then - Assert.Equal("/targetpath \"c:/temp\"", result.Args); + Assert.Equal("-targetpath \"c:/temp\"", result.Args); } [Fact] @@ -182,7 +182,7 @@ public void Should_Add_DynamicRepoSettings_To_Arguments_If_Set() var result = fixture.Run(); // Then - Assert.Equal("/url \"http://mygitrepo.co.uk\" /b master /c \"abcdef\" /dynamicRepoLocation \"c:/temp\"", result.Args); + Assert.Equal("-url \"http://mygitrepo.co.uk\" -b master -c \"abcdef\" -dynamicRepoLocation \"c:/temp\"", result.Args); } [Fact] @@ -196,7 +196,7 @@ public void Should_Add_LogFilePath_To_Arguments_If_Set() var result = fixture.Run(); // Then - Assert.Equal("/l \"c:/temp/gitversion.log\"", result.Args); + Assert.Equal("-l \"c:/temp/gitversion.log\"", result.Args); } } } diff --git a/src/Cake.Common/Tools/GitVersion/GitVersionRunner.cs b/src/Cake.Common/Tools/GitVersion/GitVersionRunner.cs index e51d6800cf..80773b9af6 100644 --- a/src/Cake.Common/Tools/GitVersion/GitVersionRunner.cs +++ b/src/Cake.Common/Tools/GitVersion/GitVersionRunner.cs @@ -79,11 +79,11 @@ private ProcessArgumentBuilder GetArguments(GitVersionSettings settings) switch (settings.OutputType.Value) { case GitVersionOutput.Json: - builder.Append("/output"); + builder.Append("-output"); builder.Append("json"); break; case GitVersionOutput.BuildServer: - builder.Append("/output"); + builder.Append("-output"); builder.Append("buildserver"); break; } @@ -91,22 +91,22 @@ private ProcessArgumentBuilder GetArguments(GitVersionSettings settings) if (!string.IsNullOrWhiteSpace(settings.ShowVariable)) { - builder.Append("/showvariable"); + builder.Append("-showvariable"); builder.Append(settings.ShowVariable); } if (!string.IsNullOrWhiteSpace(settings.UserName)) { - builder.Append("/u"); + builder.Append("-u"); builder.AppendQuoted(settings.UserName); - builder.Append("/p"); + builder.Append("-p"); builder.AppendQuotedSecret(settings.Password); } if (settings.UpdateAssemblyInfo) { - builder.Append("/updateassemblyinfo"); + builder.Append("-updateassemblyinfo"); if (settings.UpdateAssemblyInfoFilePath != null) { @@ -116,17 +116,17 @@ private ProcessArgumentBuilder GetArguments(GitVersionSettings settings) if (settings.RepositoryPath != null) { - builder.Append("/targetpath"); + builder.Append("-targetpath"); builder.AppendQuoted(settings.RepositoryPath.FullPath); } else if (!string.IsNullOrWhiteSpace(settings.Url)) { - builder.Append("/url"); + builder.Append("-url"); builder.AppendQuoted(settings.Url); if (!string.IsNullOrWhiteSpace(settings.Branch)) { - builder.Append("/b"); + builder.Append("-b"); builder.Append(settings.Branch); } else @@ -136,20 +136,20 @@ private ProcessArgumentBuilder GetArguments(GitVersionSettings settings) if (!string.IsNullOrWhiteSpace(settings.Commit)) { - builder.Append("/c"); + builder.Append("-c"); builder.AppendQuoted(settings.Commit); } if (settings.DynamicRepositoryPath != null) { - builder.Append("/dynamicRepoLocation"); + builder.Append("-dynamicRepoLocation"); builder.AppendQuoted(settings.DynamicRepositoryPath.FullPath); } } if (settings.LogFilePath != null) { - builder.Append("/l"); + builder.Append("-l"); builder.AppendQuoted(settings.LogFilePath.FullPath); }