Package.swift 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643
  1. // swift-tools-version:6.0
  2. // The swift-tools-version declares the minimum version of Swift required to
  3. // build this package.
  4. // Copyright 2020 Google LLC
  5. //
  6. // Licensed under the Apache License, Version 2.0 (the "License");
  7. // you may not use this file except in compliance with the License.
  8. // You may obtain a copy of the License at
  9. //
  10. // http://www.apache.org/licenses/LICENSE-2.0
  11. //
  12. // Unless required by applicable law or agreed to in writing, software
  13. // distributed under the License is distributed on an "AS IS" BASIS,
  14. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. // See the License for the specific language governing permissions and
  16. // limitations under the License.
  17. import PackageDescription
  18. let firebaseVersion = "12.5.0"
  19. let package = Package(
  20. name: "Firebase",
  21. platforms: [.iOS(.v15), .macCatalyst(.v15), .macOS(.v10_15), .tvOS(.v15), .watchOS(.v7)],
  22. products: [
  23. .library(
  24. name: "FirebaseAI",
  25. targets: [
  26. "FirebaseAI",
  27. "FirebaseAILogic",
  28. ]
  29. ),
  30. .library(
  31. name: "FirebaseAILogic",
  32. targets: [
  33. "FirebaseAILogic",
  34. ]
  35. ),
  36. .library(
  37. name: "FirebaseAnalytics",
  38. targets: ["FirebaseAnalyticsTarget"]
  39. ),
  40. // Adding this library to your project is enough for it to take effect. The module
  41. // does not need to be imported into any source files.
  42. .library(
  43. name: "FirebaseAnalyticsCore",
  44. targets: ["FirebaseAnalyticsCoreTarget"]
  45. ),
  46. // Adding this library to your project is enough for it to take effect. The module
  47. // does not need to be imported into any source files.
  48. .library(
  49. name: "FirebaseAnalyticsIdentitySupport",
  50. targets: ["FirebaseAnalyticsIdentitySupportTarget"]
  51. ),
  52. .library(
  53. name: "FirebaseAuth",
  54. targets: ["FirebaseAuth"]
  55. ),
  56. .library(
  57. name: "FirebaseAppCheck",
  58. targets: ["FirebaseAppCheck"]
  59. ),
  60. .library(
  61. name: "FirebaseAppDistribution-Beta",
  62. targets: ["FirebaseAppDistributionTarget"]
  63. ),
  64. .library(
  65. name: "FirebaseAuthCombine-Community",
  66. targets: ["FirebaseAuthCombineSwift"]
  67. ),
  68. .library(
  69. name: "FirebaseFirestoreCombine-Community",
  70. targets: ["FirebaseFirestoreCombineSwift"]
  71. ),
  72. .library(
  73. name: "FirebaseFunctionsCombine-Community",
  74. targets: ["FirebaseFunctionsCombineSwift"]
  75. ),
  76. .library(
  77. name: "FirebaseStorageCombine-Community",
  78. targets: ["FirebaseStorageCombineSwift"]
  79. ),
  80. .library(
  81. name: "FirebaseCore",
  82. targets: ["FirebaseCore"]
  83. ),
  84. .library(
  85. name: "FirebaseCrashlytics",
  86. targets: ["FirebaseCrashlytics"]
  87. ),
  88. .library(
  89. name: "FirebaseDatabase",
  90. targets: ["FirebaseDatabase"]
  91. ),
  92. .library(
  93. name: "FirebaseFirestore",
  94. targets: ["FirebaseFirestoreTarget"]
  95. ),
  96. .library(
  97. name: "FirebaseFunctions",
  98. targets: ["FirebaseFunctions"]
  99. ),
  100. .library(
  101. name: "FirebaseInAppMessaging-Beta",
  102. targets: ["FirebaseInAppMessagingTarget"]
  103. ),
  104. .library(
  105. name: "FirebaseInstallations",
  106. targets: ["FirebaseInstallations"]
  107. ),
  108. .library(
  109. name: "FirebaseMessaging",
  110. targets: ["FirebaseMessaging"]
  111. ),
  112. .library(
  113. name: "FirebaseMLModelDownloader",
  114. targets: ["FirebaseMLModelDownloader"]
  115. ),
  116. .library(
  117. name: "FirebasePerformance",
  118. targets: ["FirebasePerformanceTarget"]
  119. ),
  120. .library(
  121. name: "FirebaseRemoteConfig",
  122. targets: ["FirebaseRemoteConfig"]
  123. ),
  124. .library(
  125. name: "FirebaseStorage",
  126. targets: ["FirebaseStorage"]
  127. ),
  128. ],
  129. dependencies: [
  130. .package(
  131. url: "https://github.com/google/promises.git",
  132. "2.4.0" ..< "3.0.0"
  133. ),
  134. .package(
  135. url: "https://github.com/apple/swift-protobuf.git",
  136. "1.19.0" ..< "2.0.0"
  137. ),
  138. googleAppMeasurementDependency(),
  139. .package(
  140. url: "https://github.com/google/GoogleDataTransport.git",
  141. "10.1.0" ..< "11.0.0"
  142. ),
  143. .package(
  144. url: "https://github.com/google/GoogleUtilities.git",
  145. "8.1.0" ..< "9.0.0"
  146. ),
  147. .package(
  148. url: "https://github.com/google/gtm-session-fetcher.git",
  149. "3.4.1" ..< "6.0.0"
  150. ),
  151. .package(
  152. url: "https://github.com/firebase/nanopb.git",
  153. "2.30910.0" ..< "2.30911.0"
  154. ),
  155. abseilDependency(),
  156. grpcDependency(),
  157. .package(
  158. url: "https://github.com/erikdoe/ocmock.git",
  159. revision: "2c0bfd373289f4a7716db5d6db471640f91a6507"
  160. ),
  161. .package(
  162. url: "https://github.com/firebase/leveldb.git",
  163. "1.22.2" ..< "1.23.0"
  164. ),
  165. .package(
  166. url: "https://github.com/SlaunchaMan/GCDWebServer.git",
  167. revision: "935e2736044e71e5341663c3cc9a335ba6867a2b"
  168. ),
  169. .package(
  170. url: "https://github.com/google/interop-ios-for-google-sdks.git",
  171. "101.0.0" ..< "102.0.0"
  172. ),
  173. .package(url: "https://github.com/google/app-check.git",
  174. "11.0.1" ..< "12.0.0"),
  175. ],
  176. targets: [
  177. .target(
  178. name: "Firebase",
  179. path: "CoreOnly/Sources",
  180. publicHeadersPath: "./"
  181. ),
  182. // MARK: - Firebase AI
  183. .target(
  184. name: "FirebaseAILogic",
  185. dependencies: [
  186. "FirebaseAppCheckInterop",
  187. "FirebaseAuthInterop",
  188. "FirebaseCore",
  189. "FirebaseCoreExtension",
  190. ],
  191. path: "FirebaseAI/Sources"
  192. ),
  193. .testTarget(
  194. name: "FirebaseAILogicUnit",
  195. dependencies: [
  196. "FirebaseAILogic",
  197. "FirebaseStorage",
  198. ],
  199. path: "FirebaseAI/Tests/Unit",
  200. resources: [
  201. .copy("vertexai-sdk-test-data/mock-responses"),
  202. .process("Resources"),
  203. ],
  204. cSettings: [
  205. .headerSearchPath("../../../"),
  206. ]
  207. ),
  208. .target(
  209. name: "FirebaseAI",
  210. dependencies: ["FirebaseAILogic"],
  211. path: "FirebaseAI/Wrapper/Sources"
  212. ),
  213. .testTarget(
  214. name: "FirebaseAIUnit",
  215. dependencies: ["FirebaseAI"],
  216. path: "FirebaseAI/Wrapper/Tests"
  217. ),
  218. // MARK: - Firebase Core
  219. .target(
  220. name: "FirebaseCore",
  221. dependencies: [
  222. "Firebase",
  223. "FirebaseCoreInternal",
  224. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  225. .product(name: "GULLogger", package: "GoogleUtilities"),
  226. ],
  227. path: "FirebaseCore/Sources",
  228. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  229. publicHeadersPath: "Public",
  230. cSettings: [
  231. .headerSearchPath("../.."),
  232. .define("Firebase_VERSION", to: firebaseVersion),
  233. // TODO: - Add support for cflags cSetting so that we can set the -fno-autolink option
  234. ],
  235. linkerSettings: [
  236. .linkedFramework("UIKit", .when(platforms: [.iOS, .macCatalyst, .tvOS])),
  237. .linkedFramework("AppKit", .when(platforms: [.macOS])),
  238. ]
  239. ),
  240. .testTarget(
  241. name: "CoreUnit",
  242. dependencies: [
  243. "FirebaseCore",
  244. "SharedTestUtilities",
  245. .product(name: "OCMock", package: "ocmock"),
  246. ],
  247. path: "FirebaseCore/Tests/Unit",
  248. exclude: ["Resources/GoogleService-Info.plist"],
  249. cSettings: [
  250. .headerSearchPath("../../.."),
  251. ]
  252. ),
  253. // MARK: - Firebase Core Extension
  254. // Extension of FirebaseCore for consuming by Swift product SDKs.
  255. // When depending on `FirebaseCoreExtension`, also depend on `FirebaseCore`
  256. // to avoid potential linker issues.
  257. .target(
  258. name: "FirebaseCoreExtension",
  259. path: "FirebaseCore/Extension",
  260. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  261. publicHeadersPath: ".",
  262. cSettings: [
  263. .headerSearchPath("../../"),
  264. ]
  265. ),
  266. // MARK: - Firebase Core Internal
  267. // Shared collection of APIs for internal FirebaseCore usage.
  268. .target(
  269. name: "FirebaseCoreInternal",
  270. dependencies: [
  271. .product(name: "GULNSData", package: "GoogleUtilities"),
  272. ],
  273. path: "FirebaseCore/Internal/Sources",
  274. resources: [.process("Resources/PrivacyInfo.xcprivacy")]
  275. ),
  276. .testTarget(
  277. name: "FirebaseCoreInternalTests",
  278. dependencies: [
  279. "FirebaseCoreInternal",
  280. ],
  281. path: "FirebaseCore/Internal/Tests"
  282. ),
  283. .target(
  284. name: "FirebaseABTesting",
  285. dependencies: ["FirebaseCore"],
  286. path: "FirebaseABTesting/Sources",
  287. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  288. publicHeadersPath: "Public",
  289. cSettings: [
  290. .headerSearchPath("../../"),
  291. ]
  292. ),
  293. .testTarget(
  294. name: "ABTestingUnit",
  295. dependencies: ["FirebaseABTesting", .product(name: "OCMock", package: "ocmock")],
  296. path: "FirebaseABTesting/Tests/Unit",
  297. resources: [.process("Resources")],
  298. cSettings: [
  299. .headerSearchPath("../../.."),
  300. ]
  301. ),
  302. .target(
  303. name: "FirebaseAnalyticsTarget",
  304. dependencies: [.target(name: "FirebaseAnalyticsWrapper",
  305. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS]))],
  306. path: "SwiftPM-PlatformExclude/FirebaseAnalyticsWrap"
  307. ),
  308. .target(
  309. name: "FirebaseAnalyticsWrapper",
  310. dependencies: [
  311. .target(
  312. name: "FirebaseAnalytics",
  313. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  314. ),
  315. .product(name: "GoogleAppMeasurement",
  316. package: "GoogleAppMeasurement",
  317. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])),
  318. "FirebaseCore",
  319. "FirebaseInstallations",
  320. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  321. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  322. .product(name: "GULNSData", package: "GoogleUtilities"),
  323. .product(name: "GULNetwork", package: "GoogleUtilities"),
  324. .product(name: "nanopb", package: "nanopb"),
  325. ],
  326. path: "FirebaseAnalyticsWrapper",
  327. linkerSettings: [
  328. .linkedLibrary("sqlite3"),
  329. .linkedLibrary("c++"),
  330. .linkedLibrary("z"),
  331. .linkedFramework("StoreKit"),
  332. ]
  333. ),
  334. .binaryTarget(
  335. name: "FirebaseAnalytics",
  336. url: "https://dl.google.com/firebase/ios/swiftpm/12.4.0/FirebaseAnalytics.zip",
  337. checksum: "625b4853a02b312eeb857cb6578b109d42459c65021115f864414141ff32a117"
  338. ),
  339. .testTarget(
  340. name: "AnalyticsSwiftUnit",
  341. dependencies: ["FirebaseAnalyticsTarget"],
  342. path: "FirebaseAnalytics/Tests/SwiftUnit"
  343. ),
  344. .testTarget(
  345. name: "AnalyticsObjCAPI",
  346. dependencies: ["FirebaseAnalyticsTarget"],
  347. path: "FirebaseAnalytics/Tests/ObjCAPI"
  348. ),
  349. .target(
  350. name: "FirebaseAnalyticsCoreTarget",
  351. dependencies: [.target(name: "FirebaseAnalyticsCoreWrapper",
  352. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS]))],
  353. path: "SwiftPM-PlatformExclude/FirebaseAnalyticsCoreWrap"
  354. ),
  355. .target(
  356. name: "FirebaseAnalyticsCoreWrapper",
  357. dependencies: [
  358. .target(
  359. name: "FirebaseAnalytics",
  360. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  361. ),
  362. .product(name: "GoogleAppMeasurementCore",
  363. package: "GoogleAppMeasurement",
  364. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])),
  365. "FirebaseCore",
  366. "FirebaseInstallations",
  367. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  368. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  369. .product(name: "GULNSData", package: "GoogleUtilities"),
  370. .product(name: "GULNetwork", package: "GoogleUtilities"),
  371. .product(name: "nanopb", package: "nanopb"),
  372. ],
  373. path: "FirebaseAnalyticsCoreWrapper",
  374. linkerSettings: [
  375. .linkedLibrary("sqlite3"),
  376. .linkedLibrary("c++"),
  377. .linkedLibrary("z"),
  378. .linkedFramework("StoreKit"),
  379. ]
  380. ),
  381. .target(
  382. name: "FirebaseAnalyticsIdentitySupportTarget",
  383. dependencies: [
  384. .target(
  385. name: "FirebaseAnalytics",
  386. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  387. ),
  388. .product(name: "GoogleAppMeasurementIdentitySupport",
  389. package: "GoogleAppMeasurement",
  390. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])),
  391. "FirebaseCore",
  392. "FirebaseInstallations",
  393. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  394. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  395. .product(name: "GULNSData", package: "GoogleUtilities"),
  396. .product(name: "GULNetwork", package: "GoogleUtilities"),
  397. .product(name: "nanopb", package: "nanopb"),
  398. ],
  399. path: "FirebaseAnalyticsIdentitySupportWrapper",
  400. linkerSettings: [
  401. .linkedLibrary("sqlite3"),
  402. .linkedLibrary("c++"),
  403. .linkedLibrary("z"),
  404. .linkedFramework("StoreKit"),
  405. ]
  406. ),
  407. .target(
  408. name: "FirebaseAppDistributionTarget",
  409. dependencies: [.target(name: "FirebaseAppDistribution",
  410. condition: .when(platforms: [.iOS]))],
  411. path: "SwiftPM-PlatformExclude/FirebaseAppDistributionWrap"
  412. ),
  413. .target(
  414. name: "FirebaseAppDistribution",
  415. dependencies: [
  416. "FirebaseCore",
  417. "FirebaseInstallations",
  418. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  419. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  420. ],
  421. path: "FirebaseAppDistribution/Sources",
  422. publicHeadersPath: "Public",
  423. cSettings: [
  424. .headerSearchPath("../../"),
  425. ]
  426. ),
  427. .testTarget(
  428. name: "AppDistributionUnit",
  429. dependencies: ["FirebaseAppDistribution", .product(name: "OCMock", package: "ocmock")],
  430. path: "FirebaseAppDistribution/Tests/Unit",
  431. exclude: ["Swift/"],
  432. resources: [.process("Resources")],
  433. cSettings: [
  434. .headerSearchPath("../../.."),
  435. ]
  436. ),
  437. .testTarget(
  438. name: "AppDistributionUnitSwift",
  439. dependencies: ["FirebaseAppDistribution"],
  440. path: "FirebaseAppDistribution/Tests/Unit/Swift",
  441. cSettings: [
  442. .headerSearchPath("../../../.."),
  443. ],
  444. swiftSettings: [
  445. .swiftLanguageMode(SwiftLanguageMode.v5),
  446. ]
  447. ),
  448. .target(
  449. name: "FirebaseAuth",
  450. dependencies: [
  451. "FirebaseAppCheckInterop",
  452. "FirebaseAuthInterop",
  453. "FirebaseAuthInternal",
  454. "FirebaseCore",
  455. "FirebaseCoreExtension",
  456. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  457. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  458. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  459. ],
  460. path: "FirebaseAuth/Sources",
  461. exclude: [
  462. "ObjC", "Public",
  463. ],
  464. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  465. swiftSettings: [
  466. .swiftLanguageMode(SwiftLanguageMode.v5),
  467. ],
  468. linkerSettings: [
  469. .linkedFramework("Security"),
  470. .linkedFramework("SafariServices", .when(platforms: [.iOS])),
  471. ]
  472. ),
  473. .target(
  474. name: "FirebaseAuthInternal",
  475. dependencies: [
  476. .product(name: "RecaptchaInterop", package: "interop-ios-for-google-sdks"),
  477. ],
  478. path: "FirebaseAuth/Sources",
  479. exclude: [
  480. "Swift", "Resources",
  481. ],
  482. publicHeadersPath: "Public",
  483. cSettings: [
  484. .headerSearchPath("../../"),
  485. ]
  486. ),
  487. // Internal headers only for consuming from Swift.
  488. .target(
  489. name: "FirebaseAuthInterop",
  490. path: "FirebaseAuth/Interop",
  491. exclude: [
  492. "CMakeLists.txt",
  493. ],
  494. publicHeadersPath: "Public",
  495. cSettings: [
  496. .headerSearchPath("../../"),
  497. ]
  498. ),
  499. .testTarget(
  500. name: "AuthUnit",
  501. dependencies: [
  502. "FirebaseAuth",
  503. ],
  504. path: "FirebaseAuth/Tests/Unit",
  505. exclude: [
  506. // TODO: these tests rely on a non-zero UIApplication.shared. They run from CocoaPods.
  507. "PhoneAuthProviderTests.swift",
  508. "AuthNotificationManagerTests.swift",
  509. // TODO: The following tests run in CocoaPods only, until mixed language or separate target.
  510. "ObjCAPITests.m",
  511. "ObjCGlobalTests.m",
  512. "FIROAuthProviderTests.m",
  513. ],
  514. swiftSettings: [
  515. .swiftLanguageMode(SwiftLanguageMode.v5),
  516. ]
  517. ),
  518. .target(
  519. name: "FirebaseAuthCombineSwift",
  520. dependencies: ["FirebaseAuth"],
  521. path: "FirebaseCombineSwift/Sources/Auth",
  522. swiftSettings: [
  523. .swiftLanguageMode(SwiftLanguageMode.v5),
  524. ]
  525. ),
  526. .target(
  527. name: "FirebaseFirestoreCombineSwift",
  528. dependencies: [
  529. "FirebaseFirestoreTarget",
  530. ],
  531. path: "FirebaseCombineSwift/Sources/Firestore"
  532. ),
  533. .target(
  534. name: "FirebaseStorageCombineSwift",
  535. dependencies: [
  536. "FirebaseStorage",
  537. ],
  538. path: "FirebaseCombineSwift/Sources/Storage"
  539. ),
  540. .target(
  541. name: "FirebaseCrashlytics",
  542. dependencies: [
  543. "FirebaseCore",
  544. "FirebaseInstallations",
  545. "FirebaseSessions",
  546. "FirebaseRemoteConfigInterop",
  547. "FirebaseCrashlyticsSwift",
  548. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  549. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  550. .product(name: "FBLPromises", package: "Promises"),
  551. .product(name: "nanopb", package: "nanopb"),
  552. ],
  553. path: "Crashlytics",
  554. exclude: [
  555. "run",
  556. "CHANGELOG.md",
  557. "LICENSE",
  558. "README.md",
  559. "ProtoSupport/",
  560. "UnitTests/",
  561. "generate_project.sh",
  562. "upload-symbols",
  563. "CrashlyticsInputFiles.xcfilelist",
  564. "third_party/libunwind/LICENSE",
  565. "Crashlytics/Rollouts/",
  566. "Crashlytics/Entitlements/",
  567. ],
  568. sources: [
  569. "Crashlytics/",
  570. "Protogen/",
  571. "Shared/",
  572. "third_party/libunwind/dwarf.h",
  573. ],
  574. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  575. publicHeadersPath: "Crashlytics/Public",
  576. cSettings: [
  577. .headerSearchPath(".."),
  578. .define("DISPLAY_VERSION", to: firebaseVersion),
  579. .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])),
  580. .define(
  581. "CLS_SDK_NAME",
  582. to: "Crashlytics macOS SDK",
  583. .when(platforms: [.macOS, .macCatalyst])
  584. ),
  585. .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])),
  586. .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])),
  587. .define("PB_FIELD_32BIT", to: "1"),
  588. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  589. .define("PB_ENABLE_MALLOC", to: "1"),
  590. ],
  591. linkerSettings: [
  592. .linkedFramework("Security"),
  593. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  594. ]
  595. ),
  596. .target(
  597. name: "FirebaseCrashlyticsSwift",
  598. dependencies: ["FirebaseRemoteConfigInterop"],
  599. path: "Crashlytics",
  600. sources: [
  601. "Crashlytics/Rollouts/",
  602. "Crashlytics/Entitlements/",
  603. ]
  604. ),
  605. .testTarget(
  606. name: "FirebaseCrashlyticsSwiftUnit",
  607. dependencies: ["FirebaseCrashlyticsSwift"],
  608. path: "Crashlytics/UnitTestsSwift/",
  609. swiftSettings: [
  610. .swiftLanguageMode(SwiftLanguageMode.v5),
  611. ]
  612. ),
  613. .testTarget(
  614. name: "FirebaseCrashlyticsUnit",
  615. dependencies: ["FirebaseCrashlytics", .product(name: "OCMock", package: "ocmock")],
  616. path: "Crashlytics/UnitTests",
  617. resources: [
  618. .copy("FIRCLSMachO/machO_data"),
  619. .copy("Data"),
  620. ],
  621. cSettings: [
  622. .headerSearchPath("../.."),
  623. .define("DISPLAY_VERSION", to: firebaseVersion),
  624. .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])),
  625. .define(
  626. "CLS_SDK_NAME",
  627. to: "Crashlytics macOS SDK",
  628. .when(platforms: [.macOS, .macCatalyst])
  629. ),
  630. .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])),
  631. .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])),
  632. ]
  633. ),
  634. .target(
  635. name: "FirebaseDatabaseInternal",
  636. dependencies: [
  637. "FirebaseAppCheckInterop",
  638. "FirebaseCore",
  639. "leveldb",
  640. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  641. ],
  642. path: "FirebaseDatabase/Sources",
  643. exclude: [
  644. "third_party/Wrap-leveldb/LICENSE",
  645. "third_party/SocketRocket/LICENSE",
  646. "third_party/FImmutableSortedDictionary/LICENSE",
  647. "third_party/SocketRocket/aa2297808c225710e267afece4439c256f6efdb3",
  648. ],
  649. publicHeadersPath: "Public",
  650. cSettings: [
  651. .headerSearchPath("../../"),
  652. ],
  653. linkerSettings: [
  654. .linkedFramework("CFNetwork"),
  655. .linkedFramework("Security"),
  656. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  657. .linkedFramework("WatchKit", .when(platforms: [.watchOS])),
  658. ]
  659. ),
  660. .testTarget(
  661. name: "DatabaseUnit",
  662. dependencies: [
  663. "FirebaseDatabase",
  664. "SharedTestUtilities",
  665. .product(name: "OCMock", package: "ocmock"),
  666. ],
  667. path: "FirebaseDatabase/Tests/",
  668. exclude: [
  669. // Disable Swift tests as mixed targets are not supported (Xcode 12.4).
  670. "Unit/Swift",
  671. "Integration/",
  672. ],
  673. resources: [.process("Resources")],
  674. cSettings: [
  675. .headerSearchPath("../.."),
  676. ],
  677. swiftSettings: [
  678. .swiftLanguageMode(SwiftLanguageMode.v5),
  679. ]
  680. ),
  681. .testTarget(
  682. name: "DatabaseUnitSwift",
  683. dependencies: ["FirebaseDatabase"],
  684. path: "FirebaseDatabase/Tests/Unit/Swift",
  685. cSettings: [
  686. .headerSearchPath("../.."),
  687. ],
  688. swiftSettings: [
  689. .swiftLanguageMode(SwiftLanguageMode.v5),
  690. ]
  691. ),
  692. .target(
  693. name: "FirebaseDatabase",
  694. dependencies: ["FirebaseDatabaseInternal", "FirebaseSharedSwift"],
  695. path: "FirebaseDatabase/Swift/Sources"
  696. ),
  697. .target(
  698. name: "FirebaseSharedSwift",
  699. path: "FirebaseSharedSwift/Sources",
  700. exclude: [
  701. "third_party/FirebaseDataEncoder/LICENSE",
  702. "third_party/FirebaseDataEncoder/METADATA",
  703. ],
  704. // TODO(ncooke3): Can this be upgraded to Swift 6?
  705. swiftSettings: [
  706. .swiftLanguageMode(SwiftLanguageMode.v5),
  707. ]
  708. ),
  709. .testTarget(
  710. name: "FirebaseSharedSwiftTests",
  711. dependencies: ["FirebaseSharedSwift"],
  712. path: "FirebaseSharedSwift/Tests/"
  713. ),
  714. firestoreWrapperTarget(),
  715. // MARK: - Firebase Functions
  716. .target(
  717. name: "FirebaseFunctions",
  718. dependencies: [
  719. "FirebaseAppCheckInterop",
  720. "FirebaseAuthInterop",
  721. "FirebaseCore",
  722. "FirebaseCoreExtension",
  723. "FirebaseMessagingInterop",
  724. "FirebaseSharedSwift",
  725. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  726. ],
  727. path: "FirebaseFunctions/Sources"
  728. ),
  729. .testTarget(
  730. name: "FirebaseFunctionsUnit",
  731. dependencies: ["FirebaseFunctions",
  732. "FirebaseAppCheckInterop",
  733. "FirebaseAuthInterop",
  734. "FirebaseMessagingInterop",
  735. "SharedTestUtilities"],
  736. path: "FirebaseFunctions/Tests/Unit",
  737. cSettings: [
  738. .headerSearchPath("../../../"),
  739. ],
  740. swiftSettings: [
  741. .swiftLanguageMode(SwiftLanguageMode.v5),
  742. ]
  743. ),
  744. .testTarget(
  745. name: "FirebaseFunctionsIntegration",
  746. dependencies: ["FirebaseFunctions",
  747. "SharedTestUtilities"],
  748. path: "FirebaseFunctions/Tests/Integration"
  749. ),
  750. .testTarget(
  751. name: "FirebaseFunctionsObjCIntegration",
  752. dependencies: ["FirebaseFunctions",
  753. "SharedTestUtilities"],
  754. path: "FirebaseFunctions/Tests/ObjCIntegration",
  755. // See https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730
  756. exclude: [
  757. "ObjCPPAPITests.mm",
  758. ],
  759. cSettings: [
  760. .headerSearchPath("../../.."),
  761. ]
  762. ),
  763. .target(
  764. name: "FirebaseFunctionsCombineSwift",
  765. dependencies: ["FirebaseFunctions"],
  766. path: "FirebaseCombineSwift/Sources/Functions",
  767. swiftSettings: [
  768. .swiftLanguageMode(SwiftLanguageMode.v5),
  769. ]
  770. ),
  771. .testTarget(
  772. name: "FunctionsCombineUnit",
  773. dependencies: ["FirebaseFunctionsCombineSwift",
  774. "SharedTestUtilities"],
  775. path: "FirebaseFunctions/Tests/CombineUnit"
  776. ),
  777. // MARK: - Firebase In App Messaging
  778. .target(
  779. name: "FirebaseInAppMessagingTarget",
  780. dependencies: [
  781. .target(name: "FirebaseInAppMessaging", condition: .when(platforms: [.iOS, .tvOS])),
  782. ],
  783. path: "SwiftPM-PlatformExclude/FirebaseInAppMessagingWrap"
  784. ),
  785. .target(
  786. name: "FirebaseInAppMessagingInternal",
  787. dependencies: [
  788. "FirebaseCore",
  789. "FirebaseInstallations",
  790. "FirebaseABTesting",
  791. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  792. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  793. .product(name: "nanopb", package: "nanopb"),
  794. .target(name: "FirebaseInAppMessaging_iOS", condition: .when(platforms: [.iOS])),
  795. ],
  796. path: "FirebaseInAppMessaging/Sources",
  797. exclude: [
  798. "DefaultUI/CHANGELOG.md",
  799. "DefaultUI/README.md",
  800. ],
  801. publicHeadersPath: "Public",
  802. cSettings: [
  803. .headerSearchPath("../../"),
  804. .define("PB_FIELD_32BIT", to: "1"),
  805. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  806. .define("PB_ENABLE_MALLOC", to: "1"),
  807. ]
  808. ),
  809. .target(
  810. name: "FirebaseInAppMessaging_iOS",
  811. path: "FirebaseInAppMessaging/iOS",
  812. resources: [.process("Resources")]
  813. ),
  814. .target(
  815. name: "FirebaseInAppMessaging",
  816. dependencies: ["FirebaseInAppMessagingInternal"],
  817. path: "FirebaseInAppMessaging/Swift/Source",
  818. swiftSettings: [
  819. .swiftLanguageMode(SwiftLanguageMode.v5),
  820. ]
  821. ),
  822. .target(
  823. name: "FirebaseInstallations",
  824. dependencies: [
  825. "FirebaseCore",
  826. .product(name: "FBLPromises", package: "Promises"),
  827. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  828. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  829. ],
  830. path: "FirebaseInstallations/Source/Library",
  831. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  832. publicHeadersPath: "Public",
  833. cSettings: [
  834. .headerSearchPath("../../../"),
  835. ],
  836. linkerSettings: [
  837. .linkedFramework("Security"),
  838. ]
  839. ),
  840. .target(
  841. name: "FirebaseMLModelDownloader",
  842. dependencies: [
  843. "FirebaseCore",
  844. "FirebaseCoreExtension",
  845. "FirebaseInstallations",
  846. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  847. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  848. .product(name: "SwiftProtobuf", package: "swift-protobuf"),
  849. ],
  850. path: "FirebaseMLModelDownloader/Sources",
  851. exclude: [
  852. "proto/firebase_ml_log_sdk.proto",
  853. ],
  854. cSettings: [
  855. .define("FIRMLModelDownloader_VERSION", to: firebaseVersion),
  856. ],
  857. swiftSettings: [
  858. .swiftLanguageMode(SwiftLanguageMode.v5),
  859. ]
  860. ),
  861. .testTarget(
  862. name: "FirebaseMLModelDownloaderUnit",
  863. dependencies: ["FirebaseMLModelDownloader"],
  864. path: "FirebaseMLModelDownloader/Tests/Unit"
  865. ),
  866. .target(
  867. name: "FirebaseMessaging",
  868. dependencies: [
  869. "FirebaseCore",
  870. "FirebaseInstallations",
  871. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  872. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  873. .product(name: "GULReachability", package: "GoogleUtilities"),
  874. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  875. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  876. .product(name: "nanopb", package: "nanopb"),
  877. ],
  878. path: "FirebaseMessaging/Sources",
  879. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  880. publicHeadersPath: "Public",
  881. cSettings: [
  882. .headerSearchPath("../../"),
  883. .define("PB_FIELD_32BIT", to: "1"),
  884. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  885. .define("PB_ENABLE_MALLOC", to: "1"),
  886. ],
  887. linkerSettings: [
  888. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  889. ]
  890. ),
  891. // Internal headers only for consuming from Swift.
  892. .target(
  893. name: "FirebaseMessagingInterop",
  894. path: "FirebaseMessaging/Interop",
  895. publicHeadersPath: ".",
  896. cSettings: [
  897. .headerSearchPath("../../"),
  898. ]
  899. ),
  900. .testTarget(
  901. name: "MessagingUnit",
  902. dependencies: [
  903. "FirebaseMessaging",
  904. "SharedTestUtilities",
  905. .product(name: "OCMock", package: "ocmock"),
  906. ],
  907. path: "FirebaseMessaging/Tests/UnitTests",
  908. exclude: [
  909. "FIRMessagingContextManagerServiceTest.m", // TODO: Adapt its NSBundle usage to SPM.
  910. ],
  911. cSettings: [
  912. .headerSearchPath("../../.."),
  913. ]
  914. ),
  915. .target(
  916. name: "FirebasePerformanceTarget",
  917. dependencies: [.target(name: "FirebasePerformance",
  918. condition: .when(platforms: [.iOS, .tvOS, .visionOS]))],
  919. path: "SwiftPM-PlatformExclude/FirebasePerformanceWrap"
  920. ),
  921. .target(
  922. name: "FirebasePerformance",
  923. dependencies: [
  924. "FirebaseCore",
  925. "FirebaseInstallations",
  926. // Performance depends on the Obj-C target of FirebaseRemoteConfig to
  927. // avoid including Swift code from the `FirebaseRemoteConfig` target
  928. // that is unneeded.
  929. "FirebaseRemoteConfigInternal",
  930. "FirebaseSessions",
  931. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  932. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  933. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  934. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  935. .product(name: "nanopb", package: "nanopb"),
  936. ],
  937. path: "FirebasePerformance/Sources",
  938. publicHeadersPath: "Public",
  939. cSettings: [
  940. .headerSearchPath("../../"),
  941. .define("PB_FIELD_32BIT", to: "1"),
  942. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  943. .define("PB_ENABLE_MALLOC", to: "1"),
  944. .define("FIRPerformance_LIB_VERSION", to: firebaseVersion),
  945. ],
  946. linkerSettings: [
  947. .linkedFramework("MobileCoreServices", .when(platforms: [.iOS, .tvOS])),
  948. .linkedFramework("QuartzCore", .when(platforms: [.iOS, .tvOS])),
  949. ]
  950. ),
  951. .testTarget(
  952. name: "PerformanceUnit",
  953. dependencies: [
  954. "FirebasePerformanceTarget",
  955. "SharedTestUtilities",
  956. "GCDWebServer",
  957. .product(name: "OCMock", package: "ocmock"),
  958. ],
  959. path: "FirebasePerformance/Tests/Unit",
  960. resources: [
  961. .process("FPRURLFilterTests-Info.plist"),
  962. .process("Server/smallDownloadFile"),
  963. .process("Server/bigDownloadFile"),
  964. ],
  965. cSettings: [
  966. .headerSearchPath("../../.."),
  967. .define("PB_FIELD_32BIT", to: "1"),
  968. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  969. .define("PB_ENABLE_MALLOC", to: "1"),
  970. ]
  971. ),
  972. .target(
  973. name: "SharedTestUtilities",
  974. dependencies: ["FirebaseCore",
  975. "FirebaseAppCheckInterop",
  976. "FirebaseAuthInterop",
  977. "FirebaseMessagingInterop",
  978. "GoogleDataTransport",
  979. .product(name: "OCMock", package: "ocmock")],
  980. path: "SharedTestUtilities",
  981. publicHeadersPath: "./",
  982. cSettings: [
  983. .headerSearchPath("../"),
  984. ]
  985. ),
  986. // MARK: - Firebase Remote Config
  987. .target(
  988. name: "FirebaseRemoteConfigInternal",
  989. dependencies: [
  990. "FirebaseCore",
  991. "FirebaseABTesting",
  992. "FirebaseInstallations",
  993. "FirebaseRemoteConfigInterop",
  994. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  995. .product(name: "GULNSData", package: "GoogleUtilities"),
  996. ],
  997. path: "FirebaseRemoteConfig/Sources",
  998. publicHeadersPath: "Public",
  999. cSettings: [
  1000. .headerSearchPath("../../"),
  1001. ]
  1002. ),
  1003. .testTarget(
  1004. name: "RemoteConfigUnit",
  1005. dependencies: ["FirebaseRemoteConfigInternal", .product(name: "OCMock", package: "ocmock")],
  1006. path: "FirebaseRemoteConfig/Tests/Unit",
  1007. exclude: [
  1008. // Need to be evaluated/ported to RC V2.
  1009. "RCNConfigAnalyticsTest.m",
  1010. "RCNConfigSettingsTest.m",
  1011. "RCNConfigTest.m",
  1012. "RCNRemoteConfig+FIRAppTest.m",
  1013. "RCNThrottlingTests.m",
  1014. ],
  1015. resources: [
  1016. .process("SecondApp-GoogleService-Info.plist"),
  1017. .process("Defaults-testInfo.plist"),
  1018. .process("TestABTPayload.txt"),
  1019. ],
  1020. cSettings: [
  1021. .headerSearchPath("../../.."),
  1022. ]
  1023. ),
  1024. .testTarget(
  1025. name: "RemoteConfigSwiftUnit",
  1026. dependencies: ["FirebaseRemoteConfigInternal"],
  1027. path: "FirebaseRemoteConfig/Tests/SwiftUnit",
  1028. cSettings: [
  1029. .headerSearchPath("../../.."),
  1030. ]
  1031. ),
  1032. .target(
  1033. name: "FirebaseRemoteConfig",
  1034. dependencies: [
  1035. "FirebaseRemoteConfigInternal",
  1036. "FirebaseSharedSwift",
  1037. ],
  1038. path: "FirebaseRemoteConfig/Swift",
  1039. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  1040. swiftSettings: [
  1041. .swiftLanguageMode(SwiftLanguageMode.v5),
  1042. ]
  1043. ),
  1044. .testTarget(
  1045. name: "RemoteConfigFakeConsole",
  1046. dependencies: ["FirebaseRemoteConfig",
  1047. "RemoteConfigFakeConsoleObjC"],
  1048. path: "FirebaseRemoteConfig/Tests/Swift",
  1049. exclude: [
  1050. "AccessToken.json",
  1051. "README.md",
  1052. "ObjC/",
  1053. ],
  1054. resources: [
  1055. .process("Defaults-testInfo.plist"),
  1056. ],
  1057. cSettings: [
  1058. .headerSearchPath("../../../"),
  1059. ],
  1060. swiftSettings: [
  1061. .swiftLanguageMode(SwiftLanguageMode.v5),
  1062. ]
  1063. ),
  1064. .target(
  1065. name: "RemoteConfigFakeConsoleObjC",
  1066. dependencies: [.product(name: "OCMock", package: "ocmock")],
  1067. path: "FirebaseRemoteConfig/Tests/Swift/ObjC",
  1068. publicHeadersPath: ".",
  1069. cSettings: [
  1070. .headerSearchPath("../../../../"),
  1071. ]
  1072. ),
  1073. // Internal headers only for consuming from other SDK.
  1074. .target(
  1075. name: "FirebaseRemoteConfigInterop",
  1076. path: "FirebaseRemoteConfig/Interop",
  1077. publicHeadersPath: ".",
  1078. cSettings: [
  1079. .headerSearchPath("../../"),
  1080. ]
  1081. ),
  1082. // MARK: - Firebase Sessions
  1083. .target(
  1084. name: "FirebaseSessions",
  1085. dependencies: [
  1086. "FirebaseCore",
  1087. "FirebaseInstallations",
  1088. "FirebaseCoreExtension",
  1089. "FirebaseSessionsObjC",
  1090. // The `FirebaseSessions` target transitively depends on nanopb via the internal
  1091. // `FirebaseSessionsObjC` target. Not explicitly depending on nanopb leads to
  1092. // undefined symbol errors in Tuist based SPM builds.
  1093. // See the conversations in
  1094. // - https://github.com/firebase/firebase-ios-sdk/issues/15276
  1095. // - https://github.com/firebase/firebase-ios-sdk/pull/15287
  1096. .product(name: "nanopb", package: "nanopb"),
  1097. .product(name: "Promises", package: "Promises"),
  1098. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  1099. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1100. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  1101. ],
  1102. path: "FirebaseSessions/Sources",
  1103. cSettings: [
  1104. .headerSearchPath(".."),
  1105. .define("DISPLAY_VERSION", to: firebaseVersion),
  1106. .define("PB_FIELD_32BIT", to: "1"),
  1107. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1108. .define("PB_ENABLE_MALLOC", to: "1"),
  1109. ],
  1110. linkerSettings: [
  1111. .linkedFramework("Security"),
  1112. .linkedFramework(
  1113. "SystemConfiguration",
  1114. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1115. ),
  1116. ]
  1117. ),
  1118. // The Sessions SDK is Swift-first with Objective-C code to support
  1119. // nanopb. Because Swift Package Manager doesn't support mixed
  1120. // language targets, the ObjC code has been extracted out into
  1121. // a separate target.
  1122. .target(
  1123. name: "FirebaseSessionsObjC",
  1124. dependencies: [
  1125. "FirebaseCore",
  1126. "FirebaseCoreExtension",
  1127. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1128. .product(name: "nanopb", package: "nanopb"),
  1129. ],
  1130. path: "FirebaseSessions",
  1131. exclude: [
  1132. "README.md",
  1133. "Sources/",
  1134. "Tests/",
  1135. "ProtoSupport/",
  1136. "generate_project.sh",
  1137. "generate_protos.sh",
  1138. "generate_testapp.sh",
  1139. ],
  1140. publicHeadersPath: "SourcesObjC",
  1141. cSettings: [
  1142. .headerSearchPath(".."),
  1143. .define("DISPLAY_VERSION", to: firebaseVersion),
  1144. .define("PB_FIELD_32BIT", to: "1"),
  1145. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1146. .define("PB_ENABLE_MALLOC", to: "1"),
  1147. ],
  1148. linkerSettings: [
  1149. .linkedFramework("Security"),
  1150. .linkedFramework(
  1151. "SystemConfiguration",
  1152. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1153. ),
  1154. ]
  1155. ),
  1156. .testTarget(
  1157. name: "FirebaseSessionsUnit",
  1158. dependencies: ["FirebaseSessions"],
  1159. path: "FirebaseSessions/Tests/Unit"
  1160. ),
  1161. // MARK: - Firebase Storage
  1162. .target(
  1163. name: "FirebaseStorage",
  1164. dependencies: [
  1165. "FirebaseAppCheckInterop",
  1166. "FirebaseAuthInterop",
  1167. "FirebaseCore",
  1168. "FirebaseCoreExtension",
  1169. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  1170. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1171. ],
  1172. path: "FirebaseStorage/Sources",
  1173. swiftSettings: [
  1174. .swiftLanguageMode(SwiftLanguageMode.v5),
  1175. ]
  1176. ),
  1177. .testTarget(
  1178. name: "FirebaseStorageUnit",
  1179. dependencies: ["FirebaseStorage",
  1180. "SharedTestUtilities"],
  1181. path: "FirebaseStorage/Tests/Unit",
  1182. cSettings: [
  1183. .headerSearchPath("../../../"),
  1184. ],
  1185. swiftSettings: [
  1186. .swiftLanguageMode(SwiftLanguageMode.v5),
  1187. ]
  1188. ),
  1189. .testTarget(
  1190. name: "StorageObjCIntegration",
  1191. dependencies: ["FirebaseStorage"],
  1192. path: "FirebaseStorage/Tests/ObjCIntegration",
  1193. exclude: [
  1194. // See https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730
  1195. "FIRStorageIntegrationTests.m",
  1196. "ObjCPPAPITests.mm",
  1197. "Credentials.h",
  1198. ],
  1199. cSettings: [
  1200. .headerSearchPath("../../.."),
  1201. ]
  1202. ),
  1203. .testTarget(
  1204. name: "swift-test",
  1205. dependencies: [
  1206. "Firebase",
  1207. "FirebaseAuth",
  1208. "FirebaseAppCheck",
  1209. "FirebaseABTesting",
  1210. "FirebaseAnalytics",
  1211. .target(name: "FirebaseAppDistribution",
  1212. condition: .when(platforms: [.iOS])),
  1213. "FirebaseAuthCombineSwift",
  1214. "FirebaseFirestoreCombineSwift",
  1215. "FirebaseFunctionsCombineSwift",
  1216. "FirebaseStorageCombineSwift",
  1217. "FirebaseCrashlytics",
  1218. "FirebaseCore",
  1219. "FirebaseDatabase",
  1220. "FirebaseFirestoreTarget",
  1221. "FirebaseFunctions",
  1222. .target(name: "FirebaseInAppMessaging",
  1223. condition: .when(platforms: [.iOS, .tvOS])),
  1224. "FirebaseInstallations",
  1225. "FirebaseMessaging",
  1226. .target(name: "FirebasePerformance",
  1227. condition: .when(platforms: [.iOS, .tvOS])),
  1228. "FirebaseRemoteConfig",
  1229. "FirebaseSessions",
  1230. "FirebaseStorage",
  1231. .product(name: "nanopb", package: "nanopb"),
  1232. ],
  1233. path: "SwiftPMTests/swift-test",
  1234. swiftSettings: [
  1235. .swiftLanguageMode(SwiftLanguageMode.v5),
  1236. ]
  1237. ),
  1238. .testTarget(
  1239. name: "analytics-import-test",
  1240. dependencies: [
  1241. "FirebaseAnalyticsWrapper",
  1242. "Firebase",
  1243. ],
  1244. path: "SwiftPMTests/analytics-import-test",
  1245. swiftSettings: [
  1246. .swiftLanguageMode(SwiftLanguageMode.v5),
  1247. ]
  1248. ),
  1249. .testTarget(
  1250. name: "objc-import-test",
  1251. dependencies: [
  1252. "Firebase",
  1253. "FirebaseAuth",
  1254. "FirebaseABTesting",
  1255. "FirebaseAppCheck",
  1256. .target(name: "FirebaseAppDistribution",
  1257. condition: .when(platforms: [.iOS])),
  1258. "FirebaseCrashlytics",
  1259. "FirebaseCore",
  1260. "FirebaseDatabase",
  1261. "FirebaseFirestoreTarget",
  1262. "FirebaseFunctions",
  1263. .target(name: "FirebaseInAppMessaging",
  1264. condition: .when(platforms: [.iOS, .tvOS])),
  1265. "FirebaseInstallations",
  1266. "FirebaseMessaging",
  1267. .target(name: "FirebasePerformance",
  1268. condition: .when(platforms: [.iOS, .tvOS])),
  1269. "FirebaseRemoteConfig",
  1270. "FirebaseStorage",
  1271. ],
  1272. path: "SwiftPMTests/objc-import-test"
  1273. ),
  1274. .testTarget(
  1275. name: "version-test",
  1276. dependencies: [
  1277. "FirebaseCore",
  1278. ],
  1279. path: "SwiftPMTests/version-test",
  1280. cSettings: [
  1281. .define("FIR_VERSION", to: firebaseVersion),
  1282. ]
  1283. ),
  1284. // MARK: - Firebase App Check
  1285. .target(name: "FirebaseAppCheck",
  1286. dependencies: [
  1287. "FirebaseAppCheckInterop",
  1288. "FirebaseCore",
  1289. .product(name: "AppCheckCore", package: "app-check"),
  1290. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1291. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  1292. ],
  1293. path: "FirebaseAppCheck/Sources",
  1294. publicHeadersPath: "Public",
  1295. cSettings: [
  1296. .headerSearchPath("../.."),
  1297. ],
  1298. linkerSettings: [
  1299. .linkedFramework(
  1300. "DeviceCheck",
  1301. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1302. ),
  1303. ]),
  1304. // Internal headers only for consuming from Swift.
  1305. .target(
  1306. name: "FirebaseAppCheckInterop",
  1307. path: "FirebaseAppCheck/Interop",
  1308. exclude: [
  1309. "CMakeLists.txt",
  1310. ],
  1311. publicHeadersPath: "Public",
  1312. cSettings: [
  1313. .headerSearchPath("../../"),
  1314. ]
  1315. ),
  1316. .testTarget(
  1317. name: "FirebaseAppCheckUnit",
  1318. dependencies: [
  1319. "FirebaseAppCheck",
  1320. "SharedTestUtilities",
  1321. .product(name: "OCMock", package: "ocmock"),
  1322. ],
  1323. path: "FirebaseAppCheck/Tests/Unit",
  1324. exclude: [
  1325. // Swift tests are in the target `FirebaseAppCheckUnitSwift` since mixed language targets
  1326. // are not supported (as of Xcode 15.0).
  1327. "Swift",
  1328. ],
  1329. cSettings: [
  1330. .headerSearchPath("../../.."),
  1331. ]
  1332. ),
  1333. .testTarget(
  1334. name: "FirebaseAppCheckUnitSwift",
  1335. dependencies: ["FirebaseAppCheck"],
  1336. path: "FirebaseAppCheck/Tests/Unit/Swift",
  1337. swiftSettings: [
  1338. .swiftLanguageMode(SwiftLanguageMode.v5),
  1339. ]
  1340. ),
  1341. // MARK: Testing support
  1342. .target(
  1343. name: "FirebaseFirestoreTestingSupport",
  1344. dependencies: ["FirebaseFirestoreTarget"],
  1345. path: "FirebaseTestingSupport/Firestore/Sources",
  1346. publicHeadersPath: "./",
  1347. cSettings: [
  1348. .headerSearchPath("../../.."),
  1349. .headerSearchPath("../../../Firestore/Source/Public/FirebaseFirestore"),
  1350. ]
  1351. ),
  1352. .testTarget(
  1353. name: "FirestoreTestingSupportTests",
  1354. dependencies: ["FirebaseFirestoreTestingSupport"],
  1355. path: "FirebaseTestingSupport/Firestore/Tests",
  1356. cSettings: [
  1357. .headerSearchPath("../../.."),
  1358. ]
  1359. ),
  1360. ] + firestoreTargets(),
  1361. cxxLanguageStandard: CXXLanguageStandard.gnucxx14
  1362. )
  1363. // MARK: - Helper Functions
  1364. func googleAppMeasurementDependency() -> Package.Dependency {
  1365. let appMeasurementURL = "https://github.com/google/GoogleAppMeasurement.git"
  1366. // Point SPM CI to the tip of main of https://github.com/google/GoogleAppMeasurement so that the
  1367. // release process can defer publishing the GoogleAppMeasurement tag until after testing.
  1368. if Context.environment["FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT"] != nil {
  1369. return .package(url: appMeasurementURL, branch: "main")
  1370. }
  1371. return .package(url: appMeasurementURL, exact: "12.4.0")
  1372. }
  1373. func abseilDependency() -> Package.Dependency {
  1374. let packageInfo: (url: String, range: Range<Version>)
  1375. // If building Firestore from source, abseil will need to be built as source
  1376. // as the headers in the binary version of abseil are unusable.
  1377. if Context.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1378. packageInfo = (
  1379. "https://github.com/firebase/abseil-cpp-SwiftPM.git",
  1380. "0.20240722.0" ..< "0.20240723.0"
  1381. )
  1382. } else {
  1383. packageInfo = (
  1384. "https://github.com/google/abseil-cpp-binary.git",
  1385. "1.2024072200.0" ..< "1.2024072300.0"
  1386. )
  1387. }
  1388. return .package(url: packageInfo.url, packageInfo.range)
  1389. }
  1390. func grpcDependency() -> Package.Dependency {
  1391. let packageInfo: (url: String, range: Range<Version>)
  1392. // If building Firestore from source, abseil will need to be built as source
  1393. // as the headers in the binary version of abseil are unusable.
  1394. if Context.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1395. packageInfo = ("https://github.com/grpc/grpc-ios.git", "1.69.0" ..< "1.70.0")
  1396. } else {
  1397. packageInfo = ("https://github.com/google/grpc-binary.git", "1.69.0" ..< "1.70.0")
  1398. }
  1399. return .package(url: packageInfo.url, packageInfo.range)
  1400. }
  1401. func firestoreWrapperTarget() -> Target {
  1402. if Context.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1403. return .target(
  1404. name: "FirebaseFirestoreTarget",
  1405. dependencies: [.target(name: "FirebaseFirestore",
  1406. condition: .when(platforms: [.iOS, .tvOS, .macOS, .visionOS]))],
  1407. path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap"
  1408. )
  1409. }
  1410. return .target(
  1411. name: "FirebaseFirestoreTarget",
  1412. dependencies: [.target(name: "FirebaseFirestore",
  1413. condition: .when(platforms: [.iOS, .tvOS, .macOS, .macCatalyst]))],
  1414. path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap",
  1415. cSettings: [.define("FIREBASE_BINARY_FIRESTORE", to: "1")]
  1416. )
  1417. }
  1418. func firestoreTargets() -> [Target] {
  1419. if Context.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1420. return [
  1421. .target(
  1422. name: "FirebaseFirestoreInternalWrapper",
  1423. dependencies: [
  1424. "FirebaseAppCheckInterop",
  1425. "FirebaseCore",
  1426. "leveldb",
  1427. .product(name: "nanopb", package: "nanopb"),
  1428. .product(name: "abseil", package: "abseil-cpp-SwiftPM"),
  1429. .product(name: "gRPC-cpp", package: "grpc-ios"),
  1430. ],
  1431. path: "Firestore",
  1432. exclude: [
  1433. "CHANGELOG.md",
  1434. "CMakeLists.txt",
  1435. "Example/",
  1436. "LICENSE",
  1437. "Protos/CMakeLists.txt",
  1438. "Protos/Podfile",
  1439. "Protos/README.md",
  1440. "Protos/build_protos.py",
  1441. "Protos/cpp/",
  1442. "Protos/lib/",
  1443. "Protos/nanopb_cpp_generator.py",
  1444. "Protos/protos/",
  1445. "README.md",
  1446. "Source/CMakeLists.txt",
  1447. "Source/Resources/",
  1448. "Swift/",
  1449. "core/CMakeLists.txt",
  1450. "core/src/util/config_detected.h.in",
  1451. "core/test/",
  1452. "fuzzing/",
  1453. "test.sh",
  1454. // Swift PM doesn't recognize hpp files, so we're relying on search paths
  1455. // to find third_party/nlohmann_json/json.hpp.
  1456. "third_party/",
  1457. // Exclude alternate implementations for other platforms
  1458. "core/src/remote/connectivity_monitor_noop.cc",
  1459. "core/src/util/filesystem_win.cc",
  1460. "core/src/util/log_stdio.cc",
  1461. "core/src/util/secure_random_openssl.cc",
  1462. ],
  1463. sources: [
  1464. "Source/",
  1465. "Protos/nanopb/",
  1466. "core/include/",
  1467. "core/src",
  1468. ],
  1469. publicHeadersPath: "Source/Public",
  1470. cSettings: [
  1471. .headerSearchPath("../"),
  1472. .headerSearchPath("Source/Public/FirebaseFirestore"),
  1473. .headerSearchPath("Protos/nanopb"),
  1474. .define("PB_FIELD_32BIT", to: "1"),
  1475. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1476. .define("PB_ENABLE_MALLOC", to: "1"),
  1477. .define("FIRFirestore_VERSION", to: firebaseVersion),
  1478. ],
  1479. linkerSettings: [
  1480. .linkedFramework(
  1481. "SystemConfiguration",
  1482. .when(platforms: [.iOS, .macOS, .tvOS, .visionOS])
  1483. ),
  1484. .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS, .visionOS])),
  1485. .linkedLibrary("c++"),
  1486. ]
  1487. ),
  1488. .target(
  1489. name: "FirebaseFirestore",
  1490. dependencies: [
  1491. "FirebaseCore",
  1492. "FirebaseCoreExtension",
  1493. "FirebaseFirestoreInternalWrapper",
  1494. "FirebaseSharedSwift",
  1495. ],
  1496. path: "Firestore",
  1497. exclude: [
  1498. "CHANGELOG.md",
  1499. "CMakeLists.txt",
  1500. "Example/",
  1501. "LICENSE",
  1502. "Protos/",
  1503. "README.md",
  1504. "Source/",
  1505. "Swift/Source/Resources/",
  1506. "core/",
  1507. "fuzzing/",
  1508. "test.sh",
  1509. "Swift/CHANGELOG.md",
  1510. "Swift/Tests/",
  1511. "third_party/nlohmann_json",
  1512. ],
  1513. sources: [
  1514. "Swift/Source/",
  1515. ],
  1516. resources: [.process("Source/Resources/PrivacyInfo.xcprivacy")],
  1517. swiftSettings: [
  1518. .swiftLanguageMode(SwiftLanguageMode.v5),
  1519. ]
  1520. ),
  1521. ]
  1522. }
  1523. let firestoreInternalTarget: Target = {
  1524. if Context.environment["FIREBASECI_USE_LOCAL_FIRESTORE_ZIP"] != nil {
  1525. // This is set when running `scripts/check_firestore_symbols.sh`.
  1526. return .binaryTarget(
  1527. name: "FirebaseFirestoreInternal",
  1528. // The `xcframework` should be moved to the root of the repo.
  1529. path: "FirebaseFirestoreInternal.xcframework"
  1530. )
  1531. } else {
  1532. return .binaryTarget(
  1533. name: "FirebaseFirestoreInternal",
  1534. url: "https://dl.google.com/firebase/ios/bin/firestore/12.4.0/rc0/FirebaseFirestoreInternal.zip",
  1535. checksum: "58b916624c01a56c5de694cfc9c5cc7aabcafb13b54e7bde8c83bacc51a3460d"
  1536. )
  1537. }
  1538. }()
  1539. return [
  1540. .target(
  1541. name: "FirebaseFirestore",
  1542. dependencies: [
  1543. .target(
  1544. name: "FirebaseFirestoreInternalWrapper",
  1545. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1546. ),
  1547. .product(
  1548. name: "abseil",
  1549. package: "abseil-cpp-binary",
  1550. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1551. ),
  1552. .product(
  1553. name: "gRPC-C++",
  1554. package: "grpc-binary",
  1555. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1556. ),
  1557. .product(name: "nanopb", package: "nanopb"),
  1558. "FirebaseAppCheckInterop",
  1559. "FirebaseCore",
  1560. "FirebaseCoreExtension",
  1561. "leveldb",
  1562. "FirebaseSharedSwift",
  1563. ],
  1564. path: "Firestore/Swift/Source",
  1565. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  1566. swiftSettings: [
  1567. .swiftLanguageMode(SwiftLanguageMode.v5),
  1568. ],
  1569. linkerSettings: [
  1570. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  1571. .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS])),
  1572. .linkedLibrary("c++"),
  1573. ]
  1574. ),
  1575. .target(
  1576. name: "FirebaseFirestoreInternalWrapper",
  1577. dependencies: [.target(
  1578. name: "FirebaseFirestoreInternal",
  1579. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1580. )],
  1581. path: "FirebaseFirestoreInternal",
  1582. publicHeadersPath: "."
  1583. ),
  1584. firestoreInternalTarget,
  1585. ]
  1586. }