build_non_firebase_sdks.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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}"/ZipBuilder
  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. echo "{\"name\":\"${sdk}\"}" >> "${ZIP_POD_JSON}"
  26. if [ "$num_sdk" -ne 1 ]; then
  27. echo ",">> "${ZIP_POD_JSON}"
  28. fi
  29. num_sdk=$((num_sdk-1))
  30. done
  31. echo "]" >> "${ZIP_POD_JSON}"
  32. mkdir -p "${REPO}"/sdk_zip
  33. swift run ReleasePackager -keepBuildArtifacts true -updatePodRepo true -templateDir "${REPO}"/ZipBuilder/Template -zipPods "${ZIP_POD_JSON}" -outputDir "${REPO}"/sdk_zip -buildDependencies false
  34. unzip "${REPO}"/sdk_zip/Frameworks.zip -d "${HOME}"/ios_frameworks/Firebase/
  35. # Move Frameworks to Firebase dir, so be align with Firebase SDKs.
  36. mv "${HOME}"/ios_frameworks/Firebase/staging "${HOME}"/ios_frameworks/Firebase/NonFirebaseSDKs/