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