Package.swift 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118
  1. // swift-tools-version:5.3
  2. // The swift-tools-version declares the minimum version of Swift required to build this package.
  3. // Copyright 2020 Google LLC
  4. //
  5. // Licensed under the Apache License, Version 2.0 (the "License");
  6. // you may not use this file except in compliance with the License.
  7. // You may obtain a copy of the License at
  8. //
  9. // http://www.apache.org/licenses/LICENSE-2.0
  10. //
  11. // Unless required by applicable law or agreed to in writing, software
  12. // distributed under the License is distributed on an "AS IS" BASIS,
  13. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. // See the License for the specific language governing permissions and
  15. // limitations under the License.
  16. import PackageDescription
  17. let firebaseVersion = "8.9.0"
  18. let package = Package(
  19. name: "Firebase",
  20. platforms: [.iOS(.v11), .macOS(.v10_12), .tvOS(.v12), .watchOS(.v7)],
  21. products: [
  22. .library(
  23. name: "FirebaseAnalytics",
  24. targets: ["FirebaseAnalyticsTarget"]
  25. ),
  26. .library(
  27. name: "FirebaseAnalyticsWithoutAdIdSupport",
  28. targets: ["FirebaseAnalyticsWithoutAdIdSupportTarget"]
  29. ),
  30. .library(
  31. name: "FirebaseAnalyticsSwift-Beta",
  32. targets: ["FirebaseAnalyticsSwiftTarget"]
  33. ),
  34. .library(
  35. name: "FirebaseAuth",
  36. targets: ["FirebaseAuth"]
  37. ),
  38. .library(
  39. name: "FirebaseAppCheck",
  40. targets: ["FirebaseAppCheck"]
  41. ),
  42. .library(
  43. name: "FirebaseAppDistribution-Beta",
  44. targets: ["FirebaseAppDistributionTarget"]
  45. ),
  46. .library(
  47. name: "FirebaseAuthCombine-Community",
  48. targets: ["FirebaseAuthCombineSwift"]
  49. ),
  50. .library(
  51. name: "FirebaseFirestoreCombine-Community",
  52. targets: ["FirebaseFirestoreCombineSwift"]
  53. ),
  54. .library(
  55. name: "FirebaseFunctionsCombine-Community",
  56. targets: ["FirebaseFunctionsCombineSwift"]
  57. ),
  58. .library(
  59. name: "FirebaseStorageCombine-Community",
  60. targets: ["FirebaseStorageCombineSwift"]
  61. ),
  62. .library(
  63. name: "FirebaseCrashlytics",
  64. targets: ["FirebaseCrashlytics"]
  65. ),
  66. .library(
  67. name: "FirebaseDatabase",
  68. targets: ["FirebaseDatabase"]
  69. ),
  70. .library(
  71. name: "FirebaseDatabaseSwift-Beta",
  72. targets: ["FirebaseDatabaseSwift"]
  73. ),
  74. .library(
  75. name: "FirebaseDynamicLinks",
  76. targets: ["FirebaseDynamicLinksTarget"]
  77. ),
  78. .library(
  79. name: "FirebaseFirestore",
  80. targets: ["FirebaseFirestoreTarget"]
  81. ),
  82. .library(
  83. name: "FirebaseFirestoreSwift-Beta",
  84. targets: ["FirebaseFirestoreSwiftTarget"]
  85. ),
  86. .library(
  87. name: "FirebaseFunctions",
  88. targets: ["FirebaseFunctions"]
  89. ),
  90. .library(
  91. name: "FirebaseInAppMessaging-Beta",
  92. targets: ["FirebaseInAppMessagingTarget"]
  93. ),
  94. .library(
  95. name: "FirebaseInAppMessagingSwift-Beta",
  96. targets: ["FirebaseInAppMessagingSwift"]
  97. ),
  98. .library(
  99. name: "FirebaseInstallations",
  100. targets: ["FirebaseInstallations"]
  101. ),
  102. .library(
  103. name: "FirebaseMessaging",
  104. targets: ["FirebaseMessaging"]
  105. ),
  106. .library(
  107. name: "FirebaseMLModelDownloader",
  108. targets: ["FirebaseMLModelDownloader"]
  109. ),
  110. .library(
  111. name: "FirebasePerformance",
  112. targets: ["FirebasePerformanceTarget"]
  113. ),
  114. .library(
  115. name: "FirebaseRemoteConfig",
  116. targets: ["FirebaseRemoteConfig"]
  117. ),
  118. .library(
  119. name: "FirebaseStorage",
  120. targets: ["FirebaseStorage"]
  121. ),
  122. .library(
  123. name: "FirebaseStorageSwift-Beta",
  124. targets: ["FirebaseStorageSwift"]
  125. ),
  126. ],
  127. dependencies: [
  128. .package(
  129. name: "Promises",
  130. url: "https://github.com/google/promises.git",
  131. "1.2.8" ..< "3.0.0"
  132. ),
  133. .package(
  134. name: "SwiftProtobuf",
  135. url: "https://github.com/apple/swift-protobuf.git",
  136. "1.15.0" ..< "2.0.0"
  137. ),
  138. .package(
  139. name: "GoogleAppMeasurement",
  140. url: "https://github.com/google/GoogleAppMeasurement.git",
  141. // Note that CI changes the version to the head of main for CI.
  142. // See scripts/setup_spm_tests.sh.
  143. .exact("8.9.0")
  144. ),
  145. .package(
  146. name: "GoogleDataTransport",
  147. url: "https://github.com/google/GoogleDataTransport.git",
  148. "9.1.2" ..< "10.0.0"
  149. ),
  150. .package(
  151. name: "GoogleUtilities",
  152. url: "https://github.com/google/GoogleUtilities.git",
  153. "7.6.0" ..< "8.0.0"
  154. ),
  155. .package(
  156. name: "GTMSessionFetcher",
  157. url: "https://github.com/google/gtm-session-fetcher.git",
  158. "1.5.0" ..< "2.0.0"
  159. ),
  160. .package(
  161. name: "nanopb",
  162. url: "https://github.com/firebase/nanopb.git",
  163. "2.30908.0" ..< "2.30909.0"
  164. ),
  165. .package(
  166. name: "abseil",
  167. url: "https://github.com/firebase/abseil-cpp-SwiftPM.git",
  168. "0.20200225.3" ..< "0.20200226.0"
  169. ),
  170. .package(
  171. name: "gRPC",
  172. url: "https://github.com/firebase/grpc-SwiftPM.git",
  173. "1.28.4" ..< "1.29.0"
  174. ),
  175. .package(
  176. name: "OCMock",
  177. url: "https://github.com/erikdoe/ocmock.git",
  178. .revision("c5eeaa6dde7c308a5ce48ae4d4530462dd3a1110")
  179. ),
  180. .package(
  181. name: "leveldb",
  182. url: "https://github.com/firebase/leveldb.git",
  183. "1.22.2" ..< "1.23.0"
  184. ),
  185. .package(
  186. name: "GCDWebServer",
  187. url: "https://github.com/SlaunchaMan/GCDWebServer.git",
  188. .revision("935e2736044e71e5341663c3cc9a335ba6867a2b")
  189. ),
  190. // Branches need a force update with a run with the revision set like below.
  191. // .package(url: "https://github.com/paulb777/nanopb.git", .revision("564392bd87bd093c308a3aaed3997466efb95f74"))
  192. ],
  193. targets: [
  194. .target(
  195. name: "Firebase",
  196. path: "CoreOnly/Sources",
  197. publicHeadersPath: "./"
  198. ),
  199. .target(
  200. name: "FirebaseCore",
  201. dependencies: [
  202. "Firebase",
  203. "FirebaseCoreDiagnostics",
  204. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  205. .product(name: "GULLogger", package: "GoogleUtilities"),
  206. ],
  207. path: "FirebaseCore/Sources",
  208. publicHeadersPath: "Public",
  209. cSettings: [
  210. .headerSearchPath("../.."),
  211. .define("Firebase_VERSION", to: firebaseVersion),
  212. // TODO: - Add support for cflags cSetting so that we can set the -fno-autolink option
  213. ],
  214. linkerSettings: [
  215. .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS])),
  216. .linkedFramework("AppKit", .when(platforms: [.macOS])),
  217. ]
  218. ),
  219. .testTarget(
  220. name: "CoreUnit",
  221. dependencies: ["FirebaseCore", "SharedTestUtilities", "OCMock"],
  222. path: "FirebaseCore/Tests/Unit",
  223. exclude: ["Resources/GoogleService-Info.plist"],
  224. cSettings: [
  225. .headerSearchPath("../../.."),
  226. ]
  227. ),
  228. .target(
  229. name: "FirebaseCoreDiagnostics",
  230. dependencies: [
  231. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  232. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  233. .product(name: "GULLogger", package: "GoogleUtilities"),
  234. .product(name: "nanopb", package: "nanopb"),
  235. ],
  236. path: "Firebase/CoreDiagnostics/FIRCDLibrary",
  237. publicHeadersPath: ".",
  238. cSettings: [
  239. .headerSearchPath("../../.."),
  240. .define("PB_FIELD_32BIT", to: "1"),
  241. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  242. .define("PB_ENABLE_MALLOC", to: "1"),
  243. ]
  244. ),
  245. .target(
  246. name: "FirebaseABTesting",
  247. dependencies: ["FirebaseCore"],
  248. path: "FirebaseABTesting/Sources",
  249. publicHeadersPath: "Public",
  250. cSettings: [
  251. .headerSearchPath("../../"),
  252. ]
  253. ),
  254. .testTarget(
  255. name: "ABTestingUnit",
  256. dependencies: ["FirebaseABTesting", "OCMock"],
  257. path: "FirebaseABTesting/Tests/Unit",
  258. resources: [.process("Resources")],
  259. cSettings: [
  260. .headerSearchPath("../../.."),
  261. ]
  262. ),
  263. .target(
  264. name: "FirebaseAnalyticsTarget",
  265. dependencies: [.target(name: "FirebaseAnalyticsWrapper",
  266. condition: .when(platforms: [.iOS]))],
  267. path: "SwiftPM-PlatformExclude/FirebaseAnalyticsWrap"
  268. ),
  269. .target(
  270. name: "FirebaseAnalyticsWrapper",
  271. dependencies: [
  272. .target(name: "FirebaseAnalytics", condition: .when(platforms: [.iOS, .macOS, .tvOS])),
  273. .product(name: "GoogleAppMeasurement",
  274. package: "GoogleAppMeasurement",
  275. condition: .when(platforms: [.iOS, .macOS, .tvOS])),
  276. "FirebaseCore",
  277. "FirebaseInstallations",
  278. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  279. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  280. .product(name: "GULNSData", package: "GoogleUtilities"),
  281. .product(name: "GULNetwork", package: "GoogleUtilities"),
  282. .product(name: "nanopb", package: "nanopb"),
  283. ],
  284. path: "FirebaseAnalyticsWrapper",
  285. linkerSettings: [
  286. .linkedLibrary("sqlite3"),
  287. .linkedLibrary("c++"),
  288. .linkedLibrary("z"),
  289. .linkedFramework("StoreKit"),
  290. ]
  291. ),
  292. .binaryTarget(
  293. name: "FirebaseAnalytics",
  294. url: "https://dl.google.com/firebase/ios/swiftpm/8.9.0/FirebaseAnalytics.zip",
  295. checksum: "0c1075259f9ee3e737a16c64fc9096d0d0bbbf4887cf95aefe99a6b690cd096e"
  296. ),
  297. .target(
  298. name: "FirebaseAnalyticsSwiftTarget",
  299. dependencies: [.target(name: "FirebaseAnalyticsSwift",
  300. condition: .when(platforms: [.iOS, .macOS, .tvOS]))],
  301. path: "SwiftPM-PlatformExclude/FirebaseAnalyticsSwiftWrap"
  302. ),
  303. .target(
  304. name: "FirebaseAnalyticsSwift",
  305. dependencies: ["FirebaseAnalyticsWrapper"],
  306. path: "FirebaseAnalyticsSwift/Sources"
  307. ),
  308. .target(
  309. name: "FirebaseAnalyticsWithoutAdIdSupportTarget",
  310. dependencies: [.target(name: "FirebaseAnalyticsWithoutAdIdSupportWrapper",
  311. condition: .when(platforms: [.iOS, .macOS, .tvOS]))],
  312. path: "SwiftPM-PlatformExclude/FirebaseAnalyticsWithoutAdIdSupportWrap"
  313. ),
  314. .target(
  315. name: "FirebaseAnalyticsWithoutAdIdSupportWrapper",
  316. dependencies: [
  317. .target(name: "FirebaseAnalytics", condition: .when(platforms: [.iOS, .macOS, .tvOS])),
  318. .product(name: "GoogleAppMeasurementWithoutAdIdSupport",
  319. package: "GoogleAppMeasurement",
  320. condition: .when(platforms: [.iOS])),
  321. "FirebaseCore",
  322. "FirebaseInstallations",
  323. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  324. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  325. .product(name: "GULNSData", package: "GoogleUtilities"),
  326. .product(name: "GULNetwork", package: "GoogleUtilities"),
  327. .product(name: "nanopb", package: "nanopb"),
  328. ],
  329. path: "FirebaseAnalyticsWithoutAdIdSupportWrapper",
  330. linkerSettings: [
  331. .linkedLibrary("sqlite3"),
  332. .linkedLibrary("c++"),
  333. .linkedLibrary("z"),
  334. .linkedFramework("StoreKit"),
  335. ]
  336. ),
  337. .target(
  338. name: "FirebaseAppDistributionTarget",
  339. dependencies: [.target(name: "FirebaseAppDistribution",
  340. condition: .when(platforms: [.iOS]))],
  341. path: "SwiftPM-PlatformExclude/FirebaseAppDistributionWrap"
  342. ),
  343. .target(
  344. name: "FirebaseAppDistribution",
  345. dependencies: [
  346. "FirebaseCore",
  347. "FirebaseInstallations",
  348. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  349. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  350. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  351. ],
  352. path: "FirebaseAppDistribution/Sources",
  353. publicHeadersPath: "Public",
  354. cSettings: [
  355. .headerSearchPath("../../"),
  356. ]
  357. ),
  358. .testTarget(
  359. name: "AppDistributionUnit",
  360. dependencies: ["FirebaseAppDistribution", "OCMock"],
  361. path: "FirebaseAppDistribution/Tests/Unit",
  362. resources: [.process("Resources")],
  363. cSettings: [
  364. .headerSearchPath("../../.."),
  365. ]
  366. ),
  367. .target(
  368. name: "FirebaseAuth",
  369. dependencies: [
  370. "FirebaseCore",
  371. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  372. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  373. .product(name: "GTMSessionFetcherCore", package: "GTMSessionFetcher"),
  374. ],
  375. path: "FirebaseAuth/Sources",
  376. publicHeadersPath: "Public",
  377. cSettings: [
  378. .headerSearchPath("../../"),
  379. ],
  380. linkerSettings: [
  381. .linkedFramework("Security"),
  382. .linkedFramework("SafariServices", .when(platforms: [.iOS])),
  383. ]
  384. ),
  385. .testTarget(
  386. name: "AuthUnit",
  387. dependencies: ["FirebaseAuth", "OCMock"],
  388. path: "FirebaseAuth/Tests/Unit",
  389. exclude: [
  390. "FIRAuthKeychainServicesTests.m", // TODO: figure out SPM keychain testing
  391. "FIRAuthTests.m",
  392. "FIRUserTests.m",
  393. ],
  394. cSettings: [
  395. .headerSearchPath("../../.."),
  396. ]
  397. ),
  398. .target(
  399. name: "FirebaseAuthCombineSwift",
  400. dependencies: ["FirebaseAuth"],
  401. path: "FirebaseCombineSwift/Sources/Auth"
  402. ),
  403. .target(
  404. name: "FirebaseFirestoreCombineSwift",
  405. dependencies: [
  406. "FirebaseFirestore",
  407. "FirebaseFirestoreSwift",
  408. ],
  409. path: "FirebaseCombineSwift/Sources/Firestore"
  410. ),
  411. .target(
  412. name: "FirebaseStorageCombineSwift",
  413. dependencies: [
  414. "FirebaseStorage",
  415. "FirebaseStorageSwift",
  416. ],
  417. path: "FirebaseCombineSwift/Sources/Storage"
  418. ),
  419. .target(
  420. name: "FirebaseCrashlytics",
  421. dependencies: ["FirebaseCore", "FirebaseInstallations",
  422. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  423. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  424. .product(name: "FBLPromises", package: "Promises"),
  425. .product(name: "nanopb", package: "nanopb")],
  426. path: "Crashlytics",
  427. exclude: [
  428. "run",
  429. "CHANGELOG.md",
  430. "LICENSE",
  431. "README.md",
  432. "ProtoSupport/",
  433. "UnitTests/",
  434. "generate_project.sh",
  435. "upload-symbols",
  436. "third_party/libunwind/LICENSE",
  437. ],
  438. sources: [
  439. "Crashlytics/",
  440. "Protogen/",
  441. "Shared/",
  442. "third_party/libunwind/dwarf.h",
  443. ],
  444. publicHeadersPath: "Crashlytics/Public",
  445. cSettings: [
  446. .headerSearchPath(".."),
  447. .define("DISPLAY_VERSION", to: firebaseVersion),
  448. .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])),
  449. .define("CLS_SDK_NAME", to: "Crashlytics macOS SDK", .when(platforms: [.macOS])),
  450. .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])),
  451. .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])),
  452. .define("PB_FIELD_32BIT", to: "1"),
  453. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  454. .define("PB_ENABLE_MALLOC", to: "1"),
  455. ],
  456. linkerSettings: [
  457. .linkedFramework("Security"),
  458. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  459. ]
  460. ),
  461. .target(
  462. name: "FirebaseDatabase",
  463. dependencies: [
  464. "FirebaseCore",
  465. "leveldb",
  466. ],
  467. path: "FirebaseDatabase/Sources",
  468. exclude: [
  469. "third_party/Wrap-leveldb/LICENSE",
  470. "third_party/SocketRocket/LICENSE",
  471. "third_party/FImmutableSortedDictionary/LICENSE",
  472. "third_party/SocketRocket/aa2297808c225710e267afece4439c256f6efdb3",
  473. ],
  474. publicHeadersPath: "Public",
  475. cSettings: [
  476. .headerSearchPath("../../"),
  477. ],
  478. linkerSettings: [
  479. .linkedFramework("CFNetwork"),
  480. .linkedFramework("Security"),
  481. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  482. .linkedFramework("WatchKit", .when(platforms: [.watchOS])),
  483. ]
  484. ),
  485. .testTarget(
  486. name: "DatabaseUnit",
  487. dependencies: ["FirebaseDatabase", "OCMock", "SharedTestUtilities"],
  488. path: "FirebaseDatabase/Tests/",
  489. exclude: [
  490. // Disable Swift tests as mixed targets are not supported (Xcode 12.4).
  491. "Unit/Swift",
  492. "Integration/",
  493. ],
  494. resources: [.process("Resources")],
  495. cSettings: [
  496. .headerSearchPath("../.."),
  497. ]
  498. ),
  499. .testTarget(
  500. name: "DatabaseUnitSwift",
  501. dependencies: ["FirebaseDatabase"],
  502. path: "FirebaseDatabase/Tests/Unit/Swift",
  503. cSettings: [
  504. .headerSearchPath("../.."),
  505. ]
  506. ),
  507. .target(
  508. name: "FirebaseDatabaseSwift",
  509. dependencies: ["FirebaseDatabase", "FirebaseSharedSwift"],
  510. path: "FirebaseDatabaseSwift/Sources"
  511. ),
  512. .testTarget(
  513. name: "FirebaseDatabaseSwiftTests",
  514. dependencies: ["FirebaseDatabase", "FirebaseDatabaseSwift"],
  515. path: "FirebaseDatabaseSwift/Tests/"
  516. ),
  517. .target(
  518. name: "FirebaseSharedSwift",
  519. path: "FirebaseSharedSwift/Sources",
  520. exclude: [
  521. "third_party/StructureEncoder/LICENSE",
  522. "third_party/StructureEncoder/METADATA",
  523. ]
  524. ),
  525. .testTarget(
  526. name: "FirebaseSharedSwiftTests",
  527. dependencies: ["FirebaseSharedSwift"],
  528. path: "FirebaseSharedSwift/Tests/"
  529. ),
  530. .target(
  531. name: "FirebaseDynamicLinksTarget",
  532. dependencies: [.target(name: "FirebaseDynamicLinks",
  533. condition: .when(platforms: [.iOS]))],
  534. path: "SwiftPM-PlatformExclude/FirebaseDynamicLinksWrap"
  535. ),
  536. .target(
  537. name: "FirebaseDynamicLinks",
  538. dependencies: ["FirebaseCore"],
  539. path: "FirebaseDynamicLinks/Sources",
  540. publicHeadersPath: "Public",
  541. cSettings: [
  542. .headerSearchPath("../../"),
  543. .define("FIRDynamicLinks3P", to: "1"),
  544. .define("GIN_SCION_LOGGING", to: "1"),
  545. ],
  546. linkerSettings: [
  547. .linkedFramework("QuartzCore"),
  548. ]
  549. ),
  550. .target(
  551. name: "FirebaseFirestoreTarget",
  552. dependencies: [.target(name: "FirebaseFirestore",
  553. condition: .when(platforms: [.iOS, .tvOS, .macOS]))],
  554. path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap"
  555. ),
  556. .target(
  557. name: "FirebaseFirestore",
  558. dependencies: [
  559. "FirebaseCore",
  560. "leveldb",
  561. .product(name: "nanopb", package: "nanopb"),
  562. .product(name: "abseil", package: "abseil"),
  563. .product(name: "gRPC-cpp", package: "gRPC"),
  564. ],
  565. path: "Firestore",
  566. exclude: [
  567. "CHANGELOG.md",
  568. "CMakeLists.txt",
  569. "Example/",
  570. "Protos/CMakeLists.txt",
  571. "Protos/Podfile",
  572. "Protos/README.md",
  573. "Protos/build_protos.py",
  574. "Protos/cpp/",
  575. "Protos/lib/",
  576. "Protos/nanopb_cpp_generator.py",
  577. "Protos/protos/",
  578. "README.md",
  579. "Source/CMakeLists.txt",
  580. "Swift/",
  581. "core/CMakeLists.txt",
  582. "core/src/util/config_detected.h.in",
  583. "core/test/",
  584. "fuzzing/",
  585. "test.sh",
  586. // Swift PM doesn't recognize hpp files, so we're relying on search paths
  587. // to find third_party/nlohmann_json/json.hpp.
  588. "third_party/",
  589. // Exclude alternate implementations for other platforms
  590. "core/src/remote/connectivity_monitor_noop.cc",
  591. "core/src/util/filesystem_win.cc",
  592. "core/src/util/log_stdio.cc",
  593. "core/src/util/secure_random_openssl.cc",
  594. ],
  595. sources: [
  596. "Source/",
  597. "Protos/nanopb/",
  598. "core/include/",
  599. "core/src",
  600. ],
  601. publicHeadersPath: "Source/Public",
  602. cSettings: [
  603. .headerSearchPath("../"),
  604. .headerSearchPath("Source/Public/FirebaseFirestore"),
  605. .headerSearchPath("Protos/nanopb"),
  606. .define("PB_FIELD_32BIT", to: "1"),
  607. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  608. .define("PB_ENABLE_MALLOC", to: "1"),
  609. .define("FIRFirestore_VERSION", to: firebaseVersion),
  610. ],
  611. linkerSettings: [
  612. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  613. .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS])),
  614. .linkedLibrary("c++"),
  615. ]
  616. ),
  617. .target(
  618. name: "FirebaseFirestoreSwiftTarget",
  619. dependencies: [.target(name: "FirebaseFirestoreSwift",
  620. condition: .when(platforms: [.iOS, .tvOS, .macOS]))],
  621. path: "SwiftPM-PlatformExclude/FirebaseFirestoreSwiftWrap"
  622. ),
  623. .target(
  624. name: "FirebaseFirestoreSwift",
  625. dependencies: ["FirebaseFirestore"],
  626. path: "Firestore",
  627. exclude: [
  628. "CHANGELOG.md",
  629. "CMakeLists.txt",
  630. "Example/",
  631. "Protos/",
  632. "README.md",
  633. "Source/",
  634. "core/",
  635. "fuzzing/",
  636. "test.sh",
  637. "Swift/CHANGELOG.md",
  638. "Swift/README.md",
  639. "Swift/Tests/",
  640. "third_party/nlohmann_json",
  641. "third_party/FirestoreEncoder/LICENSE",
  642. "third_party/FirestoreEncoder/METADATA",
  643. ],
  644. sources: [
  645. "Swift/Source/",
  646. "third_party/FirestoreEncoder/",
  647. ]
  648. ),
  649. // MARK: - Firebase Functions
  650. .target(
  651. name: "FirebaseFunctions",
  652. dependencies: [
  653. "FirebaseCore",
  654. .product(name: "GTMSessionFetcherCore", package: "GTMSessionFetcher"),
  655. ],
  656. path: "Functions/FirebaseFunctions",
  657. publicHeadersPath: "Public",
  658. cSettings: [
  659. .headerSearchPath("../../"),
  660. ]
  661. ),
  662. .target(
  663. name: "FirebaseFunctionsCombineSwift",
  664. dependencies: ["FirebaseFunctions"],
  665. path: "FirebaseCombineSwift/Sources/Functions"
  666. ),
  667. .testTarget(
  668. name: "FunctionsCombineUnit",
  669. dependencies: ["FirebaseFunctionsCombineSwift",
  670. "FirebaseFunctionsTestingSupport",
  671. "SharedTestUtilities"],
  672. path: "Functions/Tests/CombineUnit"
  673. ),
  674. .testTarget(
  675. name: "FunctionsUnit",
  676. dependencies: ["FirebaseFunctions",
  677. "SharedTestUtilities"],
  678. path: "Functions/Example/Tests/",
  679. cSettings: [
  680. .headerSearchPath("../../../"),
  681. ]
  682. ),
  683. .testTarget(
  684. name: "FunctionsUnitSwift",
  685. dependencies: ["FirebaseFunctions"],
  686. path: "Functions/Tests/Unit/Swift"
  687. ),
  688. .target(
  689. name: "FirebaseFunctionsTestingSupport",
  690. dependencies: ["FirebaseFunctions"],
  691. path: "FirebaseTestingSupport/Functions/Sources",
  692. publicHeadersPath: "Public",
  693. cSettings: [
  694. .headerSearchPath("../../.."),
  695. ]
  696. ),
  697. .target(
  698. name: "FirebaseInAppMessagingTarget",
  699. dependencies: [
  700. .target(name: "FirebaseInAppMessaging", condition: .when(platforms: [.iOS, .tvOS])),
  701. ],
  702. path: "SwiftPM-PlatformExclude/FirebaseInAppMessagingWrap"
  703. ),
  704. .target(
  705. name: "FirebaseInAppMessaging",
  706. dependencies: [
  707. "FirebaseCore",
  708. "FirebaseInstallations",
  709. "FirebaseABTesting",
  710. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  711. .product(name: "nanopb", package: "nanopb"),
  712. .target(name: "FirebaseInAppMessaging_iOS", condition: .when(platforms: [.iOS])),
  713. ],
  714. path: "FirebaseInAppMessaging/Sources",
  715. exclude: [
  716. "DefaultUI/CHANGELOG.md",
  717. "DefaultUI/README.md",
  718. ],
  719. publicHeadersPath: "Public",
  720. cSettings: [
  721. .headerSearchPath("../../"),
  722. .define("PB_FIELD_32BIT", to: "1"),
  723. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  724. .define("PB_ENABLE_MALLOC", to: "1"),
  725. ]
  726. ),
  727. .target(
  728. name: "FirebaseInAppMessaging_iOS",
  729. path: "FirebaseInAppMessaging/iOS",
  730. resources: [.process("Resources")]
  731. ),
  732. .target(
  733. name: "FirebaseInAppMessagingSwift",
  734. dependencies: ["FirebaseInAppMessaging"],
  735. path: "FirebaseInAppMessaging/Swift/Source"
  736. ),
  737. .target(
  738. name: "FirebaseInstallations",
  739. dependencies: [
  740. "FirebaseCore",
  741. .product(name: "FBLPromises", package: "Promises"),
  742. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  743. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  744. ],
  745. path: "FirebaseInstallations/Source/Library",
  746. publicHeadersPath: "Public",
  747. cSettings: [
  748. .headerSearchPath("../../../"),
  749. ],
  750. linkerSettings: [
  751. .linkedFramework("Security"),
  752. ]
  753. ),
  754. .target(
  755. name: "FirebaseMLModelDownloader",
  756. dependencies: [
  757. "FirebaseCore",
  758. "FirebaseInstallations",
  759. .product(name: "GULLogger", package: "GoogleUtilities"),
  760. "SwiftProtobuf",
  761. ],
  762. path: "FirebaseMLModelDownloader/Sources",
  763. exclude: [
  764. "proto/firebase_ml_log_sdk.proto",
  765. ],
  766. cSettings: [
  767. .define("FIRMLModelDownloader_VERSION", to: firebaseVersion),
  768. ]
  769. ),
  770. .testTarget(
  771. name: "FirebaseMLModelDownloaderUnit",
  772. dependencies: ["FirebaseMLModelDownloader"],
  773. path: "FirebaseMLModelDownloader/Tests/Unit"
  774. ),
  775. .target(
  776. name: "FirebaseMessaging",
  777. dependencies: [
  778. "FirebaseCore",
  779. "FirebaseInstallations",
  780. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  781. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  782. .product(name: "GULReachability", package: "GoogleUtilities"),
  783. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  784. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  785. .product(name: "nanopb", package: "nanopb"),
  786. ],
  787. path: "FirebaseMessaging/Sources",
  788. publicHeadersPath: "Public",
  789. cSettings: [
  790. .headerSearchPath("../../"),
  791. .define("PB_FIELD_32BIT", to: "1"),
  792. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  793. .define("PB_ENABLE_MALLOC", to: "1"),
  794. ],
  795. linkerSettings: [
  796. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  797. ]
  798. ),
  799. .testTarget(
  800. name: "MessagingUnit",
  801. dependencies: ["FirebaseMessaging", "SharedTestUtilities", "OCMock"],
  802. path: "FirebaseMessaging/Tests/UnitTests",
  803. exclude: [
  804. "FIRMessagingContextManagerServiceTest.m", // TODO: Adapt its NSBundle usage to SPM.
  805. ],
  806. cSettings: [
  807. .headerSearchPath("../../.."),
  808. ]
  809. ),
  810. .target(
  811. name: "FirebasePerformanceTarget",
  812. dependencies: [.target(name: "FirebasePerformance",
  813. condition: .when(platforms: [.iOS, .tvOS]))],
  814. path: "SwiftPM-PlatformExclude/FirebasePerformanceWrap"
  815. ),
  816. .target(
  817. name: "FirebasePerformance",
  818. dependencies: [
  819. "FirebaseCore",
  820. "FirebaseInstallations",
  821. "FirebaseRemoteConfig",
  822. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  823. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  824. .product(name: "GULISASwizzler", package: "GoogleUtilities"),
  825. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  826. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  827. .product(name: "nanopb", package: "nanopb"),
  828. ],
  829. path: "FirebasePerformance/Sources",
  830. publicHeadersPath: "Public",
  831. cSettings: [
  832. .headerSearchPath("../../"),
  833. .define("PB_FIELD_32BIT", to: "1"),
  834. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  835. .define("PB_ENABLE_MALLOC", to: "1"),
  836. .define("FIRPerformance_LIB_VERSION", to: firebaseVersion),
  837. ],
  838. linkerSettings: [
  839. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .tvOS])),
  840. .linkedFramework("MobileCoreServices", .when(platforms: [.iOS, .tvOS])),
  841. .linkedFramework("QuartzCore", .when(platforms: [.iOS, .tvOS])),
  842. ]
  843. ),
  844. .testTarget(
  845. name: "PerformanceUnit",
  846. dependencies: [
  847. "FirebasePerformanceTarget",
  848. "OCMock",
  849. "SharedTestUtilities",
  850. "GCDWebServer",
  851. ],
  852. path: "FirebasePerformance/Tests/Unit",
  853. resources: [
  854. .process("FPRURLFilterTests-Info.plist"),
  855. .process("Server/smallDownloadFile"),
  856. .process("Server/bigDownloadFile"),
  857. ],
  858. cSettings: [
  859. .headerSearchPath("../../.."),
  860. .define("PB_FIELD_32BIT", to: "1"),
  861. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  862. .define("PB_ENABLE_MALLOC", to: "1"),
  863. ]
  864. ),
  865. .target(
  866. name: "SharedTestUtilities",
  867. dependencies: ["FirebaseCore", "OCMock"],
  868. path: "SharedTestUtilities",
  869. publicHeadersPath: "./",
  870. cSettings: [
  871. .headerSearchPath("../"),
  872. ]
  873. ),
  874. .target(
  875. name: "FirebaseRemoteConfig",
  876. dependencies: [
  877. "FirebaseCore",
  878. "FirebaseABTesting",
  879. "FirebaseInstallations",
  880. .product(name: "GULNSData", package: "GoogleUtilities"),
  881. ],
  882. path: "FirebaseRemoteConfig/Sources",
  883. publicHeadersPath: "Public",
  884. cSettings: [
  885. .headerSearchPath("../../"),
  886. ]
  887. ),
  888. .testTarget(
  889. name: "RemoteConfigUnit",
  890. dependencies: ["FirebaseRemoteConfig", "OCMock"],
  891. path: "FirebaseRemoteConfig/Tests/Unit",
  892. exclude: [
  893. // Need to be evaluated/ported to RC V2.
  894. "RCNConfigAnalyticsTest.m",
  895. "RCNConfigSettingsTest.m",
  896. "RCNConfigTest.m",
  897. "RCNRemoteConfig+FIRAppTest.m",
  898. "RCNThrottlingTests.m",
  899. ],
  900. resources: [
  901. .process("SecondApp-GoogleService-Info.plist"),
  902. .process("Defaults-testInfo.plist"),
  903. .process("TestABTPayload.txt"),
  904. ],
  905. cSettings: [
  906. .headerSearchPath("../../.."),
  907. ]
  908. ),
  909. .target(
  910. name: "FirebaseStorage",
  911. dependencies: [
  912. "FirebaseCore",
  913. .product(name: "GTMSessionFetcherCore", package: "GTMSessionFetcher"),
  914. ],
  915. path: "FirebaseStorage/Sources",
  916. publicHeadersPath: "Public",
  917. cSettings: [
  918. .headerSearchPath("../../"),
  919. ],
  920. linkerSettings: [
  921. .linkedFramework("MobileCoreServices", .when(platforms: [.iOS])),
  922. .linkedFramework("CoreServices", .when(platforms: [.macOS])),
  923. ]
  924. ),
  925. .testTarget(
  926. name: "StorageUnit",
  927. dependencies: ["FirebaseStorage", "OCMock", "SharedTestUtilities"],
  928. path: "FirebaseStorage/Tests/Unit",
  929. cSettings: [
  930. .headerSearchPath("../../.."),
  931. ]
  932. ),
  933. .target(
  934. name: "FirebaseStorageSwift",
  935. dependencies: ["FirebaseStorage"],
  936. path: "FirebaseStorageSwift/Sources"
  937. ),
  938. .testTarget(
  939. name: "swift-test",
  940. dependencies: [
  941. "Firebase",
  942. "FirebaseAuth",
  943. "FirebaseAppCheck",
  944. "FirebaseABTesting",
  945. .target(name: "FirebaseAppDistribution",
  946. condition: .when(platforms: [.iOS])),
  947. "FirebaseAuthCombineSwift",
  948. "FirebaseFirestoreCombineSwift",
  949. "FirebaseFunctionsCombineSwift",
  950. "FirebaseStorageCombineSwift",
  951. "FirebaseCrashlytics",
  952. "FirebaseCore",
  953. "FirebaseDatabase",
  954. "FirebaseDynamicLinks",
  955. "FirebaseFirestore",
  956. "FirebaseFirestoreSwift",
  957. "FirebaseFunctions",
  958. "FirebaseInAppMessaging",
  959. .target(name: "FirebaseInAppMessagingSwift",
  960. condition: .when(platforms: [.iOS, .tvOS])),
  961. "FirebaseInstallations",
  962. "FirebaseMessaging",
  963. .target(name: "FirebasePerformance",
  964. condition: .when(platforms: [.iOS, .tvOS])),
  965. "FirebaseRemoteConfig",
  966. "FirebaseStorage",
  967. "FirebaseStorageSwift",
  968. .product(name: "nanopb", package: "nanopb"),
  969. ],
  970. path: "SwiftPMTests/swift-test"
  971. ),
  972. .testTarget(
  973. name: "analytics-import-test",
  974. dependencies: [
  975. "FirebaseAnalyticsSwiftTarget",
  976. "FirebaseAnalyticsWrapper",
  977. "Firebase",
  978. ],
  979. path: "SwiftPMTests/analytics-import-test"
  980. ),
  981. .testTarget(
  982. name: "objc-import-test",
  983. dependencies: [
  984. "Firebase",
  985. "FirebaseAuth",
  986. "FirebaseABTesting",
  987. "FirebaseAppCheck",
  988. .target(name: "FirebaseAppDistribution",
  989. condition: .when(platforms: [.iOS])),
  990. "FirebaseCrashlytics",
  991. "FirebaseCore",
  992. "FirebaseDatabase",
  993. "FirebaseDynamicLinks",
  994. "FirebaseFirestore",
  995. "FirebaseFunctions",
  996. "FirebaseInAppMessaging",
  997. "FirebaseInstallations",
  998. "FirebaseMessaging",
  999. .target(name: "FirebasePerformance",
  1000. condition: .when(platforms: [.iOS, .tvOS])),
  1001. "FirebaseRemoteConfig",
  1002. "FirebaseStorage",
  1003. ],
  1004. path: "SwiftPMTests/objc-import-test"
  1005. ),
  1006. .testTarget(
  1007. name: "version-test",
  1008. dependencies: [
  1009. "FirebaseCore",
  1010. ],
  1011. path: "SwiftPMTests/version-test",
  1012. cSettings: [
  1013. .define("FIR_VERSION", to: firebaseVersion),
  1014. ]
  1015. ),
  1016. // MARK: - Firebase App Check
  1017. .target(name: "FirebaseAppCheck",
  1018. dependencies: [
  1019. "FirebaseCore",
  1020. .product(name: "FBLPromises", package: "Promises"),
  1021. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1022. ],
  1023. path: "FirebaseAppCheck/Sources",
  1024. exclude: [
  1025. "Interop/CMakeLists.txt",
  1026. ],
  1027. publicHeadersPath: "Public",
  1028. cSettings: [
  1029. .headerSearchPath("../.."),
  1030. ],
  1031. linkerSettings: [
  1032. .linkedFramework("DeviceCheck"),
  1033. ]),
  1034. .testTarget(
  1035. name: "AppCheckUnit",
  1036. dependencies: ["FirebaseAppCheck", "OCMock", "SharedTestUtilities"],
  1037. path: "FirebaseAppCheck/Tests",
  1038. exclude: [
  1039. // Disable Swift tests as mixed targets are not supported (Xcode 12.3).
  1040. "Unit/Swift",
  1041. // Disable Keychain dependent tests as they require a host application on iOS.
  1042. "Integration",
  1043. "Unit/AppAttestProvider/Storage/FIRAppAttestArtifactStorageTests.m",
  1044. "Unit/Core/FIRAppCheckIntegrationTests.m",
  1045. "Unit/Core/FIRAppCheckStorageTests.m",
  1046. ],
  1047. resources: [
  1048. .process("Fixture"),
  1049. ],
  1050. cSettings: [
  1051. .headerSearchPath("../.."),
  1052. ]
  1053. ),
  1054. .testTarget(
  1055. name: "AppCheckUnitSwift",
  1056. dependencies: ["FirebaseAppCheck"],
  1057. path: "FirebaseAppCheck/Tests/Unit/Swift",
  1058. cSettings: [
  1059. .headerSearchPath("../.."),
  1060. ]
  1061. ),
  1062. // MARK: Testing support
  1063. .target(
  1064. name: "FirebaseFirestoreTestingSupport",
  1065. dependencies: ["FirebaseFirestore"],
  1066. path: "FirebaseTestingSupport/Firestore/Sources",
  1067. publicHeadersPath: "./",
  1068. cSettings: [
  1069. .headerSearchPath("../../.."),
  1070. .headerSearchPath("../../../Firestore/Source/Public/FirebaseFirestore"),
  1071. ]
  1072. ),
  1073. .testTarget(
  1074. name: "FirestoreTestingSupportTests",
  1075. dependencies: ["FirebaseFirestoreTestingSupport"],
  1076. path: "FirebaseTestingSupport/Firestore/Tests",
  1077. cSettings: [
  1078. .headerSearchPath("../../.."),
  1079. ]
  1080. ),
  1081. ],
  1082. cLanguageStandard: .c99,
  1083. cxxLanguageStandard: CXXLanguageStandard.gnucxx14
  1084. )