build.sh 21 KB

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