Merge pull request #224 from dotnet/anurse/add-use-dev-script
Add script to put dev build on PATH
This commit is contained in:
commit
caba865565
3 changed files with 15 additions and 41 deletions
|
@ -1,41 +0,0 @@
|
|||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# This script is NOT executable. It MUST be sourced!
|
||||
|
||||
if [ ! -z "$BASH_SOURCE" ]; then
|
||||
SOURCE="${BASH_SOURCE}"
|
||||
elif [ ! -z "$ZSH_VERSION" ]; then
|
||||
SOURCE="$0"
|
||||
else
|
||||
echo "Unsupported shell, this requires bash or zsh" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
REPOROOT="$( cd -P "$DIR/.." && pwd )"
|
||||
|
||||
UNAME=$(uname)
|
||||
|
||||
if [ -z "$RID" ]; then
|
||||
if [ "$UNAME" == "Darwin" ]; then
|
||||
OSNAME=osx
|
||||
RID=osx.10.10-x64
|
||||
elif [ "$UNAME" == "Linux" ]; then
|
||||
# Detect Distro?
|
||||
OSNAME=linux
|
||||
RID=ubuntu.14.04-x64
|
||||
else
|
||||
error "unknown OS: $UNAME" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
export DOTNET_TOOLS=$REPOROOT/artifacts/$RID/stage2
|
4
scripts/unuse-dev.ps1
Normal file
4
scripts/unuse-dev.ps1
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Remove the stage2 output from the path
|
||||
$splat = $env:PATH.Split(";")
|
||||
$stripped = @($splat | where { $_ -notlike "*artifacts\win7-x64\stage2*" })
|
||||
$env:PATH = [string]::Join(";", $stripped)
|
11
scripts/use-dev.ps1
Normal file
11
scripts/use-dev.ps1
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Put the stage2 output on the front of the path
|
||||
$stage2 = "$PSScriptRoot\..\artifacts\win7-x64\stage2\bin"
|
||||
if (Test-Path $stage2) {
|
||||
$splat = $env:PATH.Split(";")
|
||||
$stage2 = Convert-Path $stage2
|
||||
if ($splat -notcontains $stage2) {
|
||||
$env:PATH="$stage2;$env:PATH"
|
||||
}
|
||||
} else {
|
||||
Write-Host "You don't have a dev build in the 'artifacts\win7-x64\stage2' folder!"
|
||||
}
|
Loading…
Reference in a new issue