-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerateBuilds.sh
More file actions
55 lines (46 loc) · 1.76 KB
/
generateBuilds.sh
File metadata and controls
55 lines (46 loc) · 1.76 KB
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
50
51
52
53
54
55
#! /bin/sh
PROJECT_NAME=""
VERSION=""
UNITY_EXECUTABLE=""
if [ "$#" -ne 1 ] && [ "$#" -ne 2 ]; then
echo "Usage: $0 PATH_TO_UNITY_EXECUTABLE VERSION_OVERRIDE(optional)" >&2
exit 1
elif [ ! -e ProjectSettings/ProjectSettings.asset ]; then
echo "Current folder is not a Unity Project!"
exit 2
fi
UNITY_EXECUTABLE="$1"
echo "Using unity executable: $1"
if [ "$#" -ne 2 ]; then
VERSION=$(grep bundleVersion ProjectSettings/ProjectSettings.asset | sed 's/.*bundleVersion: //')
else
VERSION="$2"
fi
PROJECT_NAME=$(grep productName ProjectSettings/ProjectSettings.asset | sed 's/.*productName: //' | sed 's/ //g')
echo "Building project $PROJECT_NAME for version $VERSION"
mkdir -p $PWD/Build
mkdir -p $PWD/Build/Linux
mkdir -p $PWD/Build/Windows
mkdir -p $PWD/Build/Web
# Build Linux
rm -rf $PWD/Build/Linux/*
$UNITY_EXECUTABLE -quit -projectPath $PWD -batchmode -nographics -buildTarget Linux64 -buildLinux64Player $PWD/Build/Linux/${PROJECT_NAME}.x86_64
echo -e "\n\n\n\tLinux build finished!\n\n\n"
# Build Windows
rm -rf $PWD/Build/Windows/*
$UNITY_EXECUTABLE -quit -projectPath $PWD -batchmode -nographics -buildTarget Win64 -buildWindows64Player $PWD/Build/Windows/${PROJECT_NAME}.exe
echo -e "\n\n\n\tWindows build finished!\n\n\n"
# Build Web
rm -rf $PWD/Build/Web/*
$UNITY_EXECUTABLE -quit -projectPath $PWD -batchmode -nographics -buildTarget WebGL -executeMethod FinalInferno.WebGLBuilder.Build $PWD/Build/Web/
echo -e "\n\n\n\tWebGL build finished!\n\n\n"
cd Build/Linux
rm -f ../${PROJECT_NAME}${VERSION}_Linux.zip
zip -r ../${PROJECT_NAME}${VERSION}_Linux.zip ./
cd ../Windows
rm -f ../${PROJECT_NAME}${VERSION}_Windows.zip
zip -r ../${PROJECT_NAME}${VERSION}_Windows.zip ./
cd ../Web
rm -f ../${PROJECT_NAME}${VERSION}_Web.zip
zip -r ../${PROJECT_NAME}${VERSION}_Web.zip ./
cd ../..