[unity] Unitypackage automation: added script to automatically create a unitypackage from a prepared unity project.

This commit is contained in:
Harald Csaszar 2019-01-10 18:12:51 +01:00
parent 65b7078ca3
commit f3a3bbf7f8
3 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,2 @@
*.unitypackage
*.log

View File

@ -0,0 +1,62 @@
#!/bin/bash
date_string=`date +%Y-%m-%d`
package_filename="spine-unity-3_7-${date_string}.unitypackage"
export_dir="./packages"
unity_binary="/C/Program Files/Unity5.6/Editor/Unity"
input_args=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-u|--unity)
unity_binary="$2"
shift # past argument
shift # past value
;;
-f|--filename)
package_filename="$2"
shift # past argument
shift # past value
;;
-d|--export_dir)
export_dir="$2"
shift # past argument
shift # past value
;;
*) # unknown option
input_args+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${input_args[@]}" # restore positional parameters
if [[ -n $1 ]]; then
echo "Last line of file specified as non-opt/last argument:"
tail -1 "$1"
fi
logfile_dir="$export_dir/logfiles"
dir_spine="Assets/Spine"
dir_examples="Assets/Spine Examples"
# path initialization
prev_workingdir="$(pwd)"
script_path=${0%/*}
cd ${script_path}
absolute_script_path="$(pwd)"
unityproject_base="${absolute_script_path}/spine-3.7-unity5.6-unitypackage"
# prepare output dirs and pacakge
mkdir -p "$export_dir"
mkdir -p "$logfile_dir"
echo Writing unitypackage to "$export_dir/$package_filename", unity="$unity_binary"
"$unity_binary" -batchmode -nographics -logFile "$logfile_dir/${package_filename}.log" -projectPath "$unityproject_base" -exportPackage "$dir_spine" "$dir_examples" "../$export_dir/$package_filename" -quit
cd ${prev_workingdir}

View File

@ -248,6 +248,11 @@ main() {
git commit -m "[unity][auto] ${package_filename}: integrated changes of main repository up to commit ${out_commit_hash1}${optional_excluding_whitespace_message}."
fi
fi
echo ----------------------------------------------------------------------
echo Removing Library dir to be on the safe side with a clean start
echo ----------------------------------------------------------------------
rm -rf "Library"
echo ----------------------------------------------------------------------
echo Finished successfully