From 5ac2ba712c82ed80f4322e951554d2b660b62ff7 Mon Sep 17 00:00:00 2001 From: bernat Date: Fri, 17 Jul 2020 12:36:49 +0200 Subject: [PATCH] Adding make commands to retrieve the Plugins (#3017) Co-authored-by: Marc Garcia Puig --- .gitignore | 1 + CHANGELOG.md | 1 + Util/BuildTools/Linux.mk | 4 ++ Util/BuildTools/Plugins.bat | 77 +++++++++++++++++++++++++++++++++++++ Util/BuildTools/Plugins.sh | 42 ++++++++++++++++++++ Util/BuildTools/Windows.mk | 4 ++ 6 files changed, 129 insertions(+) create mode 100644 Util/BuildTools/Plugins.bat create mode 100755 Util/BuildTools/Plugins.sh diff --git a/.gitignore b/.gitignore index 127cf5576..942fbfc99 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ Deprecated/PythonClient/dist TrafficManager/build Util/Build Install +Plugins /ExportedMaps /Import/* diff --git a/CHANGELOG.md b/CHANGELOG.md index aed801eb4..d373c94de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ * All sensors are now multi-stream, that means that the same sensor can be listened from different clients * Fixed point cloud of LiDAR. Now the points are given correctly in the sensor's coordinate system. * Exposed matrix form of transformation to the client and Python API. + * Added make command to download contributions as plugins (`make plugins`) * Added PythonAPI command to set multiple car light states at once * Added PythonAPI `carla.world.get_vehicles_light_states` to get all the car light states at once * OpenDRIVE ingestion bugfixes diff --git a/Util/BuildTools/Linux.mk b/Util/BuildTools/Linux.mk index 8a0df8c71..48b6729d1 100644 --- a/Util/BuildTools/Linux.mk +++ b/Util/BuildTools/Linux.mk @@ -131,6 +131,10 @@ LibCarla.client.rss.debug: setup ad-rss LibCarla.client.rss.release: setup ad-rss @${CARLA_BUILD_TOOLS_FOLDER}/BuildLibCarla.sh --client --release --rss +.PHONY: Plugins +plugins: + @${CARLA_BUILD_TOOLS_FOLDER}/Plugins.sh $(ARGS) + setup: @${CARLA_BUILD_TOOLS_FOLDER}/Setup.sh diff --git a/Util/BuildTools/Plugins.bat b/Util/BuildTools/Plugins.bat new file mode 100644 index 000000000..6f929185a --- /dev/null +++ b/Util/BuildTools/Plugins.bat @@ -0,0 +1,77 @@ +@echo off +setlocal + +rem BAT script that downloads and installs all Plugins +rem Run it through a cmd with the x64 Visual C++ Toolset enabled. + +set LOCAL_PATH=%~dp0 +set "FILE_N= -[%~n0]:" + +rem Print batch params (debug purpose) +echo %FILE_N% [Batch params]: %* + +rem ============================================================================ +rem -- Parse arguments --------------------------------------------------------- +rem ============================================================================ + +set RELEASE=false + +:arg-parse +if not "%1"=="" ( + if "%1"=="--release" ( + set RELEASE=true + shift + ) + shift + goto :arg-parse +) + +rem ============================================================================ +rem -- Parse arguments --------------------------------------------------------- +rem ============================================================================ + +if not exist "%ROOT_PATH%Plugins" ( + if %RELEASE% == true ( + echo Cloning for release... + call git clone --depth=1 --recursive https://github.com/carla-simulator/carla-plugins.git "%ROOT_PATH%Plugins" + ) else ( + echo Cloning for build... + call git clone --recursive https://github.com/carla-simulator/carla-plugins.git "%ROOT_PATH%Plugins" + ) + if %errorlevel% neq 0 goto error_git +) else ( + goto already +) +goto success + +rem ============================================================================ +rem -- Messages and Errors ----------------------------------------------------- +rem ============================================================================ + +:success + echo. + echo %FILE_N% "Plugins" has been successfully installed in "%ROOT_PATH%Plugins!" + goto good_exit + +:already + echo. + echo %FILE_N% "Plugins" already exists in "%ROOT_PATH%Plugins!" + goto good_exit + +:error_git + echo. + echo %FILE_N% [GIT ERROR] An error ocurred while executing the git. + echo %FILE_N% [GIT ERROR] Possible causes: + echo %FILE_N% - Make sure "git" is installed. + echo %FILE_N% - Make sure it is available on your Windows "path". + goto bad_exit + +:good_exit + echo %FILE_N% Exiting... + endlocal + exit /b 0 + +:bad_exit + echo %FILE_N% Exiting with error... + endlocal + exit /b %errorlevel% diff --git a/Util/BuildTools/Plugins.sh b/Util/BuildTools/Plugins.sh new file mode 100755 index 000000000..54cba8c05 --- /dev/null +++ b/Util/BuildTools/Plugins.sh @@ -0,0 +1,42 @@ +# ============================================================================== +# -- Parse arguments ----------------------------------------------------------- +# ============================================================================== + +DOC_STRING="Retrieve the plugins for CARLA" + +USAGE_STRING="Usage: $0 [-h|--help] [--release]" + +RELEASE=false + +if [ $? != 0 ] ; then echo "$USAGE_STRING" ; exit 2 ; fi + +while true; do + case "$1" in + --release ) + RELEASE=true + shift ;; + -h | --help ) + echo "$DOC_STRING" + echo "$USAGE_STRING" + exit 1 + ;; + * ) + break ;; + esac +done + +# ============================================================================== +# -- Get Plugins --------------------------------------------------------------- +# ============================================================================== + +log "Retrieving Plugins" + +if [[ -d "${CARLA_ROOT_FOLDER}Plugins" ]] ; then + log "Plugins already installed." +else + if ${RELEASE} ; then + git clone --depth=1 --recursive https://github.com/carla-simulator/carla-plugins.git "${CARLA_ROOT_FOLDER}Plugins" + else + git clone --recursive https://github.com/carla-simulator/carla-plugins.git "${CARLA_ROOT_FOLDER}Plugins" + fi +fi diff --git a/Util/BuildTools/Windows.mk b/Util/BuildTools/Windows.mk index 2cc470140..08a523313 100644 --- a/Util/BuildTools/Windows.mk +++ b/Util/BuildTools/Windows.mk @@ -71,5 +71,9 @@ LibCarla: setup setup: @"${CARLA_BUILD_TOOLS_FOLDER}/Setup.bat" --boost-toolset msvc-14.1 +.PHONY: Plugins +plugins: + @"${CARLA_BUILD_TOOLS_FOLDER}/Plugins.bat" $(ARGS) + deploy: @"${CARLA_BUILD_TOOLS_FOLDER}/Deploy.bat" $(ARGS)