diff --git a/scripts/cmd/build.cmd b/scripts/cmd/build.cmd index ea1d4e22..9fd282b4 100644 --- a/scripts/cmd/build.cmd +++ b/scripts/cmd/build.cmd @@ -12,17 +12,17 @@ set CPU_COUNT_MAX=12 set PLATFORM=x64 REM // Check command line arguments -set fullPolyCar="" -set buildMode="" +set fullPolyCar= +set buildMode= REM // Check Visual Studio version -if %VisualStudioVersion% == "" ( +if %VisualStudioVersion% EQU "" ( echo. echo "ERROR: command must be run from VS2022 Developer Command Prompt or Developer PowerShell." goto :buildfailed_nomsg ) -if %VisualStudioVersion% lss 17.0 ( +if %VisualStudioVersion% LSS 17.0 ( echo. echo "AutonomySim supports up to Unreal Engine 5.3 and Visual Studio 2022." echo "Here are few easy steps to perform the upgrade:" @@ -31,27 +31,27 @@ if %VisualStudioVersion% lss 17.0 ( ) REM //---------- Parse arguments ---------- -if %1 == "" goto :noargs -if %1 == --full-poly-car set "fullPolyCar=y" -if %1 == --Debug set "buildMode=Debug" -if %1 == --Release set "buildMode=Release" -if %1 == --RelWithDebInfo set "buildMode=RelWithDebInfo" +if %1 EQU "" goto :noargs +if %1 EQU --full-poly-car set "fullPolyCar=y" +if %1 EQU --Debug set "buildMode=Debug" +if %1 EQU --Release set "buildMode=Release" +if %1 EQU --RelWithDebInfo set "buildMode=RelWithDebInfo" -if %2 == "" goto :noargs -if %2 == --Debug set "buildMode=Debug" -if %2 == --Release set "buildMode=Release" -if %2 == --RelWithDebInfo set "buildMode=RelWithDebInfo" +if %2 EQU "" goto :noargs +if %2 EQU --Debug set "buildMode=Debug" +if %2 EQU --Release set "buildMode=Release" +if %2 EQU --RelWithDebInfo set "buildMode=RelWithDebInfo" :noargs set powershell=powershell where powershell > nul 2>&1 -if %ERRORLEVEL% == 1 goto :pwsh +if %ERRORLEVEL% EQU 1 goto :pwsh echo "Found `powershell` command." && goto :start :pwsh set powershell=pwsh where pwsh > nul 2>&1 -if %ERRORLEVEL% == 1 goto :nopwsh +if %ERRORLEVEL% EQU 1 goto :nopwsh set PWSHV7=1 echo "Found `pwsh` command." && goto :start @@ -78,9 +78,9 @@ echo. REM //---------- Check cmake version ---------- call scripts\cmd\check_cmake.cmd -if %ERRORLEVEL% == 1 ( +if %ERRORLEVEL% EQU 1 ( call scripts\cmd\check_cmake.cmd - if %ERRORLEVEL% == 1 ( + if %ERRORLEVEL% EQU 1 ( echo. echo "ERROR: CMake not installed correctly." goto :buildfailed @@ -103,7 +103,7 @@ if not exist external\rpclib\rpclib-%RPCLIB_VERSION% ( echo. @echo on - if %PWSHV7% == "" ( + if %PWSHV7% EQU "" ( %powershell% -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr https://github.com/rpclib/rpclib/archive/v2.3.0.zip -OutFile tmp\rpclib.zip }" ) else ( %powershell% -command "iwr https://github.com/rpclib/rpclib/archive/v2.3.0.zip -OutFile tmp\rpclib.zip" @@ -130,14 +130,14 @@ cd external\rpclib\rpclib-%RPCLIB_VERSION%\build cmake -G"Visual Studio 17 2022" .. -if %buildMode% == "" ( +if %buildMode% EQU "" ( cmake --build . cmake --build . --config Release ) else ( cmake --build . --config %buildMode% ) -if %ERRORLEVEL% == 1 goto :buildfailed +if %ERRORLEVEL% EQU 1 goto :buildfailed cd %PROJECT_DIR% echo "Current directory: %PROJECT_DIR%" @@ -148,7 +148,7 @@ set RPCLIB_TARGET_INCLUDE=AutonomyLib\deps\rpclib\include if not exist %RPCLIB_TARGET_INCLUDE% mkdir %RPCLIB_TARGET_INCLUDE% robocopy /MIR external\rpclib\rpclib-%RPCLIB_VERSION%\include %RPCLIB_TARGET_INCLUDE% -if %buildMode% == "" ( +if %buildMode% EQU "" ( robocopy /MIR external\rpclib\rpclib-%RPCLIB_VERSION%\build\Debug %RPCLIB_TARGET_LIB%\Debug robocopy /MIR external\rpclib\rpclib-%RPCLIB_VERSION%\build\Release %RPCLIB_TARGET_LIB%\Release ) else ( @@ -158,7 +158,7 @@ if %buildMode% == "" ( REM //---------- Get High-polycount Car Model ------------ if not exist Unreal\Plugins\AutonomySim\Content\VehicleAdv mkdir Unreal\Plugins\AutonomySim\Content\VehicleAdv if not exist Unreal\Plugins\AutonomySim\Content\VehicleAdv\SUV\v1.2.0 ( - if %fullPolyCar% == y or %fullPolyCar% == yes ( + if %fullPolyCar% EQU y or %fullPolyCar% EQU yes ( REM //leave some blank lines because %powershell% shows download banner at top of console echo. echo "-----------------------------------------------------------------------------------------" @@ -172,7 +172,7 @@ if not exist Unreal\Plugins\AutonomySim\Content\VehicleAdv\SUV\v1.2.0 ( @echo on REM %powershell% -command "& { Start-BitsTransfer -Source https://github.com/nervosys/AutonomySim/releases/download/v1.2.0/car_assets.zip -Destination tmp\suv_download\car_assets.zip }" REM %powershell% -command "& { (New-Object System.Net.WebClient).DownloadFile('https://github.com/nervosys/AutonomySim/releases/download/v1.2.0/car_assets.zip', tmp\suv_download\car_assets.zip) }" - if %PWSHV7% == "" ( + if %PWSHV7% EQU "" ( %powershell% -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr https://github.com/nervosys/AutonomySim/releases/download/v2.0.0-beta.0/car_assets.zip -OutFile tmp\suv_download\car_assets.zip }" ) else ( %powershell% -command "iwr https://github.com/nervosys/AutonomySim/releases/download/v2.0.0-beta.0/car_assets.zip -OutFile tmp\suv_download\car_assets.zip" @@ -195,7 +195,7 @@ if not exist Unreal\Plugins\AutonomySim\Content\VehicleAdv\SUV\v1.2.0 ( REM //---------- Get Eigen library ---------- if not exist AutonomyLib\deps mkdir AutonomyLib\deps if not exist AutonomyLib\deps\eigen3 ( - if %PWSHV7% == "" ( + if %PWSHV7% EQU "" ( %powershell% -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip -OutFile tmp\eigen3.zip }" ) else ( %powershell% -command "iwr https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip -OutFile tmp\eigen3.zip" @@ -211,14 +211,14 @@ if not exist AutonomyLib\deps\eigen3 ( if not exist AutonomyLib\deps\eigen3 goto :buildfailed REM //---------- We now have all dependencies to compile AutonomySim.sln, which will also compile MavLinkCom ---------- -if %buildMode% == "" ( +if %buildMode% EQU "" ( msbuild -maxcpucount:%CPU_COUNT_MAX% /p:Platform=%PLATFORM% /p:Configuration=Debug AutonomySim.sln - if %ERRORLEVEL% == 1 goto :buildfailed + if %ERRORLEVEL% EQU 1 goto :buildfailed msbuild -maxcpucount:%CPU_COUNT_MAX% /p:Platform=%PLATFORM% /p:Configuration=Release AutonomySim.sln - if %ERRORLEVEL% == 1 goto :buildfailed + if %ERRORLEVEL% EQU 1 goto :buildfailed ) else ( msbuild -maxcpucount:%CPU_COUNT_MAX% /p:Platform=%PLATFORM% /p:Configuration=%buildMode% AutonomySim.sln - if %ERRORLEVEL% == 1 goto :buildfailed + if %ERRORLEVEL% EQU 1 goto :buildfailed ) REM //---------- Copy binaries and includes for MavLinkCom in deps ---------- diff --git a/scripts/cmd/build_all_ue_projects.cmd b/scripts/cmd/build_all_ue_projects.cmd index e595396b..91b8fa34 100644 --- a/scripts/cmd/build_all_ue_projects.cmd +++ b/scripts/cmd/build_all_ue_projects.cmd @@ -17,17 +17,17 @@ REM path for UE toolset set ToolPath=%5 REM set defaults if ars are not supplied -if %UnrealProjsPath% == "" set "UnrealProjsPath=D:\vso\msresearch\Theseus" -if %AutonomySimPath% == "" set "AutonomySimPath=C:\GitHubSrc\AutonomySim" -if %OutputPath% == "" set "OutputPath=%ROOT_DIR%build" -if %RebuildAutonomySim% == "" set "RebuildAutonomySim=true" +if %UnrealProjsPath% EQU "" set "UnrealProjsPath=D:\vso\msresearch\Theseus" +if %AutonomySimPath% EQU "" set "AutonomySimPath=C:\GitHubSrc\AutonomySim" +if %OutputPath% EQU "" set "OutputPath=%ROOT_DIR%build" +if %RebuildAutonomySim% EQU "" set "RebuildAutonomySim=true" REM re-build AutonomySim -if %RebuildAutonomySim% == true ( +if %RebuildAutonomySim% EQU true ( cd /D %AutonomySimPath% call clean call build - if %ERRORLEVEL% == 1 goto :failed + if %ERRORLEVEL% EQU 1 goto :failed cd /D %ROOT_DIR% ) @@ -55,15 +55,15 @@ if %~2 == "" ( ) else ( cd /D %UnrealProjsPath%\%~2 ) -if %ERRORLEVEL% == 1 goto :failed +if %ERRORLEVEL% EQU 1 goto :failed robocopy %AutonomySimPath%\Unreal\Environments\Blocks . *.cmd /njh /njs /ndl /np call update_from_git.cmd %AutonomySimPath% -if %ERRORLEVEL% == 1 goto :failed +if %ERRORLEVEL% EQU 1 goto :failed call package.cmd %OutputPath% %ToolPath% %~3 -if %ERRORLEVEL% == 1 goto :failed +if %ERRORLEVEL% EQU 1 goto :failed goto :done @@ -73,4 +73,4 @@ exit /b 1 :done cd %ROOT_DIR% -if %1 == "" pause +if %1 EQU "" pause diff --git a/scripts/cmd/build_docs.cmd b/scripts/cmd/build_docs.cmd index 358c0be8..9a08e86a 100644 --- a/scripts/cmd/build_docs.cmd +++ b/scripts/cmd/build_docs.cmd @@ -26,7 +26,7 @@ REM ) cd /d %BUILD_DIR% -if %1 == no_serve goto :PromptYN +if %1 EQU no_serve goto :PromptYN mkdocs serve :PromptYN diff --git a/scripts/cmd/check_cmake.cmd b/scripts/cmd/check_cmake.cmd index 826649c2..6be4f0fb 100644 --- a/scripts/cmd/check_cmake.cmd +++ b/scripts/cmd/check_cmake.cmd @@ -5,12 +5,12 @@ setlocal REM set ROOT_DIR=%~dp0 set cmake_minversion_majmin=3.14 -set cmake_version="" +set cmake_version= where /q cmake if %ERRORLEVEL% EQU 0 ( for /F tokens=3 %%a in ('cmake --version ^| find cmake version') do set cmake_version=%%a - if %cmake_version% == "" ( + if %cmake_version% EQU "" ( echo "Unable to get version of cmake." >&2 exit /b 2 ) @@ -19,11 +19,11 @@ if %ERRORLEVEL% EQU 0 ( goto :download_install ) -set cmake_ver_major="" -set cmake_ver_minor="" +set cmake_ver_major= +set cmake_ver_minor= for /F tokens=1,2 delims=. %%a in (%cmake_version%) do ( - set cmake_ver_major=%%a - set cmake_ver_minor=%%b + set "cmake_ver_major=%%a" + set "cmake_ver_minor=%%b" ) set cmake_ver_minmaj=%cmake_ver_major:~-4%.%cmake_ver_minor:~-4% if %cmake_ver_minmaj% LSS %cmake_minversion_majmin% ( @@ -37,13 +37,10 @@ exit /b 0 :download_install set /p choice="Press any key to download and install cmake (make sure to add it in path in install options)" - if not exist %temp%\cmake-3.14.7-win64-x64.msi ( @echo on powershell -command "& { iwr https://cmake.org/files/v3.14/cmake-3.14.7-win64-x64.msi -OutFile %temp%\cmake-3.14.7-win64-x64.msi }" @echo off ) - msiexec.exe /i %temp%\cmake-3.14.7-win64-x64.msi - exit /b 1 diff --git a/scripts/cmd/clean.cmd b/scripts/cmd/clean.cmd index 29c428ae..df298a26 100644 --- a/scripts/cmd/clean.cmd +++ b/scripts/cmd/clean.cmd @@ -4,9 +4,9 @@ rd /s/q AutonomyLib\deps\rpclib rd /s/q external\rpclib\build msbuild /p:Platform=x64 /p:Configuration=Debug AutonomySim.sln /t:Clean -if %ERRORLEVEL% == 1 goto :buildfailed +if %ERRORLEVEL% EQU 1 goto :buildfailed msbuild /p:Platform=x64 /p:Configuration=Release AutonomySim.sln /t:Clean -if %ERRORLEVEL% == 1 goto :buildfailed +if %ERRORLEVEL% EQU 1 goto :buildfailed goto :eof :buildfailed diff --git a/scripts/cmd/gitcommitall.cmd b/scripts/cmd/gitcommitall.cmd index aa562f73..8e84f380 100644 --- a/scripts/cmd/gitcommitall.cmd +++ b/scripts/cmd/gitcommitall.cmd @@ -9,7 +9,7 @@ REM root folder for repos set RepoRoot=%1 set CommitMessage=%2 -if %CommitMessage% == "" ( +if %CommitMessage% EQU "" ( echo "CommitMessage needs to be provided" goto :failed ) @@ -49,7 +49,6 @@ for %%x in ( git push cd .. ) - goto :done :failed @@ -60,4 +59,4 @@ exit /b 1 :done cd %ROOT_DIR% -if %1 == "" pause +if %1 EQU "" pause diff --git a/scripts/cmd/template.cmd b/scripts/cmd/template.cmd index bf83c089..26481185 100644 --- a/scripts/cmd/template.cmd +++ b/scripts/cmd/template.cmd @@ -7,11 +7,11 @@ set ROOT_DIR=%cd% REM pushd %~dp0 :success -@echo "Task completed." +echo "Task completed." goto :end :failed -@echo "Task has failed." +echo "Task has failed." goto :end :end