build.sh 18 KB

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