build.sh 20 KB

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