Package.swift 45 KB

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