2015-12-28 19:47:21 +00:00
|
|
|
#
|
|
|
|
# Copyright (c) .NET Foundation and contributors. All rights reserved.
|
|
|
|
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
#
|
|
|
|
|
|
|
|
function header([string]$message)
|
|
|
|
{
|
2017-05-26 22:46:56 +00:00
|
|
|
Write-Output -ForegroundColor Green "*** $message ***"
|
2015-12-28 19:47:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function info([string]$message)
|
|
|
|
{
|
2017-05-26 22:46:56 +00:00
|
|
|
Write-Output -ForegroundColor Yellow "*** $message ***"
|
2015-12-28 19:47:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function error([string]$message)
|
|
|
|
{
|
2017-05-26 22:46:56 +00:00
|
|
|
Write-Output -ForegroundColor Red "$message"
|
2015-12-28 19:47:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function setEnvIfDefault([string]$envVarName, [string]$value)
|
|
|
|
{
|
|
|
|
If ([Environment]::GetEnvironmentVariable($envVarName) -eq $null)
|
|
|
|
{
|
|
|
|
[Environment]::SetEnvironmentVariable($envVarName, $value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-06 10:27:16 +00:00
|
|
|
function setVarIfDefault([string]$varName, [string]$value)
|
|
|
|
{
|
|
|
|
If (-not (Get-Variable -name $varName -ErrorAction SilentlyContinue))
|
|
|
|
{
|
|
|
|
Set-Variable -name $varName -value $value -scope 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-28 19:47:21 +00:00
|
|
|
function setPathAndHomeIfDefault([string]$rootPath)
|
|
|
|
{
|
2016-02-18 21:05:12 +00:00
|
|
|
If ($env:DOTNET_ON_PATH -eq $null)
|
2015-12-28 19:47:21 +00:00
|
|
|
{
|
2016-01-06 10:27:16 +00:00
|
|
|
setPathAndHome $rootPath
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function setPathAndHome([string]$rootPath)
|
|
|
|
{
|
2016-02-20 21:53:36 +00:00
|
|
|
$env:DOTNET_ON_PATH=$rootPath
|
|
|
|
$env:PATH="$rootPath\bin;$env:PATH"
|
2015-12-28 19:47:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function _([string]$command)
|
|
|
|
{
|
|
|
|
& "$command"
|
|
|
|
if (!$?) {
|
|
|
|
error "Command Failed: '& $command'"
|
|
|
|
Exit 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function _([string]$command, $arguments)
|
|
|
|
{
|
|
|
|
& "$command" @arguments
|
|
|
|
if (!$?) {
|
|
|
|
error "Command Failed: '& $command'"
|
|
|
|
Exit 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function _cmd([string]$command)
|
|
|
|
{
|
|
|
|
cmd /c "$command"
|
|
|
|
if (!$?) {
|
|
|
|
error "Command Failed: 'cmd /c $command'"
|
|
|
|
Exit 1
|
|
|
|
}
|
2016-02-02 18:04:50 +00:00
|
|
|
}
|