setup_quickstart_framework.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. git checkout nc/quickstarts
  22. # Remove all SPM dependencies from the project. This is necessary to prepare
  23. # the project for framework-based testing.
  24. "${REPO}"/scripts/remove_spm_dependencies.rb "${SAMPLE}Example.xcodeproj"
  25. if [[ ! -z "$LEGACY" ]]; then
  26. cd "Legacy${SAMPLE}Quickstart"
  27. fi
  28. # Make sure the Xcode project has at least one Swift file.
  29. # See https://forums.swift.org/t/using-binary-swift-sdks-from-non-swift-apps/55989
  30. touch foo.swift
  31. "${REPO}"/scripts/update_xcode_target.rb "${SAMPLE}Example.xcodeproj" "${SAMPLE}Example" foo.swift
  32. mkdir -p Firebase/
  33. # Create non Firebase Frameworks and move to Firebase/ dir.
  34. if [[ ! -z "$NON_FIREBASE_SDKS" ]]; then
  35. REPO="${REPO}" NON_FIREBASE_SDKS="${NON_FIREBASE_SDKS}" "${REPO}"/scripts/build_non_firebase_sdks.sh
  36. fi
  37. if [ ! -f "Firebase/Firebase.h" ]; then
  38. cp "${HOME}"/ios_frameworks/Firebase/Firebase.h Firebase/
  39. fi
  40. if [ ! -f "Firebase/module.modulemap" ]; then
  41. cp "${HOME}"/ios_frameworks/Firebase/module.modulemap Firebase/
  42. fi
  43. for file in "$@"
  44. do
  45. if [ ! -d "Firebase/$(basename ${file})" ]; then
  46. rsync -a ${file} Firebase/
  47. fi
  48. done
  49. if [[ "${SAMPLE}" == "Authentication" ]]; then
  50. "${QS_SCRIPTS}"/add_framework_script.rb --sdk "${SAMPLE}" --target "${TARGET}" --framework_path usr/lib/libc++.dylib
  51. "${QS_SCRIPTS}"/add_framework_script.rb --sdk "${SAMPLE}" --target "${TARGET}" --framework_path accelerate.framework --source_tree DEVELOPER_FRAMEWORKS_DIR
  52. fi
  53. if [[ "${SAMPLE}" == "Firestore" ]]; then
  54. "${QS_SCRIPTS}"/add_framework_script.rb --sdk "${SAMPLE}" --target "${TARGET}" --framework_path Firebase/FirebaseAuthUI.xcframework/Resources/FirebaseAuthUI.bundle
  55. "${QS_SCRIPTS}"/add_framework_script.rb --sdk "${SAMPLE}" --target "${TARGET}" --framework_path Firebase/FirebaseEmailAuthUI.xcframework/Resources/FirebaseEmailAuthUI.bundle
  56. fi
  57. "${QS_SCRIPTS}"/add_framework_script.rb --sdk "${SAMPLE}" --target "${TARGET}" --framework_path Firebase/