From 7783fd547b1f9da962042ef684344e541c2845de Mon Sep 17 00:00:00 2001 From: Eirik Tsarpalis Date: Mon, 18 Nov 2019 15:41:36 +0000 Subject: [PATCH] Add windows support for build.sh (#94) --- build.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index ae097a31d855ea..da2ba1a158ec1b 100755 --- a/build.sh +++ b/build.sh @@ -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 )" @@ -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