Skip to content

Commit

Permalink
handle missing options in global.json when using "Specific Runtime" s…
Browse files Browse the repository at this point in the history
…witch
  • Loading branch information
kirkone committed Apr 22, 2016
1 parent 8196e19 commit 62d9fda
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions VSTS.DNX.Tasks.Shared/InstallDNVM.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,26 @@

$globalJson = Get-Content -Path .\global.json -Raw -ErrorAction Ignore | ConvertFrom-Json -ErrorAction Ignore

$dnxParams = ""

if($globalJson)
{
Write-Output "Take DNX version from global.json."
$dnxVersion = $globalJson.sdk.version
$dnxParams = ""
if($SpecificRuntime)
{
$dnxRuntime = $globalJson.sdk.runtime
$dnxArch = $globalJson.sdk.architecture
$dnxParams = "-r $dnxRuntime -a $dnxArch"

Write-Output " Specific Runtime:"
Write-Output " Runtime: $dnxRuntime"
Write-Output " Architecture: $dnxArch"

$dnxParams = (
"{0} {1}" -f
$(If(-Not [string]::IsNullOrWhiteSpace($dnxRuntime)){"-r $dnxRuntime"}),
$(If(-Not [string]::IsNullOrWhiteSpace($dnxArch)){"-a $dnxArch"})
)
}
}
else
Expand Down

0 comments on commit 62d9fda

Please sign in to comment.