2018-01-24 19:36:18 +08:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
# -- Parse arguments -----------------------------------------------------------
|
|
|
|
# ==============================================================================
|
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
DOC_STRING="Makes a packaged version of CARLA and other content packages ready for distribution."
|
2018-07-04 17:59:59 +08:00
|
|
|
|
2023-11-09 05:29:28 +08:00
|
|
|
USAGE_STRING="Usage: $0 [-h|--help] [--config={Debug,Development,Shipping}] [--no-zip] [--clean-intermediate] [--packages=Name1,Name2,...] [--target-archive=] [--archive-sufix=]"
|
2018-07-04 17:59:59 +08:00
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
PACKAGES="Carla"
|
2018-01-24 19:36:18 +08:00
|
|
|
DO_TARBALL=true
|
2018-01-25 02:47:57 +08:00
|
|
|
DO_CLEAN_INTERMEDIATE=false
|
2019-07-09 18:30:17 +08:00
|
|
|
PROPS_MAP_NAME=PropsMap
|
2019-07-11 21:11:56 +08:00
|
|
|
PACKAGE_CONFIG=Shipping
|
2020-12-04 23:09:46 +08:00
|
|
|
USE_CARSIM=false
|
2020-12-18 04:35:49 +08:00
|
|
|
SINGLE_PACKAGE=false
|
2023-11-09 05:29:28 +08:00
|
|
|
ARCHIVE_SUFIX=""
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2023-11-09 05:29:28 +08:00
|
|
|
OPTS=`getopt -o h --long help,config:,no-zip,clean-intermediate,carsim,packages:,python-version,target-archive:,archive-sufix:, -n 'parse-options' -- "$@"`
|
2018-01-24 19:36:18 +08:00
|
|
|
|
|
|
|
eval set -- "$OPTS"
|
|
|
|
|
2020-08-25 21:12:46 +08:00
|
|
|
while [[ $# -gt 0 ]]; do
|
2018-01-24 19:36:18 +08:00
|
|
|
case "$1" in
|
2019-07-11 21:11:56 +08:00
|
|
|
--config )
|
|
|
|
PACKAGE_CONFIG="$2"
|
|
|
|
shift 2 ;;
|
2018-01-25 02:47:57 +08:00
|
|
|
--no-zip )
|
|
|
|
DO_TARBALL=false
|
|
|
|
shift ;;
|
|
|
|
--clean-intermediate )
|
|
|
|
DO_CLEAN_INTERMEDIATE=true
|
|
|
|
shift ;;
|
2019-06-19 18:18:12 +08:00
|
|
|
--packages )
|
|
|
|
PACKAGES="$2"
|
|
|
|
shift 2 ;;
|
2020-12-18 04:35:49 +08:00
|
|
|
--target-archive )
|
|
|
|
SINGLE_PACKAGE=true
|
|
|
|
TARGET_ARCHIVE="$2"
|
|
|
|
shift 2 ;;
|
2023-11-09 05:29:28 +08:00
|
|
|
--archive-sufix )
|
|
|
|
ARCHIVE_SUFIX="$2"
|
|
|
|
shift 2 ;;
|
2020-12-04 23:09:46 +08:00
|
|
|
--carsim )
|
|
|
|
USE_CARSIM=true;
|
|
|
|
shift ;;
|
2018-01-24 19:36:18 +08:00
|
|
|
-h | --help )
|
|
|
|
echo "$DOC_STRING"
|
|
|
|
echo "$USAGE_STRING"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
* )
|
2020-08-25 21:12:46 +08:00
|
|
|
shift ;;
|
2018-01-24 19:36:18 +08:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# ==============================================================================
|
2019-06-19 18:18:12 +08:00
|
|
|
# -- Prepare environment -------------------------------------------------------
|
2018-01-24 19:36:18 +08:00
|
|
|
# ==============================================================================
|
2020-12-17 17:53:03 +08:00
|
|
|
source $(dirname "$0")/Environment.sh
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
if [ ! -d "${UE4_ROOT}" ]; then
|
|
|
|
fatal_error "UE4_ROOT is not defined, or points to a non-existent directory, please set this environment variable."
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -n "${PACKAGES}" ] ; then
|
|
|
|
fatal_error "Nothing to be done."
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Convert comma-separated string to array of unique elements.
|
|
|
|
PACKAGES="$(echo "${PACKAGES}" | tr ',' '\n' | sort -u | tr '\n' ',')"
|
|
|
|
IFS=',' read -r -a PACKAGES <<< "${PACKAGES}"
|
|
|
|
|
|
|
|
# If contains an element called "Carla".
|
|
|
|
if [[ "${PACKAGES[@]}" =~ "Carla" ]] ; then
|
|
|
|
DO_CARLA_RELEASE=true
|
|
|
|
else
|
|
|
|
DO_CARLA_RELEASE=false
|
|
|
|
fi
|
|
|
|
|
2019-03-20 05:41:42 +08:00
|
|
|
REPOSITORY_TAG=$(get_git_repository_version)
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2023-11-09 05:29:28 +08:00
|
|
|
if [[ ${ARCHIVE_SUFIX} != "" ]] ; then
|
|
|
|
RELEASE_BUILD_FOLDER=${CARLA_DIST_FOLDER}/CARLA_${PACKAGE_CONFIG}_${REPOSITORY_TAG}_${ARCHIVE_SUFIX}
|
|
|
|
else
|
|
|
|
RELEASE_BUILD_FOLDER=${CARLA_DIST_FOLDER}/CARLA_${PACKAGE_CONFIG}_${REPOSITORY_TAG}
|
|
|
|
fi
|
2019-07-11 21:11:56 +08:00
|
|
|
|
|
|
|
if [[ ${PACKAGE_CONFIG} == "Shipping" ]] ; then
|
2023-11-09 05:29:28 +08:00
|
|
|
RELEASE_PACKAGE_PATH=${CARLA_DIST_FOLDER}/CARLA_${REPOSITORY_TAG}
|
2019-07-11 21:11:56 +08:00
|
|
|
else
|
2023-11-09 05:29:28 +08:00
|
|
|
RELEASE_PACKAGE_PATH=${CARLA_DIST_FOLDER}/CARLA_${PACKAGE_CONFIG}_${REPOSITORY_TAG}
|
2019-07-11 21:11:56 +08:00
|
|
|
fi
|
2019-06-19 18:18:12 +08:00
|
|
|
|
2023-11-09 05:29:28 +08:00
|
|
|
if [[ ${ARCHIVE_SUFIX} != "" ]] ; then
|
|
|
|
RELEASE_PACKAGE_PATH=${RELEASE_PACKAGE_PATH}_${ARCHIVE_SUFIX}
|
|
|
|
fi
|
|
|
|
|
|
|
|
RELEASE_PACKAGE_PATH=${RELEASE_PACKAGE_PATH}.tar.gz
|
|
|
|
|
2019-07-11 21:11:56 +08:00
|
|
|
log "Packaging version '${REPOSITORY_TAG}' (${PACKAGE_CONFIG})."
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
# ==============================================================================
|
|
|
|
# -- Cook CARLA project --------------------------------------------------------
|
|
|
|
# ==============================================================================
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
if ${DO_CARLA_RELEASE} ; then
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
pushd "${CARLAUE4_ROOT_FOLDER}" >/dev/null
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2020-12-11 19:17:17 +08:00
|
|
|
if ${USE_CARSIM} ; then
|
|
|
|
python ${PWD}/../../Util/BuildTools/enable_carsim_to_uproject.py -f="CarlaUE4.uproject" -e
|
2020-12-04 23:09:46 +08:00
|
|
|
echo "CarSim ON" > ${PWD}/Config/CarSimConfig.ini
|
|
|
|
else
|
2020-12-11 19:17:17 +08:00
|
|
|
python ${PWD}/../../Util/BuildTools/enable_carsim_to_uproject.py -f="CarlaUE4.uproject"
|
2020-12-04 23:09:46 +08:00
|
|
|
echo "CarSim OFF" > ${PWD}/Config/CarSimConfig.ini
|
|
|
|
fi
|
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
log "Cooking CARLA project."
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
rm -Rf ${RELEASE_BUILD_FOLDER}
|
|
|
|
mkdir -p ${RELEASE_BUILD_FOLDER}
|
2018-01-24 19:36:18 +08:00
|
|
|
|
|
|
|
${UE4_ROOT}/Engine/Build/BatchFiles/RunUAT.sh BuildCookRun \
|
|
|
|
-project="${PWD}/CarlaUE4.uproject" \
|
2019-08-26 06:35:22 +08:00
|
|
|
-nocompileeditor -nop4 -cook -stage -archive -package -iterate \
|
2019-07-11 21:11:56 +08:00
|
|
|
-clientconfig=${PACKAGE_CONFIG} -ue4exe=UE4Editor \
|
2019-05-24 23:24:12 +08:00
|
|
|
-prereqs -targetplatform=Linux -build -utf8output \
|
2019-06-19 18:18:12 +08:00
|
|
|
-archivedirectory="${RELEASE_BUILD_FOLDER}"
|
2018-01-24 19:36:18 +08:00
|
|
|
|
|
|
|
popd >/dev/null
|
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
if [[ ! -d ${RELEASE_BUILD_FOLDER}/LinuxNoEditor ]] ; then
|
|
|
|
fatal_error "Failed to cook the project!"
|
|
|
|
fi
|
2018-01-24 19:36:18 +08:00
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
# ==============================================================================
|
2018-07-04 17:59:59 +08:00
|
|
|
# -- Copy files (Python API, README, etc) --------------------------------------
|
2018-01-24 19:36:18 +08:00
|
|
|
# ==============================================================================
|
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
if ${DO_CARLA_RELEASE} ; then
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
DESTINATION=${RELEASE_BUILD_FOLDER}/LinuxNoEditor
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
log "Adding extra files to CARLA package."
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
pushd ${CARLA_ROOT_FOLDER} >/dev/null
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
mkdir -p "${DESTINATION}/Import"
|
2019-01-22 16:47:32 +08:00
|
|
|
|
2019-03-29 01:35:31 +08:00
|
|
|
echo "${REPOSITORY_TAG}" > ${DESTINATION}/VERSION
|
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
copy_if_changed "./LICENSE" "${DESTINATION}/LICENSE"
|
|
|
|
copy_if_changed "./CHANGELOG.md" "${DESTINATION}/CHANGELOG"
|
|
|
|
copy_if_changed "./Docs/release_readme.md" "${DESTINATION}/README"
|
2019-03-29 02:17:05 +08:00
|
|
|
copy_if_changed "./Docs/python_api.md" "${DESTINATION}/PythonAPI/python_api.md"
|
2018-07-04 17:59:59 +08:00
|
|
|
copy_if_changed "./Util/Docker/Release.Dockerfile" "${DESTINATION}/Dockerfile"
|
2019-06-11 23:07:45 +08:00
|
|
|
copy_if_changed "./Util/ImportAssets.sh" "${DESTINATION}/ImportAssets.sh"
|
2020-02-24 21:12:04 +08:00
|
|
|
copy_if_changed "./Util/DockerUtils/dist/RecastBuilder" "${DESTINATION}/Tools/"
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2019-03-29 01:35:31 +08:00
|
|
|
copy_if_changed "./PythonAPI/carla/dist/*.egg" "${DESTINATION}/PythonAPI/carla/dist/"
|
2021-07-15 17:18:34 +08:00
|
|
|
copy_if_changed "./PythonAPI/carla/dist/*.whl" "${DESTINATION}/PythonAPI/carla/dist/"
|
2019-03-29 01:35:31 +08:00
|
|
|
copy_if_changed "./PythonAPI/carla/agents/" "${DESTINATION}/PythonAPI/carla/agents"
|
|
|
|
copy_if_changed "./PythonAPI/carla/scene_layout.py" "${DESTINATION}/PythonAPI/carla/"
|
|
|
|
copy_if_changed "./PythonAPI/carla/requirements.txt" "${DESTINATION}/PythonAPI/carla/"
|
|
|
|
|
|
|
|
copy_if_changed "./PythonAPI/examples/*.py" "${DESTINATION}/PythonAPI/examples/"
|
2020-07-03 21:54:04 +08:00
|
|
|
copy_if_changed "./PythonAPI/examples/rss/*.py" "${DESTINATION}/PythonAPI/examples/rss/"
|
2019-03-29 01:35:31 +08:00
|
|
|
copy_if_changed "./PythonAPI/examples/requirements.txt" "${DESTINATION}/PythonAPI/examples/"
|
|
|
|
|
|
|
|
copy_if_changed "./PythonAPI/util/*.py" "${DESTINATION}/PythonAPI/util/"
|
2020-04-15 22:59:26 +08:00
|
|
|
copy_if_changed "./PythonAPI/util/opendrive/" "${DESTINATION}/PythonAPI/util/opendrive/"
|
2019-03-29 01:35:31 +08:00
|
|
|
copy_if_changed "./PythonAPI/util/requirements.txt" "${DESTINATION}/PythonAPI/util/"
|
2019-03-27 23:39:09 +08:00
|
|
|
|
2020-03-31 22:33:19 +08:00
|
|
|
copy_if_changed "./Co-Simulation/" "${DESTINATION}/Co-Simulation/"
|
|
|
|
|
2021-01-09 00:54:14 +08:00
|
|
|
if [ -d "./Plugins/" ] ; then
|
|
|
|
copy_if_changed "./Plugins/" "${DESTINATION}/Plugins/"
|
|
|
|
fi
|
2020-12-22 18:08:27 +08:00
|
|
|
|
2023-11-06 19:34:07 +08:00
|
|
|
if [ -d "./Unreal/CarlaUE4/Plugins/Carla/CarlaDependencies/lib" ] ; then
|
|
|
|
cp -r "./Unreal/CarlaUE4/Plugins/Carla/CarlaDependencies/lib" "${DESTINATION}/CarlaUE4/Plugins/Carla/CarlaDependencies"
|
|
|
|
fi
|
|
|
|
|
2019-03-29 04:45:08 +08:00
|
|
|
copy_if_changed "./Unreal/CarlaUE4/Content/Carla/HDMaps/*.pcd" "${DESTINATION}/HDMaps/"
|
|
|
|
copy_if_changed "./Unreal/CarlaUE4/Content/Carla/HDMaps/Readme.md" "${DESTINATION}/HDMaps/README"
|
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
popd >/dev/null
|
2018-01-24 19:36:18 +08:00
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
# -- Zip the project -----------------------------------------------------------
|
|
|
|
# ==============================================================================
|
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
if ${DO_CARLA_RELEASE} && ${DO_TARBALL} ; then
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2019-07-11 21:11:56 +08:00
|
|
|
DESTINATION=${RELEASE_PACKAGE_PATH}
|
2019-06-19 18:18:12 +08:00
|
|
|
SOURCE=${RELEASE_BUILD_FOLDER}/LinuxNoEditor
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
pushd "${SOURCE}" >/dev/null
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
log "Packaging CARLA release."
|
2018-01-24 19:36:18 +08:00
|
|
|
|
|
|
|
rm -f ./Manifest_NonUFSFiles_Linux.txt
|
2019-04-01 18:19:47 +08:00
|
|
|
rm -f ./Manifest_UFSFiles_Linux.txt
|
2018-01-24 19:36:18 +08:00
|
|
|
rm -Rf ./CarlaUE4/Saved
|
|
|
|
rm -Rf ./Engine/Saved
|
|
|
|
|
2020-12-18 04:35:49 +08:00
|
|
|
tar -czf ${DESTINATION} *
|
2018-01-24 19:36:18 +08:00
|
|
|
|
|
|
|
popd >/dev/null
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
2018-01-25 02:47:57 +08:00
|
|
|
# ==============================================================================
|
|
|
|
# -- Remove intermediate files -------------------------------------------------
|
|
|
|
# ==============================================================================
|
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
if ${DO_CARLA_RELEASE} && ${DO_CLEAN_INTERMEDIATE} ; then
|
2018-01-25 02:47:57 +08:00
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
log "Removing intermediate build."
|
2018-01-25 02:47:57 +08:00
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
rm -Rf ${RELEASE_BUILD_FOLDER}
|
2018-01-25 02:47:57 +08:00
|
|
|
|
|
|
|
fi
|
|
|
|
|
2018-01-24 19:36:18 +08:00
|
|
|
# ==============================================================================
|
2019-06-19 18:18:12 +08:00
|
|
|
# -- Cook other packages -------------------------------------------------------
|
2018-01-24 19:36:18 +08:00
|
|
|
# ==============================================================================
|
|
|
|
|
2019-07-10 06:09:50 +08:00
|
|
|
PACKAGE_PATH_FILE=${CARLAUE4_ROOT_FOLDER}/Content/PackagePath.txt
|
2021-07-30 09:07:41 +08:00
|
|
|
MAP_LIST_FILE=${CARLAUE4_ROOT_FOLDER}/Content/MapPathsLinux.txt
|
2019-07-10 06:09:50 +08:00
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
for PACKAGE_NAME in "${PACKAGES[@]}" ; do if [[ ${PACKAGE_NAME} != "Carla" ]] ; then
|
|
|
|
|
2019-07-01 17:47:32 +08:00
|
|
|
log "Preparing environment for cooking '${PACKAGE_NAME}'."
|
2019-06-19 18:18:12 +08:00
|
|
|
|
2020-12-18 04:35:49 +08:00
|
|
|
if ${SINGLE_PACKAGE} ; then
|
|
|
|
BUILD_FOLDER_TARGET=${CARLA_DIST_FOLDER}/${TARGET_ARCHIVE}_${REPOSITORY_TAG}
|
|
|
|
else
|
|
|
|
BUILD_FOLDER_TARGET=${CARLA_DIST_FOLDER}/${PACKAGE_NAME}_${REPOSITORY_TAG}
|
|
|
|
fi
|
|
|
|
|
2023-11-09 05:29:28 +08:00
|
|
|
if [[ ${ARCHIVE_SUFIX} != "" ]] ; then
|
|
|
|
BUILD_FOLDER_TARGET=${BUILD_FOLDER_TARGET}_${ARCHIVE_SUFIX}
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ${ARCHIVE_SUFIX} != "" ]] ; then
|
|
|
|
BUILD_FOLDER=${CARLA_DIST_FOLDER}/${PACKAGE_NAME}_${REPOSITORY_TAG}_${ARCHIVE_SUFIX}
|
|
|
|
else
|
|
|
|
BUILD_FOLDER=${CARLA_DIST_FOLDER}/${PACKAGE_NAME}_${REPOSITORY_TAG}
|
|
|
|
fi
|
|
|
|
|
2020-12-18 04:35:49 +08:00
|
|
|
DESTINATION=${BUILD_FOLDER_TARGET}.tar
|
2019-07-10 06:09:50 +08:00
|
|
|
PACKAGE_PATH=${CARLAUE4_ROOT_FOLDER}/Content/${PACKAGE_NAME}
|
2019-06-19 18:18:12 +08:00
|
|
|
|
|
|
|
mkdir -p ${BUILD_FOLDER}
|
|
|
|
|
2019-07-01 17:47:32 +08:00
|
|
|
log "Cooking package '${PACKAGE_NAME}'..."
|
2019-06-19 18:18:12 +08:00
|
|
|
|
2019-07-01 17:47:32 +08:00
|
|
|
pushd "${CARLAUE4_ROOT_FOLDER}" > /dev/null
|
2019-06-19 18:18:12 +08:00
|
|
|
|
2019-07-09 18:30:17 +08:00
|
|
|
# Prepare cooking of package
|
|
|
|
${UE4_ROOT}/Engine/Binaries/Linux/UE4Editor "${CARLAUE4_ROOT_FOLDER}/CarlaUE4.uproject" \
|
2019-07-10 03:19:17 +08:00
|
|
|
-run=PrepareAssetsForCooking -PackageName=${PACKAGE_NAME} -OnlyPrepareMaps=false
|
2019-07-09 18:30:17 +08:00
|
|
|
|
2019-07-10 01:48:01 +08:00
|
|
|
PACKAGE_FILE=$(<${PACKAGE_PATH_FILE})
|
2019-07-09 18:30:17 +08:00
|
|
|
MAPS_TO_COOK=$(<${MAP_LIST_FILE})
|
|
|
|
|
2022-04-06 18:37:44 +08:00
|
|
|
|
|
|
|
# Cook maps in batches
|
|
|
|
MAX_STRINGLENGTH=1000
|
|
|
|
IFS="+" read -ra MAP_LIST <<< $MAPS_TO_COOK
|
|
|
|
TOTAL=0
|
|
|
|
MAP_STRING=""
|
|
|
|
for MAP in "${MAP_LIST[@]}"; do
|
|
|
|
if (($(($TOTAL+${#MAP})) > $MAX_STRINGLENGTH)); then
|
|
|
|
echo "Cooking $MAP_STRING"
|
|
|
|
${UE4_ROOT}/Engine/Binaries/Linux/UE4Editor "${CARLAUE4_ROOT_FOLDER}/CarlaUE4.uproject" \
|
|
|
|
-run=cook -map="${MAP_STRING}" -cooksinglepackage -targetplatform="LinuxNoEditor" \
|
|
|
|
-OutputDir="${BUILD_FOLDER}" -iterate
|
|
|
|
MAP_STRING=""
|
|
|
|
TOTAL=0
|
|
|
|
fi
|
|
|
|
MAP_STRING=$MAP_STRING+$MAP
|
|
|
|
TOTAL=$(($TOTAL+${#MAP}))
|
|
|
|
done
|
|
|
|
if (($TOTAL > 0)); then
|
|
|
|
${UE4_ROOT}/Engine/Binaries/Linux/UE4Editor "${CARLAUE4_ROOT_FOLDER}/CarlaUE4.uproject" \
|
|
|
|
-run=cook -map="${MAP_STRING}" -cooksinglepackage -targetplatform="LinuxNoEditor" \
|
|
|
|
-OutputDir="${BUILD_FOLDER}" -iterate
|
|
|
|
fi
|
2019-06-19 18:18:12 +08:00
|
|
|
|
2019-07-09 18:30:17 +08:00
|
|
|
PROP_MAP_FOLDER="${PACKAGE_PATH}/Maps/${PROPS_MAP_NAME}"
|
|
|
|
|
|
|
|
if [ -d ${PROP_MAP_FOLDER} ] ; then
|
|
|
|
rm -Rf ${PROP_MAP_FOLDER}
|
|
|
|
fi
|
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
popd >/dev/null
|
|
|
|
|
2022-11-03 20:10:43 +08:00
|
|
|
pushd "${BUILD_FOLDER}" > /dev/null
|
2019-06-19 18:18:12 +08:00
|
|
|
|
2022-11-03 20:10:43 +08:00
|
|
|
SUBST_PATH="${BUILD_FOLDER}/CarlaUE4"
|
|
|
|
SUBST_FILE="${PACKAGE_FILE/${CARLAUE4_ROOT_FOLDER}/${SUBST_PATH}}"
|
2019-07-10 06:09:50 +08:00
|
|
|
|
2022-11-03 20:10:43 +08:00
|
|
|
# Copy the package config file to package
|
|
|
|
mkdir -p "$(dirname ${SUBST_FILE})" && cp "${PACKAGE_FILE}" "$_"
|
2019-07-05 15:14:35 +08:00
|
|
|
|
2022-11-03 20:10:43 +08:00
|
|
|
# Copy the OpenDRIVE .xodr files to package
|
|
|
|
IFS='+' # set delimiter
|
|
|
|
# MAPS_TO_COOK is read into an array as tokens separated by IFS
|
|
|
|
read -ra ADDR <<< "$MAPS_TO_COOK"
|
|
|
|
for i in "${ADDR[@]}"; do # access each element of array
|
2023-10-31 18:24:22 +08:00
|
|
|
|
2022-11-03 20:10:43 +08:00
|
|
|
XODR_FILE_PATH="${CARLAUE4_ROOT_FOLDER}/Content${i:5}"
|
|
|
|
MAP_NAME=${XODR_FILE_PATH##*/}
|
|
|
|
XODR_FILE=$(find "${CARLAUE4_ROOT_FOLDER}/Content" -name "${MAP_NAME}.xodr" -print -quit)
|
2019-07-05 15:14:35 +08:00
|
|
|
|
2022-11-03 20:10:43 +08:00
|
|
|
if [ -f "${XODR_FILE}" ] ; then
|
2019-07-10 06:09:50 +08:00
|
|
|
|
2022-11-03 20:10:43 +08:00
|
|
|
SUBST_FILE="${XODR_FILE/${CARLAUE4_ROOT_FOLDER}/${SUBST_PATH}}"
|
2019-07-05 15:14:35 +08:00
|
|
|
|
2022-11-03 20:10:43 +08:00
|
|
|
# Copy the package config file to package
|
|
|
|
mkdir -p "$(dirname ${SUBST_FILE})" && cp "${XODR_FILE}" "$_"
|
2019-07-05 15:14:35 +08:00
|
|
|
|
2022-11-03 20:10:43 +08:00
|
|
|
fi
|
2019-07-05 15:14:35 +08:00
|
|
|
|
2022-11-03 20:10:43 +08:00
|
|
|
# binary files for navigation and traffic manager
|
|
|
|
BIN_FILE_PATH="${CARLAUE4_ROOT_FOLDER}/Content${i:5}"
|
|
|
|
MAP_NAME=${BIN_FILE_PATH##*/}
|
|
|
|
find "${CARLAUE4_ROOT_FOLDER}/Content" -name "${MAP_NAME}.bin" -print0 | while read -d $'\0' BIN_FILE
|
|
|
|
do
|
|
|
|
if [ -f "${BIN_FILE}" ] ; then
|
2019-12-11 16:48:27 +08:00
|
|
|
|
2022-11-03 20:10:43 +08:00
|
|
|
SUBST_FILE="${BIN_FILE/${CARLAUE4_ROOT_FOLDER}/${SUBST_PATH}}"
|
2019-12-11 16:48:27 +08:00
|
|
|
|
2022-11-03 20:10:43 +08:00
|
|
|
# Copy the package config file to package
|
|
|
|
mkdir -p "$(dirname ${SUBST_FILE})" && cp "${BIN_FILE}" "$_"
|
|
|
|
fi
|
2019-07-05 15:14:35 +08:00
|
|
|
done
|
2022-11-03 20:10:43 +08:00
|
|
|
done
|
2019-07-05 15:14:35 +08:00
|
|
|
|
2023-10-31 18:24:22 +08:00
|
|
|
rm -Rf "./CarlaUE4/Metadata"
|
|
|
|
rm -Rf "./CarlaUE4/Plugins"
|
|
|
|
rm -Rf "./CarlaUE4/Content/${PACKAGE_NAME}/Maps/${PROPS_MAP_NAME}"
|
|
|
|
rm -f "./CarlaUE4/AssetRegistry.bin"
|
2019-06-19 18:18:12 +08:00
|
|
|
|
2022-11-03 20:10:43 +08:00
|
|
|
if ${DO_TARBALL} ; then
|
2023-10-31 18:24:22 +08:00
|
|
|
|
2020-12-18 04:35:49 +08:00
|
|
|
if ${SINGLE_PACKAGE} ; then
|
|
|
|
tar -rf ${DESTINATION} *
|
|
|
|
else
|
|
|
|
tar -czf ${DESTINATION}.gz *
|
|
|
|
fi
|
2019-06-19 18:18:12 +08:00
|
|
|
|
|
|
|
popd >/dev/null
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ${DO_CLEAN_INTERMEDIATE} ; then
|
2019-07-01 17:47:32 +08:00
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
log "Removing intermediate build."
|
2019-07-01 17:47:32 +08:00
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
rm -Rf ${BUILD_FOLDER}
|
2019-07-01 17:47:32 +08:00
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
fi ; done
|
|
|
|
|
2020-12-18 04:35:49 +08:00
|
|
|
# compress the TAR if it is a single package
|
|
|
|
if ${SINGLE_PACKAGE} ; then
|
|
|
|
gzip -f ${DESTINATION}
|
|
|
|
fi
|
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
# ==============================================================================
|
|
|
|
# -- Log paths of generated packages -------------------------------------------
|
|
|
|
# ==============================================================================
|
|
|
|
|
2020-12-18 04:35:49 +08:00
|
|
|
# for PACKAGE_NAME in "${PACKAGES[@]}" ; do if [[ ${PACKAGE_NAME} != "Carla" ]] ; then
|
|
|
|
# FINAL_PACKAGE=${CARLA_DIST_FOLDER}/${PACKAGE_NAME}_${REPOSITORY_TAG}.tar.gz
|
|
|
|
# log "Package '${PACKAGE_NAME}' created at ${FINAL_PACKAGE}"
|
|
|
|
# fi ; done
|
2019-06-19 18:18:12 +08:00
|
|
|
|
|
|
|
if ${DO_CARLA_RELEASE} ; then
|
|
|
|
if ${DO_TARBALL} ; then
|
2019-07-11 21:11:56 +08:00
|
|
|
log "CARLA release created at ${RELEASE_PACKAGE_PATH}"
|
2019-06-19 18:18:12 +08:00
|
|
|
else
|
2019-07-11 21:11:56 +08:00
|
|
|
log "CARLA release created at ${RELEASE_BUILD_FOLDER}"
|
2019-06-19 18:18:12 +08:00
|
|
|
fi
|
2018-03-16 18:47:42 +08:00
|
|
|
fi
|
|
|
|
|
2019-06-19 18:18:12 +08:00
|
|
|
# ==============================================================================
|
|
|
|
# -- ...and we are done --------------------------------------------------------
|
|
|
|
# ==============================================================================
|
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
log "Success!"
|