Skip to content

Commit

Permalink
Add windows support for build.sh (dotnet#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriktsarpalis authored and ViktorHofer committed Nov 18, 2019
1 parent 912f082 commit 7783fd5
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

source="${BASH_SOURCE[0]}"

function is_cygwin_or_mingw()
{
case $(uname -s) in
CYGWIN*) return 0;;
MINGW*) return 0;;
*) return 1;;
esac
}

# resolve $SOURCE until the file is no longer a symlink
while [[ -h $source ]]; do
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
Expand All @@ -13,4 +22,12 @@ while [[ -h $source ]]; do
done

scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
"$scriptroot/eng/build.sh" $@

if is_cygwin_or_mingw; then
# if bash shell running on Windows (not WSL),
# pass control to powershell build script.
scriptroot=$(cygpath -d "$scriptroot")
powershell -c "$scriptroot\\build.cmd" $@
else
"$scriptroot/eng/build.sh" $@
fi

0 comments on commit 7783fd5

Please sign in to comment.