build.sh 20 KB

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