Package.swift 46 KB

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