forked from firebase/firebase-ios-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_project.sh
executable file
·74 lines (63 loc) · 2.37 KB
/
generate_project.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
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
#!/bin/bash
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# From https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
# USAGE: generate_project.sh
helpFunction()
{
echo ""
echo "Usage: $0 -e (prod/autopush*) -p (platform)"
echo -e "\tEvent upload environment - prod (or) autopush. Default: autopush"
echo -c "\tRecreate the Xcode project from scratch. Default: Reuse same XCode project"
exit 1 # Exit script after printing help
}
while getopts "e:p:c" opt
do
case "$opt" in
e ) env="$OPTARG" ;;
c ) clean="clean" ;;
p ) platform="$OPTARG" ;;
? ) helpFunction ;; # Print helpFunction in case parameter is non-existent
esac
done
if [ -z "$env" ] || [ "prod" != "$env" ]
then
env="autopush"
fi
if [ -z "$platform" ]
then
platform="ios"
fi
readonly DIR="$(git rev-parse --show-toplevel)"
# Enable Unswizzling in the development time (This is for unit test purposes).
export FPR_UNSWIZZLE_AVAILABLE="1"
# Enable AUTOPUSH to enable test App sending data to Autopush.
# To enable sending data to Prod, remove the following line and regenerate the project.
if [ "autopush" == "$env" ]
then
export FPR_AUTOPUSH_ENV="1"
else
export FPR_AUTOPUSH_ENV="0"
fi
echo "\nGenerating Fireperf Xcode project for $env environment..."
if [ -z "$clean" ]
then
pod gen "$DIR/FirebasePerformance.podspec" --local-sources="$DIR/" --auto-open --gen-directory="$DIR/gen" --platforms="$platform"
else
echo "\nCreating a fresh Fireperf XCode project."
rm -f "$DIR/FirebasePerformance/ProtoSupport/*.[hm]"
protoc --proto_path="$DIR/FirebasePerformance/ProtoSupport/" --objc_out="$DIR/FirebasePerformance/ProtoSupport/" "$DIR/FirebasePerformance/ProtoSupport/perf_metric.proto"
pod gen "$DIR/FirebasePerformance.podspec" --local-sources="$DIR/" --auto-open --gen-directory="$DIR/gen" --platforms="$platform" --clean
fi