Package.swift 52 KB

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