setup_quickstart_framework.sh 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # Copyright 2020 Google LLC
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. set -ex
  15. REPO=`pwd`
  16. if [ ! -d "quickstart-ios" ]; then
  17. git clone https://github.com/firebase/quickstart-ios.git
  18. fi
  19. QS_SCRIPTS="${REPO}"/quickstart-ios/scripts
  20. cd quickstart-ios/"${SAMPLE}"
  21. chmod +x "${QS_SCRIPTS}"/info_script.rb
  22. ruby "${QS_SCRIPTS}"/info_script.rb "${SAMPLE}" "${LEGACY:-}"
  23. if [[ ! -z "$LEGACY" ]]; then
  24. cd "Legacy${SAMPLE}Quickstart"
  25. fi
  26. # Make sure the Xcode project has at least one Swift file.
  27. # See https://forums.swift.org/t/using-binary-swift-sdks-from-non-swift-apps/55989
  28. touch foo.swift
  29. "${REPO}"/scripts/update_xcode_target.rb "${SAMPLE}Example.xcodeproj" "${SAMPLE}Example" foo.swift
  30. mkdir -p Firebase/
  31. # Create non Firebase Frameworks and move to Firebase/ dir.
  32. if [[ ! -z "$NON_FIREBASE_SDKS" ]]; then
  33. REPO="${REPO}" NON_FIREBASE_SDKS="${NON_FIREBASE_SDKS}" "${REPO}"/scripts/build_non_firebase_sdks.sh
  34. fi
  35. if [ ! -f "Firebase/Firebase.h" ]; then
  36. cp "${HOME}"/ios_frameworks/Firebase/Firebase.h Firebase/
  37. fi
  38. if [ ! -f "Firebase/module.modulemap" ]; then
  39. cp "${HOME}"/ios_frameworks/Firebase/module.modulemap Firebase/
  40. fi
  41. for file in "$@"
  42. do
  43. if [ ! -f "Firebase/$(basename ${file})" ]; then
  44. cp -R ${file} Firebase/
  45. fi
  46. done
  47. if [[ "${SAMPLE}" == "Authentication" ]]; then
  48. "${QS_SCRIPTS}"/add_framework_script.rb --sdk "${SAMPLE}" --target "${TARGET}" --framework_path usr/lib/libc++.dylib
  49. "${QS_SCRIPTS}"/add_framework_script.rb --sdk "${SAMPLE}" --target "${TARGET}" --framework_path accelerate.framework --source_tree DEVELOPER_FRAMEWORKS_DIR
  50. fi
  51. if [[ "${SAMPLE}" == "Firestore" ]]; then
  52. "${QS_SCRIPTS}"/add_framework_script.rb --sdk "${SAMPLE}" --target "${TARGET}" --framework_path Firebase/FirebaseAuthUI.xcframework/Resources/FirebaseAuthUI.bundle
  53. "${QS_SCRIPTS}"/add_framework_script.rb --sdk "${SAMPLE}" --target "${TARGET}" --framework_path Firebase/FirebaseEmailAuthUI.xcframework/Resources/FirebaseEmailAuthUI.bundle
  54. fi
  55. "${QS_SCRIPTS}"/add_framework_script.rb --sdk "${SAMPLE}" --target "${TARGET}" --framework_path Firebase/