build.sh 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  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. source scripts/buildcache.sh
  201. xcb_flags=("${xcb_flags[@]}" "${buildcache_xcb_flags[@]}")
  202. # TODO(varconst): Add --warn-unused-vars and --warn-uninitialized.
  203. # Right now, it makes the log overflow on Travis because many of our
  204. # dependencies don't build cleanly this way.
  205. cmake_options=(
  206. -Wdeprecated
  207. -DCMAKE_BUILD_TYPE=Debug
  208. )
  209. if [[ -n "${SANITIZERS:-}" ]]; then
  210. for sanitizer in $SANITIZERS; do
  211. case "$sanitizer" in
  212. asan)
  213. xcb_flags+=(
  214. -enableAddressSanitizer YES
  215. )
  216. cmake_options+=(
  217. -DWITH_ASAN=ON
  218. )
  219. ;;
  220. tsan)
  221. xcb_flags+=(
  222. -enableThreadSanitizer YES
  223. )
  224. cmake_options+=(
  225. -DWITH_TSAN=ON
  226. )
  227. ;;
  228. ubsan)
  229. xcb_flags+=(
  230. -enableUndefinedBehaviorSanitizer YES
  231. )
  232. cmake_options+=(
  233. -DWITH_UBSAN=ON
  234. )
  235. ;;
  236. *)
  237. echo "Unknown sanitizer '$sanitizer'" 1>&2
  238. exit 1
  239. ;;
  240. esac
  241. done
  242. fi
  243. case "$product-$platform-$method" in
  244. FirebasePod-iOS-*)
  245. RunXcodebuild \
  246. -workspace 'CoreOnly/Tests/FirebasePodTest/FirebasePodTest.xcworkspace' \
  247. -scheme "FirebasePodTest" \
  248. "${xcb_flags[@]}" \
  249. build
  250. ;;
  251. Auth-*-xcodebuild)
  252. if check_secrets; then
  253. RunXcodebuild \
  254. -workspace 'FirebaseAuth/Tests/Sample/AuthSample.xcworkspace' \
  255. -scheme "Auth_ApiTests" \
  256. "${xcb_flags[@]}" \
  257. build \
  258. test
  259. RunXcodebuild \
  260. -workspace 'FirebaseAuth/Tests/Sample/AuthSample.xcworkspace' \
  261. -scheme "SwiftApiTests" \
  262. "${xcb_flags[@]}" \
  263. build \
  264. test
  265. fi
  266. ;;
  267. CombineSwift-*-xcodebuild)
  268. pod_gen FirebaseCombineSwift.podspec --platforms=ios
  269. RunXcodebuild \
  270. -workspace 'gen/FirebaseCombineSwift/FirebaseCombineSwift.xcworkspace' \
  271. -scheme "FirebaseCombineSwift-Unit-unit" \
  272. "${xcb_flags[@]}" \
  273. build \
  274. test
  275. ;;
  276. InAppMessaging-*-xcodebuild)
  277. RunXcodebuild \
  278. -workspace 'FirebaseInAppMessaging/Tests/Integration/DefaultUITestApp/InAppMessagingDisplay-Sample.xcworkspace' \
  279. -scheme 'FiamDisplaySwiftExample' \
  280. "${xcb_flags[@]}" \
  281. build \
  282. test
  283. ;;
  284. Firestore-*-xcodebuild)
  285. "${firestore_emulator}" start
  286. trap '"${firestore_emulator}" stop' ERR EXIT
  287. RunXcodebuild \
  288. -workspace 'Firestore/Example/Firestore.xcworkspace' \
  289. -scheme "Firestore_IntegrationTests_$platform" \
  290. -enableCodeCoverage YES \
  291. "${xcb_flags[@]}" \
  292. build \
  293. test
  294. ;;
  295. Firestore-macOS-cmake | Firestore-Linux-cmake)
  296. "${firestore_emulator}" start
  297. trap '"${firestore_emulator}" stop' ERR EXIT
  298. (
  299. test -d build || mkdir build
  300. cd build
  301. echo "Preparing cmake build ..."
  302. cmake -G Ninja "${cmake_options[@]}" ..
  303. echo "Building cmake build ..."
  304. ninja -k 10 all
  305. ctest --output-on-failure
  306. )
  307. ;;
  308. SymbolCollision-*-*)
  309. RunXcodebuild \
  310. -workspace 'SymbolCollisionTest/SymbolCollisionTest.xcworkspace' \
  311. -scheme "SymbolCollisionTest" \
  312. "${xcb_flags[@]}" \
  313. build
  314. ;;
  315. Messaging-*-xcodebuild)
  316. pod_gen FirebaseMessaging.podspec --platforms=ios
  317. # Add GoogleService-Info.plist to generated Test Wrapper App.
  318. ruby ./scripts/update_xcode_target.rb gen/FirebaseMessaging/Pods/Pods.xcodeproj \
  319. AppHost-FirebaseMessaging-Unit-Tests \
  320. ../../../FirebaseMessaging/Tests/IntegrationTests/Resources/GoogleService-Info.plist
  321. RunXcodebuild \
  322. -workspace 'gen/FirebaseMessaging/FirebaseMessaging.xcworkspace' \
  323. -scheme "FirebaseMessaging-Unit-unit" \
  324. "${ios_flags[@]}" \
  325. "${xcb_flags[@]}" \
  326. build \
  327. test
  328. if check_secrets; then
  329. # Integration tests are only run on iOS to minimize flake failures.
  330. RunXcodebuild \
  331. -workspace 'gen/FirebaseMessaging/FirebaseMessaging.xcworkspace' \
  332. -scheme "FirebaseMessaging-Unit-integration" \
  333. "${ios_flags[@]}" \
  334. "${xcb_flags[@]}" \
  335. build \
  336. test
  337. fi
  338. pod_gen FirebaseMessaging.podspec --platforms=macos --clean
  339. RunXcodebuild \
  340. -workspace 'gen/FirebaseMessaging/FirebaseMessaging.xcworkspace' \
  341. -scheme "FirebaseMessaging-Unit-unit" \
  342. "${macos_flags[@]}" \
  343. "${xcb_flags[@]}" \
  344. build \
  345. test
  346. pod_gen FirebaseMessaging.podspec --platforms=tvos --clean
  347. RunXcodebuild \
  348. -workspace 'gen/FirebaseMessaging/FirebaseMessaging.xcworkspace' \
  349. -scheme "FirebaseMessaging-Unit-unit" \
  350. "${tvos_flags[@]}" \
  351. "${xcb_flags[@]}" \
  352. build \
  353. test
  354. ;;
  355. MessagingSample-*-*)
  356. if check_secrets; then
  357. RunXcodebuild \
  358. -workspace 'FirebaseMessaging/Apps/Sample/Sample.xcworkspace' \
  359. -scheme "Sample" \
  360. "${xcb_flags[@]}" \
  361. build
  362. fi
  363. ;;
  364. MLModelDownloaderSample-*-*)
  365. if check_secrets; then
  366. RunXcodebuild \
  367. -workspace 'FirebaseMLModelDownloader/Apps/Sample/MLDownloaderTestApp.xcworkspace' \
  368. -scheme "MLDownloaderTestApp" \
  369. "${xcb_flags[@]}" \
  370. build
  371. fi
  372. ;;
  373. SegmentationSample-*-*)
  374. RunXcodebuild \
  375. -workspace 'FirebaseSegmentation/Tests/Sample/SegmentationSampleApp.xcworkspace' \
  376. -scheme "SegmentationSampleApp" \
  377. "${xcb_flags[@]}" \
  378. build
  379. ;;
  380. WatchOSSample-*-*)
  381. RunXcodebuild \
  382. -workspace 'Example/watchOSSample/SampleWatchApp.xcworkspace' \
  383. -scheme "SampleWatchAppWatchKitApp" \
  384. "${xcb_flags[@]}" \
  385. build
  386. ;;
  387. Database-*-unit)
  388. pod_gen FirebaseDatabase.podspec --platforms="${gen_platform}"
  389. RunXcodebuild \
  390. -workspace 'gen/FirebaseDatabase/FirebaseDatabase.xcworkspace' \
  391. -scheme "FirebaseDatabase-Unit-unit" \
  392. "${xcb_flags[@]}" \
  393. build \
  394. test
  395. ;;
  396. Database-*-integration)
  397. "${database_emulator}" start
  398. trap '"${database_emulator}" stop' ERR EXIT
  399. pod_gen FirebaseDatabase.podspec --platforms="${gen_platform}"
  400. RunXcodebuild \
  401. -workspace 'gen/FirebaseDatabase/FirebaseDatabase.xcworkspace' \
  402. -scheme "FirebaseDatabase-Unit-integration" \
  403. "${xcb_flags[@]}" \
  404. build \
  405. test
  406. ;;
  407. RemoteConfig-*-unit)
  408. pod_gen FirebaseRemoteConfig.podspec --platforms="${gen_platform}"
  409. RunXcodebuild \
  410. -workspace 'gen/FirebaseRemoteConfig/FirebaseRemoteConfig.xcworkspace' \
  411. -scheme "FirebaseRemoteConfig-Unit-unit" \
  412. "${xcb_flags[@]}" \
  413. build \
  414. test
  415. ;;
  416. RemoteConfig-*-fakeconsole)
  417. pod_gen FirebaseRemoteConfig.podspec --platforms="${gen_platform}"
  418. # Add GoogleService-Info.plist to generated Test Wrapper App.
  419. ruby ./scripts/update_xcode_target.rb gen/FirebaseRemoteConfig/Pods/Pods.xcodeproj \
  420. AppHost-FirebaseRemoteConfig-Unit-Tests \
  421. ../../../FirebaseRemoteConfig/Tests/FakeUtils/GoogleService-Info.plist
  422. RunXcodebuild \
  423. -workspace 'gen/FirebaseRemoteConfig/FirebaseRemoteConfig.xcworkspace' \
  424. -scheme "FirebaseRemoteConfig-Unit-fake-console-tests" \
  425. "${xcb_flags[@]}" \
  426. build \
  427. test
  428. ;;
  429. RemoteConfig-*-integration)
  430. pod_gen FirebaseRemoteConfig.podspec --platforms="${gen_platform}"
  431. # Add GoogleService-Info.plist to generated Test Wrapper App.
  432. ruby ./scripts/update_xcode_target.rb gen/FirebaseRemoteConfig/Pods/Pods.xcodeproj \
  433. AppHost-FirebaseRemoteConfig-Unit-Tests \
  434. ../../../FirebaseRemoteConfig/Tests/SwiftAPI/GoogleService-Info.plist
  435. # Add AccessToken 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/AccessToken.json
  439. RunXcodebuild \
  440. -workspace 'gen/FirebaseRemoteConfig/FirebaseRemoteConfig.xcworkspace' \
  441. -scheme "FirebaseRemoteConfig-Unit-swift-api-tests" \
  442. "${xcb_flags[@]}" \
  443. build \
  444. test
  445. ;;
  446. RemoteConfigSample-*-*)
  447. RunXcodebuild \
  448. -workspace 'FirebaseRemoteConfig/Tests/Sample/RemoteConfigSampleApp.xcworkspace' \
  449. -scheme "RemoteConfigSampleApp" \
  450. "${xcb_flags[@]}" \
  451. build
  452. ;;
  453. Storage-*-xcodebuild)
  454. pod_gen FirebaseStorage.podspec --platforms=ios
  455. # Add GoogleService-Info.plist to generated Test Wrapper App.
  456. ruby ./scripts/update_xcode_target.rb gen/FirebaseStorage/Pods/Pods.xcodeproj \
  457. AppHost-FirebaseStorage-Unit-Tests \
  458. ../../../FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist
  459. if check_secrets; then
  460. # Integration tests are only run on iOS to minimize flake failures.
  461. RunXcodebuild \
  462. -workspace 'gen/FirebaseStorage/FirebaseStorage.xcworkspace' \
  463. -scheme "FirebaseStorage-Unit-integration" \
  464. "${ios_flags[@]}" \
  465. "${xcb_flags[@]}" \
  466. build \
  467. test
  468. RunXcodebuild \
  469. -workspace 'gen/FirebaseStorage/FirebaseStorage.xcworkspace' \
  470. -scheme "FirebaseStorage-Unit-swift-integration" \
  471. "${ios_flags[@]}" \
  472. "${xcb_flags[@]}" \
  473. build \
  474. test
  475. fi
  476. ;;
  477. StorageSwift-*-xcodebuild)
  478. pod_gen FirebaseStorageSwift.podspec --platforms=ios
  479. # Add GoogleService-Info.plist to generated Test Wrapper App.
  480. ruby ./scripts/update_xcode_target.rb gen/FirebaseStorageSwift/Pods/Pods.xcodeproj \
  481. AppHost-FirebaseStorageSwift-Unit-Tests \
  482. ../../../FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist
  483. if check_secrets; then
  484. # Integration tests are only run on iOS to minimize flake failures.
  485. RunXcodebuild \
  486. -workspace 'gen/FirebaseStorageSwift/FirebaseStorageSwift.xcworkspace' \
  487. -scheme "FirebaseStorageSwift-Unit-integration" \
  488. "${ios_flags[@]}" \
  489. "${xcb_flags[@]}" \
  490. build \
  491. test
  492. fi
  493. ;;
  494. StorageCombine-*-xcodebuild)
  495. pod_gen FirebaseCombineSwift.podspec --platforms=ios
  496. # Add GoogleService-Info.plist to generated Test Wrapper App.
  497. ruby ./scripts/update_xcode_target.rb gen/FirebaseCombineSwift/Pods/Pods.xcodeproj \
  498. AppHost-FirebaseCombineSwift-Unit-Tests \
  499. ../../../FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist
  500. if check_secrets; then
  501. # Integration tests are only run on iOS to minimize flake failures.
  502. RunXcodebuild \
  503. -workspace 'gen/FirebaseCombineSwift/FirebaseCombineSwift.xcworkspace' \
  504. -scheme "FirebaseCombineSwift-Unit-integration" \
  505. "${ios_flags[@]}" \
  506. "${xcb_flags[@]}" \
  507. build \
  508. test
  509. fi
  510. ;;
  511. GoogleDataTransport-watchOS-xcodebuild)
  512. RunXcodebuild \
  513. -workspace 'GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestApp.xcworkspace' \
  514. -scheme "GDTWatchOSTestAppWatchKitApp" \
  515. "${xcb_flags[@]}" \
  516. build
  517. RunXcodebuild \
  518. -workspace 'GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSTestApp.xcworkspace' \
  519. -scheme "GDTCCTWatchOSIndependentTestAppWatchKitApp" \
  520. "${xcb_flags[@]}" \
  521. build
  522. RunXcodebuild \
  523. -workspace 'GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSTestApp.xcworkspace' \
  524. -scheme "GDTCCTWatchOSCompanionTestApp" \
  525. "${xcb_flags[@]}" \
  526. build
  527. ;;
  528. Performance-*-unit)
  529. # Run unit tests on prod environment with unswizzle capabilities.
  530. export FPR_UNSWIZZLE_AVAILABLE="1"
  531. export FPR_AUTOPUSH_ENV="0"
  532. pod_gen FirebasePerformance.podspec --platforms="${gen_platform}"
  533. RunXcodebuild \
  534. -workspace 'gen/FirebasePerformance/FirebasePerformance.xcworkspace' \
  535. -scheme "FirebasePerformance-Unit-unit" \
  536. "${xcb_flags[@]}" \
  537. build \
  538. test
  539. ;;
  540. Performance-*-proddev)
  541. # Build the prod dev test app.
  542. export FPR_UNSWIZZLE_AVAILABLE="0"
  543. export FPR_AUTOPUSH_ENV="0"
  544. pod_gen FirebasePerformance.podspec --platforms="${gen_platform}"
  545. RunXcodebuild \
  546. -workspace 'gen/FirebasePerformance/FirebasePerformance.xcworkspace' \
  547. -scheme "FirebasePerformance-TestApp" \
  548. "${xcb_flags[@]}" \
  549. build
  550. ;;
  551. Performance-*-integration)
  552. # Generate the workspace for the SDK to generate Protobuf files.
  553. export FPR_UNSWIZZLE_AVAILABLE="0"
  554. pod_gen FirebasePerformance.podspec --platforms=ios --clean
  555. # Perform "pod install" to install the relevant dependencies
  556. cd FirebasePerformance/Tests/FIRPerfE2E; pod install; cd -
  557. # Run E2E Integration Tests for Autopush.
  558. RunXcodebuild \
  559. -workspace 'FirebasePerformance/Tests/FIRPerfE2E/FIRPerfE2E.xcworkspace' \
  560. -scheme "FIRPerfE2EAutopush" \
  561. FPR_AUTOPUSH_ENV=1 \
  562. "${ios_flags[@]}" \
  563. "${xcb_flags[@]}" \
  564. build \
  565. test
  566. # Run E2E Integration Tests for Prod.
  567. RunXcodebuild \
  568. -workspace 'FirebasePerformance/Tests/FIRPerfE2E/FIRPerfE2E.xcworkspace' \
  569. -scheme "FIRPerfE2EProd" \
  570. "${ios_flags[@]}" \
  571. "${xcb_flags[@]}" \
  572. build \
  573. test
  574. ;;
  575. # Note that the combine tests require setting the minimum iOS and tvOS version to 13.0
  576. *-*-spm)
  577. RunXcodebuild \
  578. -scheme $product \
  579. "${xcb_flags[@]}" \
  580. IPHONEOS_DEPLOYMENT_TARGET=13.0 \
  581. TVOS_DEPLOYMENT_TARGET=13.0 \
  582. test
  583. ;;
  584. *-*-spmbuildonly)
  585. RunXcodebuild \
  586. -scheme $product \
  587. "${xcb_flags[@]}" \
  588. build
  589. ;;
  590. *)
  591. echo "Don't know how to build this product-platform-method combination" 1>&2
  592. echo " product=$product" 1>&2
  593. echo " platform=$platform" 1>&2
  594. echo " method=$method" 1>&2
  595. exit 1
  596. ;;
  597. esac