generate_testapp.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/bash
  2. # Copyright 2022 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. #
  16. readonly DIR="$( git rev-parse --show-toplevel )"
  17. #
  18. # This script attempts to copy the Google Services file from google3. If you are not a Google Employee, it will fail, so we'd recommend you create your own Firebase App and place the Google Services file in Tests/TestApp/Shared
  19. #
  20. echoColor() {
  21. COLOR='\033[0;35m'
  22. NC='\033[0m'
  23. printf "${COLOR}$1${NC}\n"
  24. }
  25. echoRed() {
  26. COLOR='\033[0;31m'
  27. NC='\033[0m'
  28. printf "${COLOR}$1${NC}\n"
  29. }
  30. echoColor "Generating Firebase Sessions Test App"
  31. echoColor "Copying GoogleService-Info.plist from google3. Checking gcert status"
  32. if gcertstatus; then
  33. G3Path="/google/src/files/head/depot/google3/third_party/firebase/ios/Secrets/Sessions/TestApp/GoogleService-Info.plist"
  34. Dest="$DIR/FirebaseSessions/Tests/TestApp/Shared"
  35. cp $G3Path $Dest
  36. echoColor "Copied $G3Path to $Dest"
  37. else
  38. echoRed "gcert token is not valid. If you are a Google Employee, run 'gcert', and then repeat this command. Non-Google employees will need to download a GoogleService-Info.plist and place it in $DIR/FirebaseSessions/Tests/TestApp/Shared"
  39. fi
  40. echoColor "Running 'pod install'"
  41. cd $DIR/FirebaseSessions/Tests/TestApp
  42. pod install
  43. # Upon a `pod install`, Crashlytics will copy these files at the root directory
  44. # due to a funky interaction with its cocoapod. This line deletes these extra
  45. # copies of the files as they should only live in Crashlytics/
  46. rm -f $DIR/run $DIR/upload-symbols
  47. open *.xcworkspace