From bf470de5ca39849c81be5719acdc93e0b1e0df29 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Fri, 1 Apr 2016 14:43:18 -0700 Subject: [PATCH] Obtain runtime from dotnet --info This is a breaking change that requires developers to update their version of .NET CLI. In order to stop specifying where dotnet should output the artifacts, we need to be able to guess their location correctly, which requires knowing the current RID (and framework). --- PowerShellGitHubDev.psm1 | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index a25a9510d1..e14cf531ae 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -89,6 +89,20 @@ function Start-PSBuild { $precheck = $precheck -and (precheck $Dependency "Build dependency '$Dependency' not found. Run '$InstallCommand install $Dependency'") } } + + if (-Not $Runtime) { + $Runtime = dotnet --info | % { + if ($_ -match "RID") { + $_ -split "\s+" | Select-Object -Last 1 + } + } + + if (-Not $Runtime) { + Write-Warning "Could not determine Runtime Identifier, please update dotnet" + $precheck = $false + } else { + log "Runtime not specified, using $Runtime" + } } # Abort if any precheck failed @@ -171,8 +185,12 @@ function Start-PSBuild { log "Building PowerShell" $Arguments = "--framework", $framework - if ($IsLinux -Or $IsOSX) { $Arguments += "--configuration", "Linux" } - if ($Runtime) { $Arguments += "--runtime", $Runtime } + + if ($IsLinux -Or $IsOSX) { + $Arguments += "--configuration", "Linux" + } + + $Arguments += "--runtime", $Runtime log "Run dotnet build $Arguments from $pwd"