Package.swift 51 KB

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