From a188ebe4e23bfe33d69ed474d0ca6521aac61413 Mon Sep 17 00:00:00 2001 From: Andrew Stanton-Nurse Date: Tue, 17 Nov 2015 18:02:28 -0800 Subject: [PATCH] added a script to put the dev build on the PATH --- scripts/enable-dev.sh | 41 ----------------------------------------- scripts/unuse-dev.ps1 | 4 ++++ scripts/use-dev.ps1 | 11 +++++++++++ 3 files changed, 15 insertions(+), 41 deletions(-) delete mode 100644 scripts/enable-dev.sh create mode 100644 scripts/unuse-dev.ps1 create mode 100644 scripts/use-dev.ps1 diff --git a/scripts/enable-dev.sh b/scripts/enable-dev.sh deleted file mode 100644 index 8127c0a35..000000000 --- a/scripts/enable-dev.sh +++ /dev/null @@ -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 diff --git a/scripts/unuse-dev.ps1 b/scripts/unuse-dev.ps1 new file mode 100644 index 000000000..eefd11bc6 --- /dev/null +++ b/scripts/unuse-dev.ps1 @@ -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) diff --git a/scripts/use-dev.ps1 b/scripts/use-dev.ps1 new file mode 100644 index 000000000..93a549810 --- /dev/null +++ b/scripts/use-dev.ps1 @@ -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!" +}