build_non_firebase_sdks.sh 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/bash
  2. # Copyright 2020 Google LLC
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. set -ex
  16. cd "${REPO}"/ReleaseTooling
  17. # This file will have non Firebase SDKs that will be built by ZipBuilder.
  18. ZIP_POD_JSON="non_firebase_sdk.json"
  19. rm -f "${ZIP_POD_JSON}"
  20. IFS=' ,' read -a NON_FIREBASE_SDKS <<< "${NON_FIREBASE_SDKS}"
  21. num_sdk="${#NON_FIREBASE_SDKS[@]}"
  22. echo "[" >> "${ZIP_POD_JSON}"
  23. for sdk in "${NON_FIREBASE_SDKS[@]}"
  24. do
  25. if [ ${sdk} == "FirebaseFirestoreSwift" ]; then
  26. echo "{\"name\":\"FirebaseFirestoreSwift\", \"version\" : \"> 8.2-beta\"}" >> "${ZIP_POD_JSON}"
  27. elif [ ${sdk} == "FirebaseStorageSwift" ]; then
  28. echo "{\"name\":\"FirebaseStorageSwift\", \"version\" : \"> 8.12-beta\"}" >> "${ZIP_POD_JSON}"
  29. elif [ ${sdk} == "FirebaseRemoteConfigSwift" ]; then
  30. echo "{\"name\":\"FirebaseRemoteConfigSwift\", \"version\" : \"> 8.12-beta\"}" >> "${ZIP_POD_JSON}"
  31. else
  32. echo "{\"name\":\"${sdk}\"}" >> "${ZIP_POD_JSON}"
  33. fi
  34. if [ "$num_sdk" -ne 1 ]; then
  35. echo ",">> "${ZIP_POD_JSON}"
  36. fi
  37. num_sdk=$((num_sdk-1))
  38. done
  39. echo "]" >> "${ZIP_POD_JSON}"
  40. mkdir -p "${REPO}"/sdk_zip
  41. swift run zip-builder --keep-build-artifacts --update-pod-repo --platforms ios \
  42. --zip-pods "${ZIP_POD_JSON}" --output-dir "${REPO}"/sdk_zip --disable-build-dependencies
  43. unzip -o "${REPO}"/sdk_zip/Frameworks.zip -d "${HOME}"/ios_frameworks/Firebase/
  44. # Move Frameworks to Firebase dir, so be align with Firebase SDKs.
  45. mv -n "${HOME}"/ios_frameworks/Firebase/Binaries "${HOME}"/ios_frameworks/Firebase/NonFirebaseSDKs/