-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy pathinstall_prereqs.sh
executable file
·182 lines (144 loc) · 4.81 KB
/
install_prereqs.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
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#!/usr/bin/env bash
# Copyright 2018 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.
# Within Travis, installs prerequisites for a build.
# Examines the following configured environment variables that should be
# specified in an env: block
# - PROJECT - Firebase or Firestore
# - METHOD - xcodebuild or cmake; default is xcodebuild
set -euo pipefail
# apt_install program package
#
# Installs the given package if the given command is missing
function apt_install() {
local program="$1"
local package="$2"
which "$program" >& /dev/null || sudo apt-get install "$package"
}
function install_xcpretty() {
gem install xcpretty
}
# Default values, if not supplied on the command line or environment
platform="iOS"
method="xcodebuild"
if [[ $# -eq 0 ]]; then
# Take arguments from the environment
project=$PROJECT
platform=${PLATFORM:-${platform}}
method=${METHOD:-${method}}
else
project="$1"
if [[ $# -gt 1 ]]; then
platform="$2"
fi
if [[ $# -gt 2 ]]; then
method="$3"
fi
fi
echo "Installing prerequisites for $project for $platform using $method"
if [[ "$method" != "cmake" ]]; then
scripts/setup_bundler.sh
fi
case "$project-$platform-$method" in
FirebasePod-iOS-*)
install_xcpretty
bundle exec pod install --project-directory=CoreOnly/Tests/FirebasePodTest --repo-update
;;
Crashlytics-*)
;;
CombineSwift-*)
;;
Database-*)
;;
Functions-*)
# Start server for Functions integration tests.
./FirebaseFunctions/Backend/start.sh synchronous
;;
Storage-*)
;;
InAppMessaging-*-xcodebuild)
install_xcpretty
bundle exec pod install --project-directory=FirebaseInAppMessaging/Tests/Integration/DefaultUITestApp --no-repo-update
;;
Firestore-*-xcodebuild | Firestore-*-fuzz)
install_xcpretty
# The Firestore Podfile is multi-platform by default, but this doesn't work
# with command-line builds using xcodebuild. The PLATFORM environment
# variable forces the project to be set for just that single platform.
export PLATFORM="$platform"
bundle exec pod install --project-directory=Firestore/Example --repo-update
;;
Firestore-iOS-cmake | Firestore-tvOS-cmake | Firestore-macOS-cmake)
brew outdated cmake || brew upgrade cmake
brew outdated go || brew upgrade go # Somehow the build for Abseil requires this.
brew install ccache
brew install ninja
# Install python packages required to generate proto sources
pip install six
;;
Firestore-Linux-cmake)
apt_install ccache ccache
apt_install cmake cmake
apt_install go golang-go
apt_install ninja ninja-build
# Install python packages required to generate proto sources
pip install six
;;
SymbolCollision-*-*)
install_xcpretty
bundle exec pod install --project-directory=SymbolCollisionTest --repo-update
;;
MessagingSample-*)
install_xcpretty
bundle exec pod install --project-directory=FirebaseMessaging/Apps/Sample --repo-update
;;
SwiftUISample-*)
install_xcpretty
bundle exec pod install --project-directory=FirebaseMessaging/Apps/SwiftUISample --repo-update
;;
MessagingSampleStandaloneWatchApp-*)
install_xcpretty
bundle exec pod install --project-directory=FirebaseMessaging/Apps/SampleStandaloneWatchApp --repo-update
;;
MLModelDownloaderSample-*)
install_xcpretty
bundle exec pod install --project-directory=FirebaseMLModelDownloader/Apps/Sample --repo-update
;;
RemoteConfigSample-*)
install_xcpretty
bundle exec pod install --project-directory=FirebaseRemoteConfig/Tests/Sample --repo-update
;;
WatchOSSample-*)
install_xcpretty
bundle exec pod install --project-directory=Example/watchOSSample --repo-update
;;
GoogleDataTransport-watchOS-xcodebuild)
install_xcpretty
bundle exec pod install --project-directory=GoogleDataTransport/GDTWatchOSTestApp/ --repo-update
bundle exec pod install --project-directory=GoogleDataTransport/GDTCCTWatchOSTestApp/
;;
ClientApp-iOS-xcodebuild)
install_xcpretty
bundle exec pod install --project-directory=IntegrationTesting/ClientApp/ --repo-update
;;
*-pod-lib-lint)
;;
*)
echo "Unknown project-platform-method combo" 1>&2
echo " PROJECT=$project" 1>&2
echo " PLATFORM=$platform" 1>&2
echo " METHOD=$method" 1>&2
exit 1
;;
esac