build.sh 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718
  1. #!/usr/bin/env bash
  2. # Copyright 2018 Google
  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. # USAGE: build.sh product [platform] [method]
  16. #
  17. # Builds the given product for the given platform using the given build method
  18. function pod_gen() {
  19. # Call pod gen with a podspec and additional optional arguments.
  20. bundle exec pod gen --local-sources=./ --sources=https://github.com/firebase/SpecsDev.git,https://github.com/firebase/SpecsStaging.git,https://cdn.cocoapods.org/ "$@"
  21. }
  22. set -euo pipefail
  23. if [[ $# -lt 1 ]]; then
  24. cat 1>&2 <<EOF
  25. USAGE: $0 product [platform] [method]
  26. product can be one of:
  27. Firebase
  28. Firestore
  29. CombineSwift
  30. InAppMessaging
  31. Messaging
  32. MessagingSample
  33. SwiftUISample
  34. MLModelDownloaderSample
  35. RemoteConfig
  36. RemoteConfigSample
  37. Sessions
  38. Storage
  39. SymbolCollision
  40. GoogleDataTransport
  41. Performance
  42. ClientApp
  43. platform can be one of:
  44. iOS (default)
  45. iOS-device
  46. macOS
  47. tvOS
  48. watchOS
  49. catalyst
  50. visionOS
  51. method can be one of:
  52. xcodebuild (default)
  53. cmake
  54. unit
  55. integration
  56. spm
  57. Optionally, reads the environment variable SANITIZERS. If set, it is expected to
  58. be a string containing a space-separated list with some of the following
  59. elements:
  60. asan
  61. tsan
  62. ubsan
  63. EOF
  64. exit 1
  65. fi
  66. product="$1"
  67. platform="iOS"
  68. if [[ $# -gt 1 ]]; then
  69. platform="$2"
  70. fi
  71. method="xcodebuild"
  72. if [[ $# -gt 2 ]]; then
  73. method="$3"
  74. fi
  75. echo "Building $product for $platform using $method"
  76. if [[ -n "${SANITIZERS:-}" ]]; then
  77. echo "Using sanitizers: $SANITIZERS"
  78. fi
  79. scripts_dir=$(dirname "${BASH_SOURCE[0]}")
  80. firestore_emulator="${scripts_dir}/run_firestore_emulator.sh"
  81. database_emulator="${scripts_dir}/run_database_emulator.sh"
  82. system=$(uname -s)
  83. case "$system" in
  84. Darwin)
  85. xcode_version=$(xcodebuild -version | grep Xcode)
  86. xcode_version="${xcode_version/Xcode /}"
  87. xcode_major="${xcode_version/.*/}"
  88. ;;
  89. *)
  90. xcode_major="0"
  91. ;;
  92. esac
  93. # Source function to check if CI secrets are available.
  94. source scripts/check_secrets.sh
  95. # Runs xcodebuild with the given flags, piping output to xcpretty
  96. # If xcodebuild fails with known error codes, retries once.
  97. function RunXcodebuild() {
  98. echo xcodebuild "$@"
  99. xcpretty_cmd=(xcpretty)
  100. result=0
  101. xcodebuild "$@" | tee xcodebuild.log | "${xcpretty_cmd[@]}" || result=$?
  102. if [[ $result == 65 ]]; then
  103. ExportLogs "$@"
  104. echo "xcodebuild exited with 65, retrying" 1>&2
  105. sleep 5
  106. result=0
  107. xcodebuild "$@" | tee xcodebuild.log | "${xcpretty_cmd[@]}" || result=$?
  108. fi
  109. if [[ $result != 0 ]]; then
  110. echo "xcodebuild exited with $result" 1>&2
  111. ExportLogs "$@"
  112. return $result
  113. fi
  114. }
  115. # Exports any logs output captured in the xcresult
  116. function ExportLogs() {
  117. python "${scripts_dir}/xcresult_logs.py" "$@"
  118. }
  119. if [[ "$xcode_major" -lt 15 ]]; then
  120. ios_flags=(
  121. -sdk 'iphonesimulator'
  122. -destination 'platform=iOS Simulator,name=iPhone 14'
  123. )
  124. else
  125. ios_flags=(
  126. -sdk 'iphonesimulator'
  127. -destination 'platform=iOS Simulator,name=iPhone 15'
  128. )
  129. fi
  130. ios_device_flags=(
  131. -sdk 'iphoneos'
  132. -destination 'generic/platform=iOS'
  133. )
  134. ipad_flags=(
  135. -sdk 'iphonesimulator'
  136. -destination 'platform=iOS Simulator,name=iPad Pro (9.7-inch)'
  137. )
  138. macos_flags=(
  139. -sdk 'macosx'
  140. -destination 'platform=OS X,arch=x86_64'
  141. )
  142. tvos_flags=(
  143. -sdk "appletvsimulator"
  144. -destination 'platform=tvOS Simulator,name=Apple TV'
  145. )
  146. watchos_flags=(
  147. -destination 'platform=watchOS Simulator,name=Apple Watch Series 7 (45mm)'
  148. )
  149. visionos_flags=(
  150. -destination 'platform=visionOS Simulator'
  151. )
  152. catalyst_flags=(
  153. ARCHS=x86_64 VALID_ARCHS=x86_64 SUPPORTS_MACCATALYST=YES -sdk macosx
  154. -destination platform="macOS,variant=Mac Catalyst,arch=x86_64" TARGETED_DEVICE_FAMILY=2
  155. CODE_SIGN_IDENTITY=- CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
  156. )
  157. # Compute standard flags for all platforms
  158. case "$platform" in
  159. iOS)
  160. xcb_flags=("${ios_flags[@]}")
  161. gen_platform=ios
  162. ;;
  163. iOS-device)
  164. xcb_flags=("${ios_device_flags[@]}")
  165. gen_platform=ios
  166. ;;
  167. iPad)
  168. xcb_flags=("${ipad_flags[@]}")
  169. ;;
  170. macOS)
  171. xcb_flags=("${macos_flags[@]}")
  172. gen_platform=macos
  173. ;;
  174. tvOS)
  175. xcb_flags=("${tvos_flags[@]}")
  176. gen_platform=tvos
  177. ;;
  178. watchOS)
  179. xcb_flags=("${watchos_flags[@]}")
  180. ;;
  181. visionOS)
  182. xcb_flags=("${visionos_flags[@]}")
  183. ;;
  184. catalyst)
  185. xcb_flags=("${catalyst_flags[@]}")
  186. ;;
  187. all)
  188. xcb_flags=()
  189. ;;
  190. Linux)
  191. xcb_flags=()
  192. ;;
  193. *)
  194. echo "Unknown platform '$platform'" 1>&2
  195. exit 1
  196. ;;
  197. esac
  198. xcb_flags+=(
  199. ONLY_ACTIVE_ARCH=YES
  200. CODE_SIGNING_REQUIRED=NO
  201. CODE_SIGNING_ALLOWED=YES
  202. COMPILER_INDEX_STORE_ENABLE=NO
  203. )
  204. source scripts/buildcache.sh
  205. xcb_flags=("${xcb_flags[@]}" "${buildcache_xcb_flags[@]}")
  206. # TODO(varconst): Add --warn-unused-vars and --warn-uninitialized.
  207. # Right now, it makes the log overflow on Travis because many of our
  208. # dependencies don't build cleanly this way.
  209. cmake_options=(
  210. -Wdeprecated
  211. -DCMAKE_BUILD_TYPE=Debug
  212. )
  213. if [[ -n "${SANITIZERS:-}" ]]; then
  214. for sanitizer in $SANITIZERS; do
  215. case "$sanitizer" in
  216. asan)
  217. xcb_flags+=(
  218. -enableAddressSanitizer YES
  219. )
  220. cmake_options+=(
  221. -DWITH_ASAN=ON
  222. )
  223. ;;
  224. tsan)
  225. xcb_flags+=(
  226. -enableThreadSanitizer YES
  227. )
  228. cmake_options+=(
  229. -DWITH_TSAN=ON
  230. )
  231. ;;
  232. ubsan)
  233. xcb_flags+=(
  234. -enableUndefinedBehaviorSanitizer YES
  235. )
  236. cmake_options+=(
  237. -DWITH_UBSAN=ON
  238. )
  239. ;;
  240. *)
  241. echo "Unknown sanitizer '$sanitizer'" 1>&2
  242. exit 1
  243. ;;
  244. esac
  245. done
  246. fi
  247. case "$product-$platform-$method" in
  248. FirebasePod-iOS-*)
  249. RunXcodebuild \
  250. -workspace 'CoreOnly/Tests/FirebasePodTest/FirebasePodTest.xcworkspace' \
  251. -scheme "FirebasePodTest" \
  252. "${xcb_flags[@]}" \
  253. build
  254. ;;
  255. Auth-*-multiplatform)
  256. if check_secrets; then
  257. RunXcodebuild \
  258. -project 'FirebaseAuth/Tests/MultiPlatformSample/MultiPlatformSample.xcodeproj' \
  259. -scheme "MultiPlatformSample" \
  260. "${xcb_flags[@]}" \
  261. build
  262. fi
  263. ;;
  264. Auth-*-xcodebuild)
  265. if check_secrets; then
  266. RunXcodebuild \
  267. -project 'FirebaseAuth/Tests/SampleSwift/AuthenticationExample.xcodeproj' \
  268. -scheme "ObjCApiTests" \
  269. "${xcb_flags[@]}" \
  270. test
  271. RunXcodebuild \
  272. -project 'FirebaseAuth/Tests/SampleSwift/AuthenticationExample.xcodeproj' \
  273. -scheme "SwiftApiTests" \
  274. "${xcb_flags[@]}" \
  275. test
  276. RunXcodebuild \
  277. -project 'FirebaseAuth/Tests/SampleSwift/AuthenticationExample.xcodeproj' \
  278. -scheme "AuthenticationExampleUITests" \
  279. "${xcb_flags[@]}" \
  280. build \
  281. test
  282. fi
  283. ;;
  284. CombineSwift-*-xcodebuild)
  285. pod_gen FirebaseCombineSwift.podspec --platforms=ios
  286. RunXcodebuild \
  287. -workspace 'gen/FirebaseCombineSwift/FirebaseCombineSwift.xcworkspace' \
  288. -scheme "FirebaseCombineSwift-Unit-unit" \
  289. "${xcb_flags[@]}" \
  290. build \
  291. test
  292. ;;
  293. InAppMessaging-*-xcodebuild)
  294. RunXcodebuild \
  295. -workspace 'FirebaseInAppMessaging/Tests/Integration/DefaultUITestApp/InAppMessagingDisplay-Sample.xcworkspace' \
  296. -scheme 'FiamDisplaySwiftExample' \
  297. "${xcb_flags[@]}" \
  298. test
  299. ;;
  300. Firestore-*-xcodebuild)
  301. "${firestore_emulator}" start
  302. trap '"${firestore_emulator}" stop' ERR EXIT
  303. RunXcodebuild \
  304. -workspace 'Firestore/Example/Firestore.xcworkspace' \
  305. -scheme "Firestore_IntegrationTests_$platform" \
  306. -enableCodeCoverage YES \
  307. "${xcb_flags[@]}" \
  308. test
  309. ;;
  310. Firestore-macOS-cmake | Firestore-Linux-cmake)
  311. "${firestore_emulator}" start
  312. trap '"${firestore_emulator}" stop' ERR EXIT
  313. (
  314. test -d build || mkdir build
  315. cd build
  316. echo "Preparing cmake build ..."
  317. cmake -G Ninja "${cmake_options[@]}" ..
  318. echo "Building cmake build ..."
  319. ninja -k 10 all
  320. ctest --verbose
  321. )
  322. ;;
  323. SymbolCollision-*-*)
  324. RunXcodebuild \
  325. -workspace 'SymbolCollisionTest/SymbolCollisionTest.xcworkspace' \
  326. -scheme "SymbolCollisionTest" \
  327. "${xcb_flags[@]}" \
  328. build
  329. ;;
  330. # TODO(#12205) Restore this test to "test" instead of "build"
  331. Messaging-*-xcodebuild)
  332. pod_gen FirebaseMessaging.podspec --platforms=ios
  333. # Add GoogleService-Info.plist to generated Test Wrapper App.
  334. ruby ./scripts/update_xcode_target.rb gen/FirebaseMessaging/Pods/Pods.xcodeproj \
  335. AppHost-FirebaseMessaging-Unit-Tests \
  336. ../../../FirebaseMessaging/Tests/IntegrationTests/Resources/GoogleService-Info.plist
  337. if check_secrets; then
  338. # Integration tests are only run on iOS to minimize flake failures.
  339. RunXcodebuild \
  340. -workspace 'gen/FirebaseMessaging/FirebaseMessaging.xcworkspace' \
  341. -scheme "FirebaseMessaging-Unit-integration" \
  342. "${ios_flags[@]}" \
  343. "${xcb_flags[@]}" \
  344. build
  345. fi
  346. ;;
  347. MessagingSample-*-*)
  348. if check_secrets; then
  349. RunXcodebuild \
  350. -workspace 'FirebaseMessaging/Apps/Sample/Sample.xcworkspace' \
  351. -scheme "Sample" \
  352. "${xcb_flags[@]}" \
  353. build
  354. fi
  355. ;;
  356. SwiftUISample-*-*)
  357. if check_secrets; then
  358. RunXcodebuild \
  359. -workspace 'FirebaseMessaging/Apps/SwiftUISample/SwiftUISample.xcworkspace' \
  360. -scheme "SwiftUISample" \
  361. "${xcb_flags[@]}" \
  362. build
  363. fi
  364. ;;
  365. MessagingSampleStandaloneWatchApp-*-*)
  366. if check_secrets; then
  367. RunXcodebuild \
  368. -workspace 'FirebaseMessaging/Apps/SampleStandaloneWatchApp/SampleStandaloneWatchApp.xcworkspace' \
  369. -scheme "SampleStandaloneWatchApp Watch App" \
  370. "${xcb_flags[@]}" \
  371. build
  372. fi
  373. ;;
  374. MLModelDownloaderSample-*-*)
  375. if check_secrets; then
  376. RunXcodebuild \
  377. -workspace 'FirebaseMLModelDownloader/Apps/Sample/MLDownloaderTestApp.xcworkspace' \
  378. -scheme "MLDownloaderTestApp" \
  379. "${xcb_flags[@]}" \
  380. build
  381. fi
  382. ;;
  383. WatchOSSample-*-*)
  384. RunXcodebuild \
  385. -workspace 'Example/watchOSSample/SampleWatchApp.xcworkspace' \
  386. -scheme "SampleWatchAppWatchKitApp" \
  387. "${xcb_flags[@]}" \
  388. build
  389. ;;
  390. Database-*-integration)
  391. "${database_emulator}" start
  392. trap '"${database_emulator}" stop' ERR EXIT
  393. pod_gen FirebaseDatabase.podspec --platforms="${gen_platform}"
  394. RunXcodebuild \
  395. -workspace 'gen/FirebaseDatabase/FirebaseDatabase.xcworkspace' \
  396. -scheme "FirebaseDatabase-Unit-integration" \
  397. "${xcb_flags[@]}" \
  398. build \
  399. test
  400. ;;
  401. RemoteConfig-*-fakeconsole)
  402. pod_gen FirebaseRemoteConfigSwift.podspec --platforms="${gen_platform}"
  403. RunXcodebuild \
  404. -workspace 'gen/FirebaseRemoteConfigSwift/FirebaseRemoteConfigSwift.xcworkspace' \
  405. -scheme "FirebaseRemoteConfigSwift-Unit-fake-console-tests" \
  406. "${xcb_flags[@]}" \
  407. build \
  408. test
  409. ;;
  410. RemoteConfig-*-integration)
  411. pod_gen FirebaseRemoteConfigSwift.podspec --platforms="${gen_platform}"
  412. # Add GoogleService-Info.plist to generated Test Wrapper App.
  413. ruby ./scripts/update_xcode_target.rb gen/FirebaseRemoteConfigSwift/Pods/Pods.xcodeproj \
  414. AppHost-FirebaseRemoteConfigSwift-Unit-Tests \
  415. ../../../FirebaseRemoteConfigSwift/Tests/SwiftAPI/GoogleService-Info.plist
  416. # Add AccessToken to generated Test Wrapper App.
  417. ruby ./scripts/update_xcode_target.rb gen/FirebaseRemoteConfigSwift/Pods/Pods.xcodeproj \
  418. AppHost-FirebaseRemoteConfigSwift-Unit-Tests \
  419. ../../../FirebaseRemoteConfigSwift/Tests/AccessToken.json
  420. RunXcodebuild \
  421. -workspace 'gen/FirebaseRemoteConfigSwift/FirebaseRemoteConfigSwift.xcworkspace' \
  422. -scheme "FirebaseRemoteConfigSwift-Unit-swift-api-tests" \
  423. "${xcb_flags[@]}" \
  424. build \
  425. test
  426. ;;
  427. RemoteConfigSample-*-*)
  428. RunXcodebuild \
  429. -workspace 'FirebaseRemoteConfig/Tests/Sample/RemoteConfigSampleApp.xcworkspace' \
  430. -scheme "RemoteConfigSampleApp" \
  431. "${xcb_flags[@]}" \
  432. build
  433. ;;
  434. Sessions-*-integration)
  435. # Perform "pod install" to install the relevant dependencies
  436. # ./FirebaseSessions/generate_testapp.sh
  437. pod_gen FirebaseSessions.podspec --platforms=ios --clean
  438. cd FirebaseSessions/Tests/TestApp; pod install; cd -
  439. # Run E2E Integration Tests for Prod.
  440. RunXcodebuild \
  441. -workspace 'FirebaseSessions/Tests/TestApp/AppQualityDevApp.xcworkspace' \
  442. -scheme "AppQualityDevApp_iOS" \
  443. "${ios_flags[@]}" \
  444. "${xcb_flags[@]}" \
  445. build \
  446. test
  447. # Run E2E Integration Tests for Staging.
  448. RunXcodebuild \
  449. -workspace 'FirebaseSessions/Tests/TestApp/AppQualityDevApp.xcworkspace' \
  450. -scheme "AppQualityDevApp_iOS" \
  451. FirebaseSessionsRunEnvironment=STAGING \
  452. "${ios_flags[@]}" \
  453. "${xcb_flags[@]}" \
  454. build \
  455. test
  456. # Run E2E Integration Tests for Autopush.
  457. RunXcodebuild \
  458. -workspace 'FirebaseSessions/Tests/TestApp/AppQualityDevApp.xcworkspace' \
  459. -scheme "AppQualityDevApp_iOS" \
  460. FirebaseSessionsRunEnvironment=AUTOPUSH \
  461. "${ios_flags[@]}" \
  462. "${xcb_flags[@]}" \
  463. build \
  464. test
  465. ;;
  466. StorageSwift-*-xcodebuild)
  467. pod_gen FirebaseStorage.podspec --platforms=ios
  468. # Add GoogleService-Info.plist to generated Test Wrapper App.
  469. ruby ./scripts/update_xcode_target.rb gen/FirebaseStorage/Pods/Pods.xcodeproj \
  470. AppHost-FirebaseStorage-Unit-Tests \
  471. ../../../FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist
  472. if check_secrets; then
  473. # Integration tests are only run on iOS to minimize flake failures.
  474. RunXcodebuild \
  475. -workspace 'gen/FirebaseStorage/FirebaseStorage.xcworkspace' \
  476. -scheme "FirebaseStorage-Unit-integration" \
  477. "${ios_flags[@]}" \
  478. "${xcb_flags[@]}" \
  479. test
  480. fi
  481. ;;
  482. StorageObjC-*-xcodebuild)
  483. pod_gen FirebaseStorage.podspec --platforms=ios
  484. # Add GoogleService-Info.plist to generated Test Wrapper App.
  485. ruby ./scripts/update_xcode_target.rb gen/FirebaseStorage/Pods/Pods.xcodeproj \
  486. AppHost-FirebaseStorage-Unit-Tests \
  487. ../../../FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist
  488. if check_secrets; then
  489. # Integration tests are only run on iOS to minimize flake failures.
  490. RunXcodebuild \
  491. -workspace 'gen/FirebaseStorage/FirebaseStorage.xcworkspace' \
  492. -scheme "FirebaseStorage-Unit-ObjCIntegration" \
  493. "${ios_flags[@]}" \
  494. "${xcb_flags[@]}" \
  495. test
  496. fi
  497. ;;
  498. StorageCombine-*-xcodebuild)
  499. pod_gen FirebaseCombineSwift.podspec --platforms=ios
  500. # Add GoogleService-Info.plist to generated Test Wrapper App.
  501. ruby ./scripts/update_xcode_target.rb gen/FirebaseCombineSwift/Pods/Pods.xcodeproj \
  502. AppHost-FirebaseCombineSwift-Unit-Tests \
  503. ../../../FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist
  504. if check_secrets; then
  505. # Integration tests are only run on iOS to minimize flake failures.
  506. RunXcodebuild \
  507. -workspace 'gen/FirebaseCombineSwift/FirebaseCombineSwift.xcworkspace' \
  508. -scheme "FirebaseCombineSwift-Unit-integration" \
  509. "${ios_flags[@]}" \
  510. "${xcb_flags[@]}" \
  511. test
  512. fi
  513. ;;
  514. GoogleDataTransport-watchOS-xcodebuild)
  515. RunXcodebuild \
  516. -workspace 'GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestApp.xcworkspace' \
  517. -scheme "GDTWatchOSTestAppWatchKitApp" \
  518. "${xcb_flags[@]}" \
  519. build
  520. RunXcodebuild \
  521. -workspace 'GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSTestApp.xcworkspace' \
  522. -scheme "GDTCCTWatchOSIndependentTestAppWatchKitApp" \
  523. "${xcb_flags[@]}" \
  524. build
  525. RunXcodebuild \
  526. -workspace 'GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSTestApp.xcworkspace' \
  527. -scheme "GDTCCTWatchOSCompanionTestApp" \
  528. "${xcb_flags[@]}" \
  529. build
  530. ;;
  531. Performance-*-unit)
  532. # Run unit tests on prod environment with unswizzle capabilities.
  533. export FPR_UNSWIZZLE_AVAILABLE="1"
  534. export FPR_AUTOPUSH_ENV="0"
  535. pod_gen FirebasePerformance.podspec --platforms="${gen_platform}"
  536. RunXcodebuild \
  537. -workspace 'gen/FirebasePerformance/FirebasePerformance.xcworkspace' \
  538. -scheme "FirebasePerformance-Unit-unit" \
  539. "${xcb_flags[@]}" \
  540. build \
  541. test
  542. ;;
  543. Performance-*-proddev)
  544. # Build the prod dev test app.
  545. export FPR_UNSWIZZLE_AVAILABLE="0"
  546. export FPR_AUTOPUSH_ENV="0"
  547. pod_gen FirebasePerformance.podspec --platforms="${gen_platform}"
  548. RunXcodebuild \
  549. -workspace 'gen/FirebasePerformance/FirebasePerformance.xcworkspace' \
  550. -scheme "FirebasePerformance-TestApp" \
  551. "${xcb_flags[@]}" \
  552. build
  553. ;;
  554. Performance-*-integration)
  555. # Generate the workspace for the SDK to generate Protobuf files.
  556. export FPR_UNSWIZZLE_AVAILABLE="0"
  557. pod_gen FirebasePerformance.podspec --platforms=ios --clean
  558. # Perform "pod install" to install the relevant dependencies
  559. cd FirebasePerformance/Tests/FIRPerfE2E; pod install; cd -
  560. # Run E2E Integration Tests for Autopush.
  561. RunXcodebuild \
  562. -workspace 'FirebasePerformance/Tests/FIRPerfE2E/FIRPerfE2E.xcworkspace' \
  563. -scheme "FIRPerfE2EAutopush" \
  564. FPR_AUTOPUSH_ENV=1 \
  565. "${ios_flags[@]}" \
  566. "${xcb_flags[@]}" \
  567. build \
  568. test
  569. # Run E2E Integration Tests for Prod.
  570. RunXcodebuild \
  571. -workspace 'FirebasePerformance/Tests/FIRPerfE2E/FIRPerfE2E.xcworkspace' \
  572. -scheme "FIRPerfE2EProd" \
  573. "${ios_flags[@]}" \
  574. "${xcb_flags[@]}" \
  575. build \
  576. test
  577. ;;
  578. # Note that the combine tests require setting the minimum iOS and tvOS version to 13.0
  579. *-*-spm)
  580. RunXcodebuild \
  581. -scheme $product \
  582. "${xcb_flags[@]}" \
  583. IPHONEOS_DEPLOYMENT_TARGET=13.0 \
  584. TVOS_DEPLOYMENT_TARGET=13.0 \
  585. test
  586. ;;
  587. *-*-spmbuildonly)
  588. RunXcodebuild \
  589. -scheme $product \
  590. "${xcb_flags[@]}" \
  591. build
  592. ;;
  593. ClientApp-iOS-xcodebuild | ClientApp-iOS13-iOS-xcodebuild)
  594. RunXcodebuild \
  595. -project 'IntegrationTesting/ClientApp/ClientApp.xcodeproj' \
  596. -scheme $product \
  597. "${xcb_flags[@]}" \
  598. build
  599. ;;
  600. ClientApp-CocoaPods*-iOS-xcodebuild)
  601. RunXcodebuild \
  602. -workspace 'IntegrationTesting/ClientApp/ClientApp.xcworkspace' \
  603. -scheme $product \
  604. "${xcb_flags[@]}" \
  605. build
  606. ;;
  607. *)
  608. echo "Don't know how to build this product-platform-method combination" 1>&2
  609. echo " product=$product" 1>&2
  610. echo " platform=$platform" 1>&2
  611. echo " method=$method" 1>&2
  612. exit 1
  613. ;;
  614. esac