New option to package to a single archive all

This commit is contained in:
bernat 2020-12-17 21:35:49 +01:00
parent c0f595ae4f
commit 0d24c199fa
4 changed files with 50 additions and 20 deletions

5
Jenkinsfile vendored
View File

@ -92,7 +92,7 @@ pipeline
steps
{
sh 'make package ARGS="--python-version=3.7,2 --carsim"'
sh 'make package ARGS="--packages=AdditionalMaps,Town06_Opt,Town07_Opt,Town10HD_Opt --clean-intermediate --python-version=3.7,2"'
sh 'make package ARGS="--packages=AdditionalMaps,Town06_Opt,Town07_Opt,Town10HD_Opt --target-archive=AdditionalMaps --clean-intermediate --python-version=3.7,2"'
sh 'make examples ARGS="localhost 3654"'
}
post
@ -287,7 +287,8 @@ pipeline
"""
bat """
call ../setEnv64.bat
make package ARGS="--packages=AdditionalMaps,Town06_Opt,Town07_Opt,Town10HD_Opt --clean-intermediate"
make package ARGS="--packages=AdditionalMaps --target-archive=AdditionalMaps --clean-intermediate"
make package ARGS="--packages=AdditionalMaps,Town06_Opt,Town07_Opt,Town10HD_Opt --target-archive=AdditionalMaps --clean-intermediate"
"""
}
post {

View File

@ -12,7 +12,7 @@ REMOVE_INTERMEDIATE=false
BUILD_RSS_VARIANT=false
BUILD_PYTHONAPI=true
OPTS=`getopt -o h --long help,config:,rebuild,clean,rss,carsim,python-version:,packages:,clean-intermediate,all,xml, -n 'parse-options' -- "$@"`
OPTS=`getopt -o h --long help,config:,rebuild,clean,rss,carsim,python-version:,packages:,clean-intermediate,all,xml,target-archive:, -n 'parse-options' -- "$@"`
eval set -- "$OPTS"

View File

@ -20,7 +20,7 @@ rem -- Parse arguments ---------------------------------------------------------
rem ==============================================================================
set DOC_STRING="Makes a packaged version of CARLA for distribution."
set USAGE_STRING="Usage: %FILE_N% [-h|--help] [--no-packaging] [--no-zip] [--clean]"
set USAGE_STRING="Usage: %FILE_N% [-h|--help] [--no-packaging] [--no-zip] [--clean] [--target-archive]"
set DO_PACKAGE=true
set DO_COPY_FILES=true
@ -28,7 +28,7 @@ set DO_TARBALL=true
set DO_CLEAN=false
set PACKAGES=Carla
set USE_CARSIM=false
set SINGLE_PACKAGE=false
:arg-parse
if not "%1"=="" (
@ -55,6 +55,12 @@ if not "%1"=="" (
shift
)
if "%1"=="--target-archive" (
set SINGLE_PACKAGE=true
set TARGET_ARCHIVE=%2
shift
)
if "%1"=="--carsim" (
set USE_CARSIM=true
)
@ -185,7 +191,7 @@ rem ============================================================================
rem -- Zip the project -----------------------------------------------------------
rem ==============================================================================
if %DO_TARBALL%==true (
if %DO_PACKAGE%==true if %DO_TARBALL%==true (
set SRC_PATH=%SOURCE:/=\%
echo %FILE_N% Building package...
@ -340,9 +346,14 @@ for /f "tokens=* delims=" %%i in ("!PACKAGES!") do (
if %DO_TARBALL%==true (
echo Packaging '!PACKAGE_NAME!'...
if %SINGLE_PACKAGE%==true (
echo Packaging '%TARGET_ARCHIVE%'...
set DESTINATION_ZIP=%INSTALLATION_DIR%UE4Carla/%TARGET_ARCHIVE%_%CARLA_VERSION%.zip
) else (
echo Packaging '!PACKAGE_NAME!'...
set DESTINATION_ZIP=%INSTALLATION_DIR%UE4Carla/!PACKAGE_NAME!_%CARLA_VERSION%.zip
)
set DESTINATION_ZIP=%INSTALLATION_DIR%UE4Carla/!PACKAGE_NAME!_%CARLA_VERSION%.zip
set SOURCE=!BUILD_FOLDER:/=\!\
set DST_ZIP=!DESTINATION_ZIP:/=\!
@ -352,7 +363,7 @@ for /f "tokens=* delims=" %%i in ("!PACKAGES!") do (
"%ProgramW6432%/7-Zip/7z.exe" a "!DST_ZIP!" . -tzip -mmt -mx5
) else (
rem https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.archive/compress-archive?view=powershell-6
powershell -command "& { Compress-Archive -Path * -CompressionLevel Fastest -DestinationPath '!DST_ZIP!' }"
powershell -command "& { Compress-Archive -Update -Path * -CompressionLevel Fastest -DestinationPath '!DST_ZIP!' }"
)
popd

View File

@ -6,7 +6,7 @@
DOC_STRING="Makes a packaged version of CARLA and other content packages ready for distribution."
USAGE_STRING="Usage: $0 [-h|--help] [--config={Debug,Development,Shipping}] [--no-zip] [--clean-intermediate] [--packages=Name1,Name2,...]"
USAGE_STRING="Usage: $0 [-h|--help] [--config={Debug,Development,Shipping}] [--no-zip] [--clean-intermediate] [--packages=Name1,Name2,...] [--target-archive=]"
PACKAGES="Carla"
DO_TARBALL=true
@ -14,8 +14,9 @@ DO_CLEAN_INTERMEDIATE=false
PROPS_MAP_NAME=PropsMap
PACKAGE_CONFIG=Shipping
USE_CARSIM=false
SINGLE_PACKAGE=false
OPTS=`getopt -o h --long help,config:,no-zip,clean-intermediate,carsim,packages:,python-version: -n 'parse-options' -- "$@"`
OPTS=`getopt -o h --long help,config:,no-zip,clean-intermediate,carsim,packages:,python-version,target-archive:, -n 'parse-options' -- "$@"`
eval set -- "$OPTS"
@ -33,6 +34,10 @@ while [[ $# -gt 0 ]]; do
--packages )
PACKAGES="$2"
shift 2 ;;
--target-archive )
SINGLE_PACKAGE=true
TARGET_ARCHIVE="$2"
shift 2 ;;
--carsim )
USE_CARSIM=true;
shift ;;
@ -183,7 +188,7 @@ if ${DO_CARLA_RELEASE} && ${DO_TARBALL} ; then
rm -Rf ./CarlaUE4/Saved
rm -Rf ./Engine/Saved
tar -czvf ${DESTINATION} *
tar -czf ${DESTINATION} *
popd >/dev/null
@ -212,8 +217,14 @@ for PACKAGE_NAME in "${PACKAGES[@]}" ; do if [[ ${PACKAGE_NAME} != "Carla" ]] ;
log "Preparing environment for cooking '${PACKAGE_NAME}'."
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
BUILD_FOLDER=${CARLA_DIST_FOLDER}/${PACKAGE_NAME}_${REPOSITORY_TAG}
DESTINATION=${BUILD_FOLDER}.tar.gz
DESTINATION=${BUILD_FOLDER_TARGET}.tar
PACKAGE_PATH=${CARLAUE4_ROOT_FOLDER}/Content/${PACKAGE_NAME}
mkdir -p ${BUILD_FOLDER}
@ -246,8 +257,6 @@ for PACKAGE_NAME in "${PACKAGES[@]}" ; do if [[ ${PACKAGE_NAME} != "Carla" ]] ;
pushd "${BUILD_FOLDER}" > /dev/null
log "\nPackaging '${PACKAGE_NAME}'..."
SUBST_PATH="${BUILD_FOLDER}/CarlaUE4"
SUBST_FILE="${PACKAGE_FILE/${CARLAUE4_ROOT_FOLDER}/${SUBST_PATH}}"
@ -294,7 +303,11 @@ for PACKAGE_NAME in "${PACKAGES[@]}" ; do if [[ ${PACKAGE_NAME} != "Carla" ]] ;
rm -Rf "./CarlaUE4/Content/${PACKAGE_NAME}/Maps/${PROPS_MAP_NAME}"
rm -f "./CarlaUE4/AssetRegistry.bin"
tar -czvf ${DESTINATION} *
if ${SINGLE_PACKAGE} ; then
tar -rf ${DESTINATION} *
else
tar -czf ${DESTINATION}.gz *
fi
popd >/dev/null
@ -310,14 +323,19 @@ for PACKAGE_NAME in "${PACKAGES[@]}" ; do if [[ ${PACKAGE_NAME} != "Carla" ]] ;
fi ; done
# compress the TAR if it is a single package
if ${SINGLE_PACKAGE} ; then
gzip -f ${DESTINATION}
fi
# ==============================================================================
# -- Log paths of generated packages -------------------------------------------
# ==============================================================================
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
# 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
if ${DO_CARLA_RELEASE} ; then
if ${DO_TARBALL} ; then