Skip to content

Commit 2739468

Browse files
authored
Merge pull request #3749 from BinToss/fix-schemas
fix(GitVersion.Core, GitVersion.Schema): improve implementation of Types and JSON keywords in GitVersion.Configuration.json
2 parents a292513 + 3dddd7e commit 2739468

23 files changed

+333
-366
lines changed

build.ps1

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,30 @@ $Arguments = @{
4343
exclusive=$Exclusive;
4444
nuget_useinprocessclient=$true;
4545
}.GetEnumerator() | ForEach-Object {
46-
if ($_.value -ne "") { "--{0}=`"{1}`"" -f $_.key, $_.value }
46+
if ($($_.Key -ceq "dryrun") -or ($_.Key -ceq "exclusive")) {
47+
if ($_.Value -eq $true) {
48+
# switches must not be assigned true or false, but must be passed to indicate true.
49+
"--{0}" -f $_.Key
50+
}
51+
}
52+
else {
53+
if ($_.Value -cne "") {
54+
if ($_.Value -as [string] -contains " ") {
55+
$_.Value = "$($_.Value)" # if it contains spaces, enclose it.
56+
}
57+
"--{0}={1}" -f $_.Key, $_.Value
58+
}
59+
}
4760
};
4861

62+
$Arguments | Join-String -Separator " " | Write-Verbose
63+
4964
# Start Cake
5065
Write-Host "Running build stage $Stage..."
5166

52-
& dotnet run --project build/$Stage/$Stage.csproj -- $Arguments $ScriptArgs
67+
$cmdline = "& dotnet run --project build/$Stage/$Stage.csproj -- $Arguments $ScriptArgs"
68+
Write-Verbose $cmdline
69+
Invoke-Command -ScriptBlock ([scriptblock]::Create($cmdline))
5370

5471
if ($env:APPVEYOR) {
5572
$host.SetShouldExit($LASTEXITCODE)

build/common/Lifetime/BuildLifetimeBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@ public override void Setup(T context, ISetupContext info)
3030
context.Information("Running BuildPrepare...");
3131
return;
3232
}
33-
var gitVersionTool = context.GetGitVersionDotnetToolLocation();
3433
var gitVersionSettings = new GitVersionSettings
3534
{
3635
OutputTypes = new() { GitVersionOutput.Json, GitVersionOutput.BuildServer },
3736
ToolPath = context.Tools.Resolve(new[] { "dotnet.exe", "dotnet" }),
38-
ArgumentCustomization = args => args.Prepend(gitVersionTool!.FullPath)
37+
ArgumentCustomization = args => args.Prepend(context.GetGitVersionDotnetToolLocation()?.FullPath ?? throw new FileNotFoundException("Failed to locate the Release build of gitversion.dll in ./tools/gitversion. Try running \"./build.ps1 -Stage build -Target BuildPrepare\""))
3938
};
4039

4140
var gitVersion = context.GitVersion(gitVersionSettings);

0 commit comments

Comments
 (0)