build.sh 19 KB

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