Created
June 9, 2019 02:34
-
-
Save borland/a1f94ebc410bc678317aa2d1bc40ecf0 to your computer and use it in GitHub Desktop.
for biappi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
get_and_unzip () { | |
# package_name is | |
local URL="$1/$2/$2-$3.zip" | |
curl -s -o "$2.zip" "$URL" | |
unzip "$2.zip" | |
rm "$2.zip" | |
} | |
# We use artifactory to host the packages, however in this capacity it's literally just | |
# being used as a plain old HTTP server serving up zip files. | |
# Artifactory does enforce a little bit of structure on the URL's which is useful, but it could be any HTTP server | |
ARTIFACTORY_BASEURL="https://artifactory.mycompany.internal/artifactory/rnd-ios-frameworks" | |
# In xcode, frameworks are all referenced under an external/tmp folder | |
# xcode just assumes they exist there - this script puts them there | |
mkdir -p external/tmp | |
pushd external/tmp | |
# firebase frameworks | |
FIREBASE_BASEURL="$ARTIFACTORY_BASEURL/firebase" | |
FIREBASE_SDK_VERSION="5.6.0" | |
# Basically we do a series of "if directory does not exist, download this zip file and extract it there" | |
# It means that when we bump our dependency versions, devs need to manually rm -rf the external/tmp folder, but | |
# this is easily managed. Build machines always start with a clean state so it's never the case for this | |
# This also means that our .framework.zip files must directly contain the framework directory and no other stuff | |
# So, it requires a little bit of manual work to get them in that state as Firebase/etc publish their releases in | |
# random different folder structures. I would script it but we seem to update maybe 5x per year so the manual process is fine | |
# URL Convention (which is artifactory standard) is | |
# https://server/artifactory/repo/publisher/Framework.framework-v.v.zip | |
# e.g. | |
# https://server/artifactory/repo/firebase/FirebaseAnalytics.framework-5.6.0.zip | |
# FirebaseAnalytics | |
if [ ! -d "FirebaseAnalytics.framework" ]; then get_and_unzip $FIREBASE_BASEURL "FirebaseAnalytics.framework" $FIREBASE_SDK_VERSION; fi | |
if [ ! -d "FirebaseCore.framework" ]; then get_and_unzip $FIREBASE_BASEURL "FirebaseCore.framework" $FIREBASE_SDK_VERSION; fi | |
if [ ! -d "FirebaseCoreDiagnostics.framework" ]; then get_and_unzip $FIREBASE_BASEURL "FirebaseCoreDiagnostics.framework" $FIREBASE_SDK_VERSION; fi | |
if [ ! -d "FirebaseInstanceID.framework" ]; then get_and_unzip $FIREBASE_BASEURL "FirebaseInstanceID.framework" $FIREBASE_SDK_VERSION; fi | |
if [ ! -d "GoogleAppMeasurement.framework" ]; then get_and_unzip $FIREBASE_BASEURL "GoogleAppMeasurement.framework" $FIREBASE_SDK_VERSION; fi | |
if [ ! -d "GoogleUtilities.framework" ]; then get_and_unzip $FIREBASE_BASEURL "GoogleUtilities.framework" $FIREBASE_SDK_VERSION; fi | |
if [ ! -d "MeasurementNanoPB.framework" ]; then get_and_unzip $FIREBASE_BASEURL "MeasurementNanoPB.framework" $FIREBASE_SDK_VERSION; fi | |
if [ ! -d "nanopb.framework" ]; then get_and_unzip $FIREBASE_BASEURL "nanopb.framework" $FIREBASE_SDK_VERSION; fi | |
# FirebaseMessaging | |
if [ ! -d "Protobuf.framework" ]; then get_and_unzip $FIREBASE_BASEURL "Protobuf.framework" $FIREBASE_SDK_VERSION; fi | |
if [ ! -d "FirebaseMessaging.framework" ]; then get_and_unzip $FIREBASE_BASEURL "FirebaseMessaging.framework" $FIREBASE_SDK_VERSION; fi | |
# RxSwift | |
if [ ! -d "RxSwift.framework" ]; then get_and_unzip "$ARTIFACTORY_BASEURL/rxswift" "RxSwift.framework" "4.5"; fi | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment