2018-01-24 19:36:18 +08:00
|
|
|
#! /bin/bash
|
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
source $(dirname "$0")/Environment.sh
|
2018-01-24 19:36:18 +08:00
|
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
# -- Parse arguments -----------------------------------------------------------
|
|
|
|
# ==============================================================================
|
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
DOC_STRING="Makes a packaged version of CARLA for distribution."
|
|
|
|
|
|
|
|
USAGE_STRING="Usage: $0 [-h|--help] [--no-packaging] [--no-zip] [--clean-intermediate]"
|
|
|
|
|
2018-01-24 19:36:18 +08:00
|
|
|
DO_PACKAGE=true
|
|
|
|
DO_COPY_FILES=true
|
|
|
|
DO_TARBALL=true
|
2018-01-25 02:47:57 +08:00
|
|
|
DO_CLEAN_INTERMEDIATE=false
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2018-01-25 02:47:57 +08:00
|
|
|
OPTS=`getopt -o h --long help,no-packaging,no-zip,clean-intermediate -n 'parse-options' -- "$@"`
|
2018-01-24 19:36:18 +08:00
|
|
|
|
|
|
|
if [ $? != 0 ] ; then echo "$USAGE_STRING" ; exit 2 ; fi
|
|
|
|
|
|
|
|
eval set -- "$OPTS"
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
case "$1" in
|
2018-01-25 02:47:57 +08:00
|
|
|
--no-packaging )
|
2018-01-24 19:36:18 +08:00
|
|
|
DO_PACKAGE=false
|
|
|
|
shift ;;
|
2018-01-25 02:47:57 +08:00
|
|
|
--no-zip )
|
|
|
|
DO_TARBALL=false
|
|
|
|
shift ;;
|
|
|
|
--clean-intermediate )
|
|
|
|
DO_CLEAN_INTERMEDIATE=true
|
|
|
|
shift ;;
|
2018-01-24 19:36:18 +08:00
|
|
|
-h | --help )
|
|
|
|
echo "$DOC_STRING"
|
|
|
|
echo "$USAGE_STRING"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
break ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# ==============================================================================
|
2018-07-04 17:59:59 +08:00
|
|
|
# -- Package project -----------------------------------------------------------
|
2018-01-24 19:36:18 +08:00
|
|
|
# ==============================================================================
|
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
REPOSITORY_TAG=$(get_carla_version)
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
BUILD_FOLDER=${CARLA_DIST_FOLDER}/${REPOSITORY_TAG}
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
log "Packaging version '$REPOSITORY_TAG'."
|
2018-01-24 19:36:18 +08:00
|
|
|
|
|
|
|
if $DO_PACKAGE ; then
|
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
pushd "${CARLAUE4_ROOT_FOLDER}" >/dev/null
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
log "Packaging the project."
|
2018-01-24 19:36:18 +08:00
|
|
|
|
|
|
|
if [ ! -d "${UE4_ROOT}" ]; then
|
|
|
|
fatal_error "UE4_ROOT is not defined, or points to a non-existant directory, please set this environment variable."
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -Rf ${BUILD_FOLDER}
|
2018-01-25 06:39:26 +08:00
|
|
|
mkdir -p ${BUILD_FOLDER}
|
2018-01-24 19:36:18 +08:00
|
|
|
|
|
|
|
${UE4_ROOT}/Engine/Build/BatchFiles/RunUAT.sh BuildCookRun \
|
|
|
|
-project="${PWD}/CarlaUE4.uproject" \
|
2018-01-25 02:35:16 +08:00
|
|
|
-nocompileeditor -nop4 -cook -stage -archive -package \
|
|
|
|
-clientconfig=Development -ue4exe=UE4Editor \
|
|
|
|
-pak -prereqs -nodebuginfo \
|
|
|
|
-targetplatform=Linux -build -CrashReporter -utf8output \
|
2018-01-24 19:36:18 +08:00
|
|
|
-archivedirectory="${BUILD_FOLDER}"
|
|
|
|
|
|
|
|
popd >/dev/null
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ! -d ${BUILD_FOLDER}/LinuxNoEditor ]] ; then
|
|
|
|
fatal_error "Failed to package the project!"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# ==============================================================================
|
2018-07-04 17:59:59 +08:00
|
|
|
# -- Copy files (Python API, README, etc) --------------------------------------
|
2018-01-24 19:36:18 +08:00
|
|
|
# ==============================================================================
|
|
|
|
|
|
|
|
if $DO_COPY_FILES ; then
|
|
|
|
|
|
|
|
DESTINATION=${BUILD_FOLDER}/LinuxNoEditor
|
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
log "Adding extra files to 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
|
|
|
|
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"
|
2018-10-10 00:04:50 +08:00
|
|
|
copy_if_changed "./Docs/python_api.md" "${DESTINATION}/python_api.md"
|
2018-07-29 01:47:18 +08:00
|
|
|
# copy_if_changed "./Docs/Example.CarlaSettings.ini" "${DESTINATION}/Example.CarlaSettings.ini"
|
2018-07-04 17:59:59 +08:00
|
|
|
copy_if_changed "./Util/Docker/Release.Dockerfile" "${DESTINATION}/Dockerfile"
|
2018-07-29 01:47:18 +08:00
|
|
|
copy_if_changed "./PythonAPI/dist/*.egg" "${DESTINATION}/PythonAPI/"
|
2018-10-10 00:04:50 +08:00
|
|
|
copy_if_changed "./PythonAPI/tutorial.py" "${DESTINATION}/tutorial.py"
|
2018-07-30 05:52:13 +08:00
|
|
|
copy_if_changed "./PythonAPI/manual_control.py" "${DESTINATION}/manual_control.py"
|
2018-10-23 01:29:21 +08:00
|
|
|
copy_if_changed "./PythonAPI/dynamic_weather.py" "${DESTINATION}/dynamic_weather.py"
|
2018-07-30 05:52:13 +08:00
|
|
|
copy_if_changed "./PythonAPI/vehicle_gallery.py" "${DESTINATION}/vehicle_gallery.py"
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
popd >/dev/null
|
2018-01-24 19:36:18 +08:00
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
# -- Zip the project -----------------------------------------------------------
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
|
|
if $DO_TARBALL ; then
|
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
DESTINATION=${CARLA_DIST_FOLDER}/CARLA_${REPOSITORY_TAG}.tar.gz
|
2018-01-24 19:36:18 +08:00
|
|
|
SOURCE=${BUILD_FOLDER}/LinuxNoEditor
|
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
pushd "${SOURCE}" >/dev/null
|
2018-01-24 19:36:18 +08:00
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
log "Packaging build."
|
2018-01-24 19:36:18 +08:00
|
|
|
|
|
|
|
rm -f ./Manifest_NonUFSFiles_Linux.txt
|
|
|
|
rm -Rf ./CarlaUE4/Saved
|
|
|
|
rm -Rf ./Engine/Saved
|
|
|
|
|
|
|
|
tar -czvf ${DESTINATION} *
|
|
|
|
|
|
|
|
popd >/dev/null
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
2018-01-25 02:47:57 +08:00
|
|
|
# ==============================================================================
|
|
|
|
# -- Remove intermediate files -------------------------------------------------
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
|
|
if $DO_CLEAN_INTERMEDIATE ; then
|
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
log "Removing intermediate build."
|
2018-01-25 02:47:57 +08:00
|
|
|
|
|
|
|
rm -Rf ${BUILD_FOLDER}
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
2018-01-24 19:36:18 +08:00
|
|
|
# ==============================================================================
|
|
|
|
# -- ...and we are done --------------------------------------------------------
|
|
|
|
# ==============================================================================
|
|
|
|
|
2018-03-16 18:47:42 +08:00
|
|
|
if $DO_TARBALL ; then
|
2018-07-04 17:59:59 +08:00
|
|
|
FINAL_PACKAGE=${CARLA_DIST_FOLDER}/CARLA_${REPOSITORY_TAG}.tar.gz
|
2018-03-16 18:47:42 +08:00
|
|
|
else
|
2018-07-04 17:59:59 +08:00
|
|
|
FINAL_PACKAGE=${BUILD_FOLDER}
|
2018-03-16 18:47:42 +08:00
|
|
|
fi
|
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
log "Packaged version created at ${FINAL_PACKAGE}"
|
|
|
|
log "Success!"
|