-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild_on_windows-wsl.sh
49 lines (39 loc) · 1.37 KB
/
build_on_windows-wsl.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
trap "exit" INT TERM ERR
trap "kill 0" EXIT
set -e
set -x
export BUILD_TARGET=Switch
export UNITY_EXECUTABLE='/mnt/c/Program Files/Unity/Hub/Editor/2018.4.20f1/Editor/Unity.exe'
echo "Building for $BUILD_TARGET"
CURRENT_BUILD_PATH=$PWD
WINDOWS_CURRENT_BUILD_PATH=$(wslpath -w "$CURRENT_BUILD_PATH")
BUILD_PATH="$PWD/Builds/$BUILD_TARGET"
WINDOWS_BUILD_PATH=$(wslpath -w "$BUILD_PATH")
mkdir -p $BUILD_PATH
LOG_FILE=/mnt/c/Users/Totema/AppData/Local/Unity/Editor/editor.log
echo '' > $LOG_FILE
tail -f $LOG_FILE &
"${UNITY_EXECUTABLE:-xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' /opt/Unity/Editor/Unity}" \
-projectPath "${WINDOWS_CURRENT_BUILD_PATH}" \
-quit \
-batchmode \
-buildTarget $BUILD_TARGET \
-customBuildTarget $BUILD_TARGET \
-customBuildName $BUILD_NAME \
-customBuildPath "${WINDOWS_BUILD_PATH}" \
-customBuildOptions AcceptExternalModificationsToPlayer \
-executeMethod BuildCommand.PerformBuild \
-logFile /dev/stdout
UNITY_EXIT_CODE=$?
if [ $UNITY_EXIT_CODE -eq 0 ]; then
echo "Run succeeded, no failures occurred";
elif [ $UNITY_EXIT_CODE -eq 2 ]; then
echo "Run succeeded, some tests failed";
elif [ $UNITY_EXIT_CODE -eq 3 ]; then
echo "Run failure (other failure)";
else
echo "Unexpected exit code $UNITY_EXIT_CODE";
fi
ls -la $BUILD_PATH
[ -n "$(ls -A $BUILD_PATH)" ] # fail job if build folder is empty