Package.swift 47 KB

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