build.sh 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  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. watchos_flags=(
  125. -sdk 'watchsimulator'
  126. -destination 'platform=watchOS Simulator,name=Apple Watch Series 7 (45mm)'
  127. )
  128. elif [[ "$xcode_major" -lt 16 ]]; then
  129. ios_flags=(
  130. -sdk 'iphonesimulator'
  131. -destination 'platform=iOS Simulator,name=iPhone 15'
  132. )
  133. watchos_flags=(
  134. -sdk 'watchsimulator'
  135. -destination 'platform=watchOS Simulator,name=Apple Watch Series 7 (45mm)'
  136. )
  137. else
  138. ios_flags=(
  139. -sdk 'iphonesimulator'
  140. -destination 'platform=iOS Simulator,name=iPhone 16'
  141. )
  142. watchos_flags=(
  143. -sdk 'watchsimulator'
  144. -destination 'platform=watchOS Simulator,name=Apple Watch Series 10 (42mm)'
  145. )
  146. fi
  147. ios_device_flags=(
  148. -sdk 'iphoneos'
  149. -destination 'generic/platform=iOS'
  150. )
  151. ipad_flags=(
  152. -sdk 'iphonesimulator'
  153. -destination 'platform=iOS Simulator,name=iPad Pro (9.7-inch)'
  154. )
  155. macos_flags=(
  156. -sdk 'macosx'
  157. -destination 'platform=OS X,arch=x86_64'
  158. )
  159. tvos_flags=(
  160. -sdk "appletvsimulator"
  161. -destination 'platform=tvOS Simulator,name=Apple TV'
  162. )
  163. visionos_flags=(
  164. -sdk 'xrsimulator'
  165. -destination 'platform=visionOS Simulator,name=Apple Vision Pro'
  166. )
  167. catalyst_flags=(
  168. ARCHS=x86_64 VALID_ARCHS=x86_64 SUPPORTS_MACCATALYST=YES -sdk macosx
  169. -destination platform="macOS,variant=Mac Catalyst,arch=x86_64" TARGETED_DEVICE_FAMILY=2
  170. CODE_SIGN_IDENTITY=- CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
  171. )
  172. # Compute standard flags for all platforms
  173. case "$platform" in
  174. iOS)
  175. xcb_flags=("${ios_flags[@]}")
  176. gen_platform=ios
  177. ;;
  178. iOS-device)
  179. xcb_flags=("${ios_device_flags[@]}")
  180. gen_platform=ios
  181. ;;
  182. iPad)
  183. xcb_flags=("${ipad_flags[@]}")
  184. ;;
  185. macOS)
  186. xcb_flags=("${macos_flags[@]}")
  187. gen_platform=macos
  188. ;;
  189. tvOS)
  190. xcb_flags=("${tvos_flags[@]}")
  191. gen_platform=tvos
  192. ;;
  193. watchOS)
  194. xcb_flags=("${watchos_flags[@]}")
  195. ;;
  196. visionOS)
  197. xcb_flags=("${visionos_flags[@]}")
  198. ;;
  199. catalyst)
  200. xcb_flags=("${catalyst_flags[@]}")
  201. ;;
  202. all)
  203. xcb_flags=()
  204. ;;
  205. Linux)
  206. xcb_flags=()
  207. ;;
  208. *)
  209. echo "Unknown platform '$platform'" 1>&2
  210. exit 1
  211. ;;
  212. esac
  213. xcb_flags+=(
  214. ONLY_ACTIVE_ARCH=YES
  215. CODE_SIGNING_REQUIRED=NO
  216. CODE_SIGNING_ALLOWED=YES
  217. COMPILER_INDEX_STORE_ENABLE=NO
  218. )
  219. source scripts/buildcache.sh
  220. xcb_flags=("${xcb_flags[@]}" "${buildcache_xcb_flags[@]}")
  221. # TODO(varconst): Add --warn-unused-vars and --warn-uninitialized.
  222. # Right now, it makes the log overflow on Travis because many of our
  223. # dependencies don't build cleanly this way.
  224. cmake_options=(
  225. -Wdeprecated
  226. -DCMAKE_BUILD_TYPE=Debug
  227. )
  228. if [[ -n "${SANITIZERS:-}" ]]; then
  229. for sanitizer in $SANITIZERS; do
  230. case "$sanitizer" in
  231. asan)
  232. xcb_flags+=(
  233. -enableAddressSanitizer YES
  234. )
  235. cmake_options+=(
  236. -DWITH_ASAN=ON
  237. )
  238. ;;
  239. tsan)
  240. xcb_flags+=(
  241. -enableThreadSanitizer YES
  242. )
  243. cmake_options+=(
  244. -DWITH_TSAN=ON
  245. )
  246. ;;
  247. ubsan)
  248. xcb_flags+=(
  249. -enableUndefinedBehaviorSanitizer YES
  250. )
  251. cmake_options+=(
  252. -DWITH_UBSAN=ON
  253. )
  254. ;;
  255. *)
  256. echo "Unknown sanitizer '$sanitizer'" 1>&2
  257. exit 1
  258. ;;
  259. esac
  260. done
  261. fi
  262. case "$product-$platform-$method" in
  263. FirebasePod-iOS-*)
  264. RunXcodebuild \
  265. -workspace 'CoreOnly/Tests/FirebasePodTest/FirebasePodTest.xcworkspace' \
  266. -scheme "FirebasePodTest" \
  267. "${xcb_flags[@]}" \
  268. build
  269. ;;
  270. Auth-*-*)
  271. if check_secrets; then
  272. RunXcodebuild \
  273. -project 'FirebaseAuth/Tests/SampleSwift/AuthenticationExample.xcodeproj' \
  274. -scheme "$method" \
  275. "${xcb_flags[@]}" \
  276. test
  277. fi
  278. ;;
  279. CombineSwift-*-xcodebuild)
  280. pod_gen FirebaseCombineSwift.podspec --platforms=ios
  281. RunXcodebuild \
  282. -workspace 'gen/FirebaseCombineSwift/FirebaseCombineSwift.xcworkspace' \
  283. -scheme "FirebaseCombineSwift-Unit-unit" \
  284. "${xcb_flags[@]}" \
  285. build \
  286. test
  287. ;;
  288. InAppMessaging-*-xcodebuild)
  289. RunXcodebuild \
  290. -workspace 'FirebaseInAppMessaging/Tests/Integration/DefaultUITestApp/InAppMessagingDisplay-Sample.xcworkspace' \
  291. -scheme 'FiamDisplaySwiftExample' \
  292. "${xcb_flags[@]}" \
  293. test
  294. ;;
  295. Firestore-*-xcodebuild)
  296. "${firestore_emulator}" start
  297. trap '"${firestore_emulator}" stop' ERR EXIT
  298. RunXcodebuild \
  299. -workspace 'Firestore/Example/Firestore.xcworkspace' \
  300. -scheme "Firestore_IntegrationTests_$platform" \
  301. -enableCodeCoverage YES \
  302. "${xcb_flags[@]}" \
  303. test
  304. ;;
  305. Firestore-macOS-cmake | Firestore-Linux-cmake)
  306. "${firestore_emulator}" start
  307. trap '"${firestore_emulator}" stop' ERR EXIT
  308. (
  309. test -d build || mkdir build
  310. cd build
  311. echo "Preparing cmake build ..."
  312. cmake -G Ninja "${cmake_options[@]}" ..
  313. echo "Building cmake build ..."
  314. ninja -k 10 all
  315. ctest --verbose
  316. )
  317. ;;
  318. SymbolCollision-*-*)
  319. RunXcodebuild \
  320. -workspace 'SymbolCollisionTest/SymbolCollisionTest.xcworkspace' \
  321. -scheme "SymbolCollisionTest" \
  322. "${xcb_flags[@]}" \
  323. build
  324. ;;
  325. # TODO(#12205) Restore this test to "test" instead of "build"
  326. Messaging-*-xcodebuild)
  327. pod_gen FirebaseMessaging.podspec --platforms=ios
  328. # Add GoogleService-Info.plist to generated Test Wrapper App.
  329. ruby ./scripts/update_xcode_target.rb gen/FirebaseMessaging/Pods/Pods.xcodeproj \
  330. AppHost-FirebaseMessaging-Unit-Tests \
  331. ../../../FirebaseMessaging/Tests/IntegrationTests/Resources/GoogleService-Info.plist
  332. if check_secrets; then
  333. # Integration tests are only run on iOS to minimize flake failures.
  334. RunXcodebuild \
  335. -workspace 'gen/FirebaseMessaging/FirebaseMessaging.xcworkspace' \
  336. -scheme "FirebaseMessaging-Unit-integration" \
  337. "${ios_flags[@]}" \
  338. "${xcb_flags[@]}" \
  339. build
  340. fi
  341. ;;
  342. MessagingSample-*-*)
  343. if check_secrets; then
  344. RunXcodebuild \
  345. -workspace 'FirebaseMessaging/Apps/Sample/Sample.xcworkspace' \
  346. -scheme "Sample" \
  347. "${xcb_flags[@]}" \
  348. build
  349. fi
  350. ;;
  351. SwiftUISample-*-*)
  352. if check_secrets; then
  353. RunXcodebuild \
  354. -workspace 'FirebaseMessaging/Apps/SwiftUISample/SwiftUISample.xcworkspace' \
  355. -scheme "SwiftUISample" \
  356. "${xcb_flags[@]}" \
  357. build
  358. fi
  359. ;;
  360. # TODO: This is actually building for iOS instead of watchOS. Update to use
  361. # watchOS xcb_flags along with the watchOS sdk option. Also nanopb and promises
  362. # podspecs need minimum version updates.
  363. MessagingSampleStandaloneWatchApp-*-*)
  364. if check_secrets; then
  365. RunXcodebuild \
  366. -workspace 'FirebaseMessaging/Apps/SampleStandaloneWatchApp/SampleStandaloneWatchApp.xcworkspace' \
  367. -scheme "SampleStandaloneWatchApp Watch App" \
  368. -destination 'platform=watchOS Simulator,name=Apple Watch Series 7 (45mm)' \
  369. build
  370. fi
  371. ;;
  372. MLModelDownloaderSample-*-*)
  373. if check_secrets; then
  374. RunXcodebuild \
  375. -workspace 'FirebaseMLModelDownloader/Apps/Sample/MLDownloaderTestApp.xcworkspace' \
  376. -scheme "MLDownloaderTestApp" \
  377. "${xcb_flags[@]}" \
  378. build
  379. fi
  380. ;;
  381. WatchOSSample-*-*)
  382. RunXcodebuild \
  383. -workspace 'Example/watchOSSample/SampleWatchApp.xcworkspace' \
  384. -scheme "SampleWatchAppWatchKitApp" \
  385. "${xcb_flags[@]}" \
  386. build
  387. ;;
  388. Database-*-integration)
  389. "${database_emulator}" start
  390. trap '"${database_emulator}" stop' ERR EXIT
  391. pod_gen FirebaseDatabase.podspec --platforms="${gen_platform}"
  392. RunXcodebuild \
  393. -workspace 'gen/FirebaseDatabase/FirebaseDatabase.xcworkspace' \
  394. -scheme "FirebaseDatabase-Unit-integration" \
  395. "${xcb_flags[@]}" \
  396. build \
  397. test
  398. ;;
  399. RemoteConfig-*-fakeconsole)
  400. pod_gen FirebaseRemoteConfig.podspec --platforms="${gen_platform}"
  401. RunXcodebuild \
  402. -workspace 'gen/FirebaseRemoteConfig/FirebaseRemoteConfig.xcworkspace' \
  403. -scheme "FirebaseRemoteConfig-Unit-fake-console-tests" \
  404. "${xcb_flags[@]}" \
  405. build \
  406. test
  407. ;;
  408. RemoteConfig-*-integration)
  409. pod_gen FirebaseRemoteConfig.podspec --platforms="${gen_platform}"
  410. # Add GoogleService-Info.plist to generated Test Wrapper App.
  411. ruby ./scripts/update_xcode_target.rb gen/FirebaseRemoteConfig/Pods/Pods.xcodeproj \
  412. AppHost-FirebaseRemoteConfig-Unit-Tests \
  413. ../../../FirebaseRemoteConfig/Tests/Swift/SwiftAPI/GoogleService-Info.plist
  414. # Add AccessToken to generated Test Wrapper App.
  415. ruby ./scripts/update_xcode_target.rb gen/FirebaseRemoteConfig/Pods/Pods.xcodeproj \
  416. AppHost-FirebaseRemoteConfig-Unit-Tests \
  417. ../../../FirebaseRemoteConfig/Tests/Swift/AccessToken.json
  418. RunXcodebuild \
  419. -workspace 'gen/FirebaseRemoteConfig/FirebaseRemoteConfig.xcworkspace' \
  420. -scheme "FirebaseRemoteConfig-Unit-swift-api-tests" \
  421. "${xcb_flags[@]}" \
  422. build \
  423. test
  424. ;;
  425. RemoteConfigSample-*-*)
  426. RunXcodebuild \
  427. -workspace 'FirebaseRemoteConfig/Tests/Sample/RemoteConfigSampleApp.xcworkspace' \
  428. -scheme "RemoteConfigSampleApp" \
  429. "${xcb_flags[@]}" \
  430. build
  431. ;;
  432. VertexSample-*-*)
  433. RunXcodebuild \
  434. -project 'FirebaseVertexAI/Sample/VertexAISample.xcodeproj' \
  435. -scheme "VertexAISample" \
  436. "${xcb_flags[@]}" \
  437. build
  438. ;;
  439. Sessions-*-integration)
  440. # Perform "pod install" to install the relevant dependencies
  441. # ./FirebaseSessions/generate_testapp.sh
  442. pod_gen FirebaseSessions.podspec --platforms=ios --clean
  443. cd FirebaseSessions/Tests/TestApp; pod install; cd -
  444. # Run E2E Integration Tests for Prod.
  445. RunXcodebuild \
  446. -workspace 'FirebaseSessions/Tests/TestApp/AppQualityDevApp.xcworkspace' \
  447. -scheme "AppQualityDevApp_iOS" \
  448. "${ios_flags[@]}" \
  449. "${xcb_flags[@]}" \
  450. build \
  451. test
  452. # Run E2E Integration Tests for Staging.
  453. RunXcodebuild \
  454. -workspace 'FirebaseSessions/Tests/TestApp/AppQualityDevApp.xcworkspace' \
  455. -scheme "AppQualityDevApp_iOS" \
  456. FirebaseSessionsRunEnvironment=STAGING \
  457. "${ios_flags[@]}" \
  458. "${xcb_flags[@]}" \
  459. build \
  460. test
  461. # Run E2E Integration Tests for Autopush.
  462. RunXcodebuild \
  463. -workspace 'FirebaseSessions/Tests/TestApp/AppQualityDevApp.xcworkspace' \
  464. -scheme "AppQualityDevApp_iOS" \
  465. FirebaseSessionsRunEnvironment=AUTOPUSH \
  466. "${ios_flags[@]}" \
  467. "${xcb_flags[@]}" \
  468. build \
  469. test
  470. ;;
  471. StorageSwift-*-xcodebuild)
  472. pod_gen FirebaseStorage.podspec --platforms=ios
  473. # Add GoogleService-Info.plist to generated Test Wrapper App.
  474. ruby ./scripts/update_xcode_target.rb gen/FirebaseStorage/Pods/Pods.xcodeproj \
  475. AppHost-FirebaseStorage-Unit-Tests \
  476. ../../../FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist
  477. if check_secrets; then
  478. # Integration tests are only run on iOS to minimize flake failures.
  479. RunXcodebuild \
  480. -workspace 'gen/FirebaseStorage/FirebaseStorage.xcworkspace' \
  481. -scheme "FirebaseStorage-Unit-integration" \
  482. "${ios_flags[@]}" \
  483. "${xcb_flags[@]}" \
  484. test
  485. fi
  486. ;;
  487. StorageObjC-*-xcodebuild)
  488. pod_gen FirebaseStorage.podspec --platforms=ios
  489. # Add GoogleService-Info.plist to generated Test Wrapper App.
  490. ruby ./scripts/update_xcode_target.rb gen/FirebaseStorage/Pods/Pods.xcodeproj \
  491. AppHost-FirebaseStorage-Unit-Tests \
  492. ../../../FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist
  493. if check_secrets; then
  494. # Integration tests are only run on iOS to minimize flake failures.
  495. RunXcodebuild \
  496. -workspace 'gen/FirebaseStorage/FirebaseStorage.xcworkspace' \
  497. -scheme "FirebaseStorage-Unit-ObjCIntegration" \
  498. "${ios_flags[@]}" \
  499. "${xcb_flags[@]}" \
  500. test
  501. fi
  502. ;;
  503. StorageCombine-*-xcodebuild)
  504. pod_gen FirebaseCombineSwift.podspec --platforms=ios
  505. # Add GoogleService-Info.plist to generated Test Wrapper App.
  506. ruby ./scripts/update_xcode_target.rb gen/FirebaseCombineSwift/Pods/Pods.xcodeproj \
  507. AppHost-FirebaseCombineSwift-Unit-Tests \
  508. ../../../FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist
  509. if check_secrets; then
  510. # Integration tests are only run on iOS to minimize flake failures.
  511. RunXcodebuild \
  512. -workspace 'gen/FirebaseCombineSwift/FirebaseCombineSwift.xcworkspace' \
  513. -scheme "FirebaseCombineSwift-Unit-integration" \
  514. "${ios_flags[@]}" \
  515. "${xcb_flags[@]}" \
  516. test
  517. fi
  518. ;;
  519. GoogleDataTransport-watchOS-xcodebuild)
  520. RunXcodebuild \
  521. -workspace 'GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestApp.xcworkspace' \
  522. -scheme "GDTWatchOSTestAppWatchKitApp" \
  523. "${xcb_flags[@]}" \
  524. build
  525. RunXcodebuild \
  526. -workspace 'GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSTestApp.xcworkspace' \
  527. -scheme "GDTCCTWatchOSIndependentTestAppWatchKitApp" \
  528. "${xcb_flags[@]}" \
  529. build
  530. RunXcodebuild \
  531. -workspace 'GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSTestApp.xcworkspace' \
  532. -scheme "GDTCCTWatchOSCompanionTestApp" \
  533. "${xcb_flags[@]}" \
  534. build
  535. ;;
  536. Performance-*-unit)
  537. # Run unit tests on prod environment with unswizzle capabilities.
  538. export FPR_UNSWIZZLE_AVAILABLE="1"
  539. export FPR_AUTOPUSH_ENV="0"
  540. pod_gen FirebasePerformance.podspec --platforms="${gen_platform}"
  541. RunXcodebuild \
  542. -workspace 'gen/FirebasePerformance/FirebasePerformance.xcworkspace' \
  543. -scheme "FirebasePerformance-Unit-unit" \
  544. "${xcb_flags[@]}" \
  545. build \
  546. test
  547. ;;
  548. Performance-*-proddev)
  549. # Build the prod dev test app.
  550. export FPR_UNSWIZZLE_AVAILABLE="0"
  551. export FPR_AUTOPUSH_ENV="0"
  552. pod_gen FirebasePerformance.podspec --platforms="${gen_platform}"
  553. RunXcodebuild \
  554. -workspace 'gen/FirebasePerformance/FirebasePerformance.xcworkspace' \
  555. -scheme "FirebasePerformance-TestApp" \
  556. "${xcb_flags[@]}" \
  557. build
  558. ;;
  559. Performance-*-integration)
  560. # Generate the workspace for the SDK to generate Protobuf files.
  561. export FPR_UNSWIZZLE_AVAILABLE="0"
  562. pod_gen FirebasePerformance.podspec --platforms=ios --clean
  563. # Perform "pod install" to install the relevant dependencies
  564. cd FirebasePerformance/Tests/FIRPerfE2E; pod install; cd -
  565. # Run E2E Integration Tests for Autopush.
  566. RunXcodebuild \
  567. -workspace 'FirebasePerformance/Tests/FIRPerfE2E/FIRPerfE2E.xcworkspace' \
  568. -scheme "FIRPerfE2EAutopush" \
  569. FPR_AUTOPUSH_ENV=1 \
  570. "${ios_flags[@]}" \
  571. "${xcb_flags[@]}" \
  572. build \
  573. test
  574. # Run E2E Integration Tests for Prod.
  575. RunXcodebuild \
  576. -workspace 'FirebasePerformance/Tests/FIRPerfE2E/FIRPerfE2E.xcworkspace' \
  577. -scheme "FIRPerfE2EProd" \
  578. "${ios_flags[@]}" \
  579. "${xcb_flags[@]}" \
  580. build \
  581. test
  582. ;;
  583. # Note that the combine tests require setting the minimum iOS and tvOS version to 13.0
  584. *-*-spm)
  585. RunXcodebuild \
  586. -scheme $product \
  587. "${xcb_flags[@]}" \
  588. IPHONEOS_DEPLOYMENT_TARGET=13.0 \
  589. TVOS_DEPLOYMENT_TARGET=13.0 \
  590. test
  591. ;;
  592. *-*-spmbuildonly)
  593. RunXcodebuild \
  594. -scheme $product \
  595. "${xcb_flags[@]}" \
  596. build
  597. ;;
  598. ClientApp-iOS-xcodebuild | ClientApp-iOS13-iOS-xcodebuild)
  599. RunXcodebuild \
  600. -project 'IntegrationTesting/ClientApp/ClientApp.xcodeproj' \
  601. -scheme $product \
  602. "${xcb_flags[@]}" \
  603. build
  604. ;;
  605. ClientApp-CocoaPods*-iOS-xcodebuild)
  606. RunXcodebuild \
  607. -workspace 'IntegrationTesting/ClientApp/ClientApp.xcworkspace' \
  608. -scheme $product \
  609. "${xcb_flags[@]}" \
  610. build
  611. ;;
  612. *)
  613. echo "Don't know how to build this product-platform-method combination" 1>&2
  614. echo " product=$product" 1>&2
  615. echo " platform=$platform" 1>&2
  616. echo " method=$method" 1>&2
  617. exit 1
  618. ;;
  619. esac