From bd925bc2a2283bb2b1a39b6dce18d643f8348d3a Mon Sep 17 00:00:00 2001 From: Chris Lovett Date: Sun, 18 Apr 2021 10:51:56 -0700 Subject: [PATCH] fix pwsh support --- build.cmd | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/build.cmd b/build.cmd index 61f798ce7..2476ebbb0 100644 --- a/build.cmd +++ b/build.cmd @@ -42,6 +42,7 @@ echo found Powershell && goto start set powershell=pwsh where pwsh > nul 2>&1 if ERRORLEVEL 1 goto :nopwsh +set PWSHV7=1 echo found pwsh && goto start :nopwsh echo Powershell or pwsh not found, please install it. @@ -72,13 +73,17 @@ IF NOT EXIST external\rpclib\rpclib-2.2.1 ( ECHO Downloading rpclib ECHO ***************************************************************************************** @echo on - %powershell% -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr https://github.com/madratman/rpclib/archive/v2.2.1.zip -OutFile external\rpclib.zip }" + if "%PWSHV7%" == "" ( + %powershell% -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr https://github.com/madratman/rpclib/archive/v2.2.1.zip -OutFile external\rpclib.zip }" + ) else ( + %powershell% -command "iwr https://github.com/madratman/rpclib/archive/v2.2.1.zip -OutFile external\rpclib.zip" + ) @echo off REM //remove any previous versions rmdir external\rpclib /q /s - %powershell% -command "& { Expand-Archive -Path external\rpclib.zip -DestinationPath external\rpclib }" + %powershell% -command "Expand-Archive -Path external\rpclib.zip -DestinationPath external\rpclib" del external\rpclib.zip /q REM //Don't fail the build if the high-poly car is unable to be downloaded @@ -137,10 +142,14 @@ IF NOT EXIST Unreal\Plugins\AirSim\Content\VehicleAdv\SUV\v1.2.0 ( @echo on REM %powershell% -command "& { Start-BitsTransfer -Source https://github.com/Microsoft/AirSim/releases/download/v1.2.0/car_assets.zip -Destination suv_download_tmp\car_assets.zip }" REM %powershell% -command "& { (New-Object System.Net.WebClient).DownloadFile('https://github.com/Microsoft/AirSim/releases/download/v1.2.0/car_assets.zip', 'suv_download_tmp\car_assets.zip') }" - %powershell% -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr https://github.com/Microsoft/AirSim/releases/download/v1.2.0/car_assets.zip -OutFile suv_download_tmp\car_assets.zip }" + if "%PWSHV7%" == "" ( + %powershell% -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr https://github.com/Microsoft/AirSim/releases/download/v1.2.0/car_assets.zip -OutFile suv_download_tmp\car_assets.zip }" + ) else ( + %powershell% -command "iwr https://github.com/Microsoft/AirSim/releases/download/v1.2.0/car_assets.zip -OutFile suv_download_tmp\car_assets.zip" + ) @echo off rmdir /S /Q Unreal\Plugins\AirSim\Content\VehicleAdv\SUV - %powershell% -command "& { Expand-Archive -Path suv_download_tmp\car_assets.zip -DestinationPath Unreal\Plugins\AirSim\Content\VehicleAdv }" + %powershell% -command "Expand-Archive -Path suv_download_tmp\car_assets.zip -DestinationPath Unreal\Plugins\AirSim\Content\VehicleAdv" rmdir suv_download_tmp /q /s REM //Don't fail the build if the high-poly car is unable to be downloaded @@ -154,9 +163,13 @@ IF NOT EXIST Unreal\Plugins\AirSim\Content\VehicleAdv\SUV\v1.2.0 ( REM //---------- get Eigen library ---------- IF NOT EXIST AirLib\deps mkdir AirLib\deps IF NOT EXIST AirLib\deps\eigen3 ( - %powershell% -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip -OutFile eigen3.zip }" - %powershell% -command "& { Expand-Archive -Path eigen3.zip -DestinationPath AirLib\deps }" - %powershell% -command "& { Move-Item -Path AirLib\deps\eigen* -Destination AirLib\deps\del_eigen }" + if "%PWSHV7%" == "" ( + %powershell% -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip -OutFile eigen3.zip }" + ) else ( + %powershell% -command "iwr https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip -OutFile eigen3.zip" + ) + %powershell% -command "Expand-Archive -Path eigen3.zip -DestinationPath AirLib\deps" + %powershell% -command "Move-Item -Path AirLib\deps\eigen* -Destination AirLib\deps\del_eigen" REM move AirLib\deps\eigen* AirLib\deps\del_eigen mkdir AirLib\deps\eigen3 move AirLib\deps\del_eigen\Eigen AirLib\deps\eigen3\Eigen