build_non_firebase_sdks.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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\" : \"~> 7.5-beta\"}" >> "${ZIP_POD_JSON}"
  27. elif [ ${sdk} == "FirebaseStorageSwift" ]; then
  28. echo "{\"name\":\"FirebaseStorageSwift\", \"version\" : \"~> 7.5-beta\"}" >> "${ZIP_POD_JSON}"
  29. else
  30. echo "{\"name\":\"${sdk}\"}" >> "${ZIP_POD_JSON}"
  31. fi
  32. if [ "$num_sdk" -ne 1 ]; then
  33. echo ",">> "${ZIP_POD_JSON}"
  34. fi
  35. num_sdk=$((num_sdk-1))
  36. done
  37. echo "]" >> "${ZIP_POD_JSON}"
  38. mkdir -p "${REPO}"/sdk_zip
  39. swift run zip-builder --keep-build-artifacts --update-pod-repo --platforms ios \
  40. --zip-pods "${ZIP_POD_JSON}" --output-dir "${REPO}"/sdk_zip --disable-build-dependencies
  41. unzip -o "${REPO}"/sdk_zip/Frameworks.zip -d "${HOME}"/ios_frameworks/Firebase/
  42. # Move Frameworks to Firebase dir, so be align with Firebase SDKs.
  43. mv -n "${HOME}"/ios_frameworks/Firebase/Binaries "${HOME}"/ios_frameworks/Firebase/NonFirebaseSDKs/