-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild_native
executable file
·151 lines (118 loc) · 4.14 KB
/
build_native
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/usr/bin/env bash
function blue
{
tput setaf 7; tput setab 4
echo "$1"
tput op
}
function red
{
tput setaf 7; tput setab 1
echo "$1"
tput op
}
IOS_PROJECT="../openkit-ios/OpenKit.xcodeproj"
ANDROID_SDK_BUILD_FILE="../openkit-android/OpenKitSDK/build.xml"
ANDROID_UNITY_BUILD_FILE="../openkit-android/OpenKitUnity/build.xml"
ANDROID_SDK_FOLDER="../openkit-android/OpenKitSDK"
UNITY_PLUGINS_FOLDER="OpenKitUnityPlugin/Assets/Plugins"
UNITY_PLUGINS_ANDROID_FOLDER="OpenKitUnityPlugin/Assets/Plugins/Android"
UNITY_PLUGINS_IOS_FOLDER="OpenKitUnityPlugin/Assets/Plugins/iOS"
echo "Do you want to build a debug or release package? Default is release. (d/r)"
read -e MORE
if [ $MORE == "d" ]
then
CONFIG="Debug"
ANT_TARGET="jar"
LIB_OPENKIT_UNITY_BUILD_PATH="../openkit-ios/build/Debug-iphoneos/libOpenKitUnity.a"
LIB_OPENKIT_BUILD_PATH="../openkit-ios/build/Debug-iphoneos/libOpenKit.a"
INCLUDES_FOLDER="../openkit-ios/build/Debug-iphoneos/include/"
RESOURCES_FOLDER="../openkit-ios/build/Debug-iphoneos/Resources/"
ANT_CONFIG="debug"
else
CONFIG="Release"
LIB_OPENKIT_UNITY_BUILD_PATH="../openkit-ios/build/Release-iphoneos/libOpenKitUnity.a"
LIB_OPENKIT_BUILD_PATH="../openkit-ios/build/Release-universal/libOpenKit.a"
INCLUDES_FOLDER="../openkit-ios/build/Release-universal/include/"
RESOURCES_FOLDER="../openkit-ios/build/Release-universal/Resources/"
ANT_TARGET="dist-jar"
ANT_CONFIG="release"
fi
ERROR=0
function check_error
{
if [ $? != 0 ]
then
red "There was an error with the previous command"
ERROR=1
fi
}
blue "Building $CONFIG"
blue "cleaning OpenKitSDK"
ant clean -f $ANDROID_SDK_BUILD_FILE
check_error
blue "cleaning OpenKitUnity - Android"
ant clean -f $ANDROID_UNITY_BUILD_FILE
check_error
#no longer building a jar out of OpenKitSDK, just need to build the SDK project and copy it over
blue "Building OpenKitSDK $CONFIG"
ant $ANT_CONFIG -f $ANDROID_SDK_BUILD_FILE
check_error
blue "Building openkit-unity-plugin jar $CONFIG"
ant $ANT_TARGET -f $ANDROID_UNITY_BUILD_FILE
check_error
# Don't need to copy lib files anymore, since they are contained in the OpenKitSDK folder itself
#blue "Copying Android Libs files"
#cp -v ../openkit-android/OpenKitSDK/libs/* $UNITY_PLUGINS_ANDROID_FOLDER
#check_error
blue "Deleting OpenKitSDK folder and copying over OpenKitSDK folder"
rm -rf $UNITY_PLUGINS_ANDROID_FOLDER/OpenKitSDK
check_error
cp -r -v $ANDROID_SDK_FOLDER $UNITY_PLUGINS_ANDROID_FOLDER
check_error
blue "Copying OpenKitUnity JAR"
cp -v ../openkit-android/OpenKitUnity/bin/jars/openkit-unity-plugin.jar $UNITY_PLUGINS_ANDROID_FOLDER/OpenKitSDK/libs
check_error
# We don't copy over the facebook android SDK anymore-- it comes in unity
#blue "Deleting and Copying Facebook Android SDK"
#rm -rf $UNITY_PLUGINS_ANDROID_FOLDER/facebook
#check_error
#cp -r -v ../openkit-android/Vendor/facebook $UNITY_PLUGINS_ANDROID_FOLDER
#check_error
blue "Finished building and copying for Android $CONFIG"
blue "Building iOS $CONFIG"
blue "Cleaning OpenKit Project, all targets"
xcodebuild -alltargets clean -project $IOS_PROJECT
check_error
blue "Building OpenKit project, $CONFIG"
xcodebuild -project $IOS_PROJECT -configuration $CONFIG -target OpenKit
check_error
blue "Building OpenKitUnity Plugin, $CONFIG"
xcodebuild -project $IOS_PROJECT -configuration $CONFIG -target OpenKitUnity
check_error
blue "Copying libOpenKitUnity.a file"
cp -v $LIB_OPENKIT_UNITY_BUILD_PATH $UNITY_PLUGINS_IOS_FOLDER
check_error
blue "Copying libOpenKit.a to Unity project"
cp -v $LIB_OPENKIT_BUILD_PATH $UNITY_PLUGINS_IOS_FOLDER
check_error
blue "Deleting include and resources folders"
rm -rf OpenKitUnityPlugin/Assets/Plugins/iOS/OpenKitResources/Resources
check_error
rm -rf OpenKitUnityPlugin/Assets/Plugins/iOS/OpenKitResources/include
check_error
blue "Copying include folder"
cp -r -v $INCLUDES_FOLDER OpenKitUnityPlugin/Assets/Plugins/iOS/OpenKitResources/include
check_error
blue "Copying Resources folder"
cp -r -v $RESOURCES_FOLDER OpenKitUnityPlugin/Assets/Plugins/iOS/OpenKitResources/Resources
check_error
blue "Finished building $CONFIG"
blue "Deleting build folder"
rm -rf build
check_error
#Check for any errors
if [ $ERROR != 0 ]
then
red "There was an error!"
fi