build.sh 20 KB

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