Package.swift 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127
  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.1"
  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.1")
  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.1/FirebaseAnalytics.zip",
  295. checksum: "397688619b1d2eb2731fd06d094b95498e753519b4c0c75a6f7071bcafd9d1f1"
  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"],
  510. path: "FirebaseDatabaseSwift/Sources",
  511. exclude: [
  512. "third_party/RTDBEncoder/LICENSE",
  513. "third_party/RTDBEncoder/METADATA",
  514. ]
  515. ),
  516. .testTarget(
  517. name: "FirebaseDatabaseSwiftTests",
  518. dependencies: ["FirebaseDatabase", "FirebaseDatabaseSwift"],
  519. path: "FirebaseDatabaseSwift/Tests/"
  520. ),
  521. .target(
  522. name: "FirebaseDynamicLinksTarget",
  523. dependencies: [.target(name: "FirebaseDynamicLinks",
  524. condition: .when(platforms: [.iOS]))],
  525. path: "SwiftPM-PlatformExclude/FirebaseDynamicLinksWrap"
  526. ),
  527. .target(
  528. name: "FirebaseDynamicLinks",
  529. dependencies: ["FirebaseCore"],
  530. path: "FirebaseDynamicLinks/Sources",
  531. publicHeadersPath: "Public",
  532. cSettings: [
  533. .headerSearchPath("../../"),
  534. .define("FIRDynamicLinks3P", to: "1"),
  535. .define("GIN_SCION_LOGGING", to: "1"),
  536. ],
  537. linkerSettings: [
  538. .linkedFramework("QuartzCore"),
  539. ]
  540. ),
  541. .target(
  542. name: "FirebaseFirestoreTarget",
  543. dependencies: [.target(name: "FirebaseFirestore",
  544. condition: .when(platforms: [.iOS, .tvOS, .macOS]))],
  545. path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap"
  546. ),
  547. .target(
  548. name: "FirebaseFirestore",
  549. dependencies: [
  550. "FirebaseCore",
  551. "leveldb",
  552. .product(name: "nanopb", package: "nanopb"),
  553. .product(name: "abseil", package: "abseil"),
  554. .product(name: "gRPC-cpp", package: "gRPC"),
  555. ],
  556. path: "Firestore",
  557. exclude: [
  558. "CHANGELOG.md",
  559. "CMakeLists.txt",
  560. "Example/",
  561. "Protos/CMakeLists.txt",
  562. "Protos/Podfile",
  563. "Protos/README.md",
  564. "Protos/build_protos.py",
  565. "Protos/cpp/",
  566. "Protos/lib/",
  567. "Protos/nanopb_cpp_generator.py",
  568. "Protos/protos/",
  569. "README.md",
  570. "Source/CMakeLists.txt",
  571. "Swift/",
  572. "core/CMakeLists.txt",
  573. "core/src/util/config_detected.h.in",
  574. "core/test/",
  575. "fuzzing/",
  576. "test.sh",
  577. // Swift PM doesn't recognize hpp files, so we're relying on search paths
  578. // to find third_party/nlohmann_json/json.hpp.
  579. "third_party/",
  580. // Exclude alternate implementations for other platforms
  581. "core/src/remote/connectivity_monitor_noop.cc",
  582. "core/src/util/filesystem_win.cc",
  583. "core/src/util/log_stdio.cc",
  584. "core/src/util/secure_random_openssl.cc",
  585. ],
  586. sources: [
  587. "Source/",
  588. "Protos/nanopb/",
  589. "core/include/",
  590. "core/src",
  591. ],
  592. publicHeadersPath: "Source/Public",
  593. cSettings: [
  594. .headerSearchPath("../"),
  595. .headerSearchPath("Source/Public/FirebaseFirestore"),
  596. .headerSearchPath("Protos/nanopb"),
  597. .define("PB_FIELD_32BIT", to: "1"),
  598. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  599. .define("PB_ENABLE_MALLOC", to: "1"),
  600. .define("FIRFirestore_VERSION", to: firebaseVersion),
  601. ],
  602. linkerSettings: [
  603. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  604. .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS])),
  605. .linkedLibrary("c++"),
  606. ]
  607. ),
  608. .target(
  609. name: "FirebaseFirestoreSwiftTarget",
  610. dependencies: [.target(name: "FirebaseFirestoreSwift",
  611. condition: .when(platforms: [.iOS, .tvOS, .macOS]))],
  612. path: "SwiftPM-PlatformExclude/FirebaseFirestoreSwiftWrap"
  613. ),
  614. .target(
  615. name: "FirebaseFirestoreSwift",
  616. dependencies: ["FirebaseFirestore"],
  617. path: "Firestore",
  618. exclude: [
  619. "CHANGELOG.md",
  620. "CMakeLists.txt",
  621. "Example/",
  622. "Protos/",
  623. "README.md",
  624. "Source/",
  625. "core/",
  626. "fuzzing/",
  627. "test.sh",
  628. "Swift/CHANGELOG.md",
  629. "Swift/README.md",
  630. "Swift/Tests/",
  631. "third_party/nlohmann_json",
  632. "third_party/FirestoreEncoder/LICENSE",
  633. "third_party/FirestoreEncoder/METADATA",
  634. ],
  635. sources: [
  636. "Swift/Source/",
  637. "third_party/FirestoreEncoder/",
  638. ]
  639. ),
  640. // MARK: - Firebase Functions
  641. .target(
  642. name: "FirebaseFunctions",
  643. dependencies: [
  644. "FirebaseCore",
  645. .product(name: "GTMSessionFetcherCore", package: "GTMSessionFetcher"),
  646. ],
  647. path: "FirebaseFunctions/Sources",
  648. publicHeadersPath: "Public",
  649. cSettings: [
  650. .headerSearchPath("../../"),
  651. ]
  652. ),
  653. .target(
  654. name: "FirebaseFunctionsCombineSwift",
  655. dependencies: ["FirebaseFunctions"],
  656. path: "FirebaseCombineSwift/Sources/Functions"
  657. ),
  658. .testTarget(
  659. name: "FunctionsCombineUnit",
  660. dependencies: ["FirebaseFunctionsCombineSwift",
  661. "FirebaseFunctionsTestingSupport",
  662. "SharedTestUtilities"],
  663. path: "FirebaseFunctions/Tests/CombineUnit"
  664. ),
  665. .testTarget(
  666. name: "FunctionsUnit",
  667. dependencies: ["FirebaseFunctions",
  668. "SharedTestUtilities"],
  669. path: "FirebaseFunctions/Tests/Unit",
  670. cSettings: [
  671. .headerSearchPath("../../../"),
  672. ]
  673. ),
  674. .testTarget(
  675. name: "FunctionsUnitSwift",
  676. dependencies: ["FirebaseFunctions"],
  677. path: "FirebaseFunctions/Tests/SwiftUnit"
  678. ),
  679. .testTarget(
  680. name: "FunctionsIntegration",
  681. dependencies: ["FirebaseFunctions",
  682. "SharedTestUtilities"],
  683. path: "FirebaseFunctions/Tests/Integration",
  684. cSettings: [
  685. .headerSearchPath("../../../"),
  686. ]
  687. ),
  688. .testTarget(
  689. name: "FunctionsSwiftIntegration",
  690. dependencies: ["FirebaseFunctions",
  691. "FirebaseFunctionsTestingSupport",
  692. "SharedTestUtilities"],
  693. path: "FirebaseFunctions/Tests/SwiftIntegration"
  694. ),
  695. .target(
  696. name: "FirebaseFunctionsTestingSupport",
  697. dependencies: ["FirebaseFunctions"],
  698. path: "FirebaseTestingSupport/Functions/Sources",
  699. publicHeadersPath: "Public",
  700. cSettings: [
  701. .headerSearchPath("../../.."),
  702. ]
  703. ),
  704. // MARK: - Firebase In App Messaging
  705. .target(
  706. name: "FirebaseInAppMessagingTarget",
  707. dependencies: [
  708. .target(name: "FirebaseInAppMessaging", condition: .when(platforms: [.iOS, .tvOS])),
  709. ],
  710. path: "SwiftPM-PlatformExclude/FirebaseInAppMessagingWrap"
  711. ),
  712. .target(
  713. name: "FirebaseInAppMessaging",
  714. dependencies: [
  715. "FirebaseCore",
  716. "FirebaseInstallations",
  717. "FirebaseABTesting",
  718. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  719. .product(name: "nanopb", package: "nanopb"),
  720. .target(name: "FirebaseInAppMessaging_iOS", condition: .when(platforms: [.iOS])),
  721. ],
  722. path: "FirebaseInAppMessaging/Sources",
  723. exclude: [
  724. "DefaultUI/CHANGELOG.md",
  725. "DefaultUI/README.md",
  726. ],
  727. publicHeadersPath: "Public",
  728. cSettings: [
  729. .headerSearchPath("../../"),
  730. .define("PB_FIELD_32BIT", to: "1"),
  731. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  732. .define("PB_ENABLE_MALLOC", to: "1"),
  733. ]
  734. ),
  735. .target(
  736. name: "FirebaseInAppMessaging_iOS",
  737. path: "FirebaseInAppMessaging/iOS",
  738. resources: [.process("Resources")]
  739. ),
  740. .target(
  741. name: "FirebaseInAppMessagingSwift",
  742. dependencies: ["FirebaseInAppMessaging"],
  743. path: "FirebaseInAppMessaging/Swift/Source"
  744. ),
  745. .target(
  746. name: "FirebaseInstallations",
  747. dependencies: [
  748. "FirebaseCore",
  749. .product(name: "FBLPromises", package: "Promises"),
  750. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  751. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  752. ],
  753. path: "FirebaseInstallations/Source/Library",
  754. publicHeadersPath: "Public",
  755. cSettings: [
  756. .headerSearchPath("../../../"),
  757. ],
  758. linkerSettings: [
  759. .linkedFramework("Security"),
  760. ]
  761. ),
  762. .target(
  763. name: "FirebaseMLModelDownloader",
  764. dependencies: [
  765. "FirebaseCore",
  766. "FirebaseInstallations",
  767. .product(name: "GULLogger", package: "GoogleUtilities"),
  768. "SwiftProtobuf",
  769. ],
  770. path: "FirebaseMLModelDownloader/Sources",
  771. exclude: [
  772. "proto/firebase_ml_log_sdk.proto",
  773. ],
  774. cSettings: [
  775. .define("FIRMLModelDownloader_VERSION", to: firebaseVersion),
  776. ]
  777. ),
  778. .testTarget(
  779. name: "FirebaseMLModelDownloaderUnit",
  780. dependencies: ["FirebaseMLModelDownloader"],
  781. path: "FirebaseMLModelDownloader/Tests/Unit"
  782. ),
  783. .target(
  784. name: "FirebaseMessaging",
  785. dependencies: [
  786. "FirebaseCore",
  787. "FirebaseInstallations",
  788. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  789. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  790. .product(name: "GULReachability", package: "GoogleUtilities"),
  791. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  792. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  793. .product(name: "nanopb", package: "nanopb"),
  794. ],
  795. path: "FirebaseMessaging/Sources",
  796. publicHeadersPath: "Public",
  797. cSettings: [
  798. .headerSearchPath("../../"),
  799. .define("PB_FIELD_32BIT", to: "1"),
  800. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  801. .define("PB_ENABLE_MALLOC", to: "1"),
  802. ],
  803. linkerSettings: [
  804. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  805. ]
  806. ),
  807. .testTarget(
  808. name: "MessagingUnit",
  809. dependencies: ["FirebaseMessaging", "SharedTestUtilities", "OCMock"],
  810. path: "FirebaseMessaging/Tests/UnitTests",
  811. exclude: [
  812. "FIRMessagingContextManagerServiceTest.m", // TODO: Adapt its NSBundle usage to SPM.
  813. ],
  814. cSettings: [
  815. .headerSearchPath("../../.."),
  816. ]
  817. ),
  818. .target(
  819. name: "FirebasePerformanceTarget",
  820. dependencies: [.target(name: "FirebasePerformance",
  821. condition: .when(platforms: [.iOS, .tvOS]))],
  822. path: "SwiftPM-PlatformExclude/FirebasePerformanceWrap"
  823. ),
  824. .target(
  825. name: "FirebasePerformance",
  826. dependencies: [
  827. "FirebaseCore",
  828. "FirebaseInstallations",
  829. "FirebaseRemoteConfig",
  830. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  831. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  832. .product(name: "GULISASwizzler", package: "GoogleUtilities"),
  833. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  834. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  835. .product(name: "nanopb", package: "nanopb"),
  836. ],
  837. path: "FirebasePerformance/Sources",
  838. publicHeadersPath: "Public",
  839. cSettings: [
  840. .headerSearchPath("../../"),
  841. .define("PB_FIELD_32BIT", to: "1"),
  842. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  843. .define("PB_ENABLE_MALLOC", to: "1"),
  844. .define("FIRPerformance_LIB_VERSION", to: firebaseVersion),
  845. ],
  846. linkerSettings: [
  847. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .tvOS])),
  848. .linkedFramework("MobileCoreServices", .when(platforms: [.iOS, .tvOS])),
  849. .linkedFramework("QuartzCore", .when(platforms: [.iOS, .tvOS])),
  850. ]
  851. ),
  852. .testTarget(
  853. name: "PerformanceUnit",
  854. dependencies: [
  855. "FirebasePerformanceTarget",
  856. "OCMock",
  857. "SharedTestUtilities",
  858. "GCDWebServer",
  859. ],
  860. path: "FirebasePerformance/Tests/Unit",
  861. resources: [
  862. .process("FPRURLFilterTests-Info.plist"),
  863. .process("Server/smallDownloadFile"),
  864. .process("Server/bigDownloadFile"),
  865. ],
  866. cSettings: [
  867. .headerSearchPath("../../.."),
  868. .define("PB_FIELD_32BIT", to: "1"),
  869. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  870. .define("PB_ENABLE_MALLOC", to: "1"),
  871. ]
  872. ),
  873. .target(
  874. name: "SharedTestUtilities",
  875. dependencies: ["FirebaseCore", "OCMock"],
  876. path: "SharedTestUtilities",
  877. publicHeadersPath: "./",
  878. cSettings: [
  879. .headerSearchPath("../"),
  880. ]
  881. ),
  882. .target(
  883. name: "FirebaseRemoteConfig",
  884. dependencies: [
  885. "FirebaseCore",
  886. "FirebaseABTesting",
  887. "FirebaseInstallations",
  888. .product(name: "GULNSData", package: "GoogleUtilities"),
  889. ],
  890. path: "FirebaseRemoteConfig/Sources",
  891. publicHeadersPath: "Public",
  892. cSettings: [
  893. .headerSearchPath("../../"),
  894. ]
  895. ),
  896. .testTarget(
  897. name: "RemoteConfigUnit",
  898. dependencies: ["FirebaseRemoteConfig", "OCMock"],
  899. path: "FirebaseRemoteConfig/Tests/Unit",
  900. exclude: [
  901. // Need to be evaluated/ported to RC V2.
  902. "RCNConfigAnalyticsTest.m",
  903. "RCNConfigSettingsTest.m",
  904. "RCNConfigTest.m",
  905. "RCNRemoteConfig+FIRAppTest.m",
  906. "RCNThrottlingTests.m",
  907. ],
  908. resources: [
  909. .process("SecondApp-GoogleService-Info.plist"),
  910. .process("Defaults-testInfo.plist"),
  911. .process("TestABTPayload.txt"),
  912. ],
  913. cSettings: [
  914. .headerSearchPath("../../.."),
  915. ]
  916. ),
  917. .target(
  918. name: "FirebaseStorage",
  919. dependencies: [
  920. "FirebaseCore",
  921. .product(name: "GTMSessionFetcherCore", package: "GTMSessionFetcher"),
  922. ],
  923. path: "FirebaseStorage/Sources",
  924. publicHeadersPath: "Public",
  925. cSettings: [
  926. .headerSearchPath("../../"),
  927. ],
  928. linkerSettings: [
  929. .linkedFramework("MobileCoreServices", .when(platforms: [.iOS])),
  930. .linkedFramework("CoreServices", .when(platforms: [.macOS])),
  931. ]
  932. ),
  933. .testTarget(
  934. name: "StorageUnit",
  935. dependencies: ["FirebaseStorage", "OCMock", "SharedTestUtilities"],
  936. path: "FirebaseStorage/Tests/Unit",
  937. cSettings: [
  938. .headerSearchPath("../../.."),
  939. ]
  940. ),
  941. .target(
  942. name: "FirebaseStorageSwift",
  943. dependencies: ["FirebaseStorage"],
  944. path: "FirebaseStorageSwift/Sources"
  945. ),
  946. .testTarget(
  947. name: "swift-test",
  948. dependencies: [
  949. "Firebase",
  950. "FirebaseAuth",
  951. "FirebaseAppCheck",
  952. "FirebaseABTesting",
  953. .target(name: "FirebaseAppDistribution",
  954. condition: .when(platforms: [.iOS])),
  955. "FirebaseAuthCombineSwift",
  956. "FirebaseFirestoreCombineSwift",
  957. "FirebaseFunctionsCombineSwift",
  958. "FirebaseStorageCombineSwift",
  959. "FirebaseCrashlytics",
  960. "FirebaseCore",
  961. "FirebaseDatabase",
  962. "FirebaseDynamicLinks",
  963. "FirebaseFirestore",
  964. "FirebaseFirestoreSwift",
  965. "FirebaseFunctions",
  966. "FirebaseInAppMessaging",
  967. .target(name: "FirebaseInAppMessagingSwift",
  968. condition: .when(platforms: [.iOS, .tvOS])),
  969. "FirebaseInstallations",
  970. "FirebaseMessaging",
  971. .target(name: "FirebasePerformance",
  972. condition: .when(platforms: [.iOS, .tvOS])),
  973. "FirebaseRemoteConfig",
  974. "FirebaseStorage",
  975. "FirebaseStorageSwift",
  976. .product(name: "nanopb", package: "nanopb"),
  977. ],
  978. path: "SwiftPMTests/swift-test"
  979. ),
  980. .testTarget(
  981. name: "analytics-import-test",
  982. dependencies: [
  983. "FirebaseAnalyticsSwiftTarget",
  984. "FirebaseAnalyticsWrapper",
  985. "Firebase",
  986. ],
  987. path: "SwiftPMTests/analytics-import-test"
  988. ),
  989. .testTarget(
  990. name: "objc-import-test",
  991. dependencies: [
  992. "Firebase",
  993. "FirebaseAuth",
  994. "FirebaseABTesting",
  995. "FirebaseAppCheck",
  996. .target(name: "FirebaseAppDistribution",
  997. condition: .when(platforms: [.iOS])),
  998. "FirebaseCrashlytics",
  999. "FirebaseCore",
  1000. "FirebaseDatabase",
  1001. "FirebaseDynamicLinks",
  1002. "FirebaseFirestore",
  1003. "FirebaseFunctions",
  1004. "FirebaseInAppMessaging",
  1005. "FirebaseInstallations",
  1006. "FirebaseMessaging",
  1007. .target(name: "FirebasePerformance",
  1008. condition: .when(platforms: [.iOS, .tvOS])),
  1009. "FirebaseRemoteConfig",
  1010. "FirebaseStorage",
  1011. ],
  1012. path: "SwiftPMTests/objc-import-test"
  1013. ),
  1014. .testTarget(
  1015. name: "version-test",
  1016. dependencies: [
  1017. "FirebaseCore",
  1018. ],
  1019. path: "SwiftPMTests/version-test",
  1020. cSettings: [
  1021. .define("FIR_VERSION", to: firebaseVersion),
  1022. ]
  1023. ),
  1024. // MARK: - Firebase App Check
  1025. .target(name: "FirebaseAppCheck",
  1026. dependencies: [
  1027. "FirebaseCore",
  1028. .product(name: "FBLPromises", package: "Promises"),
  1029. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1030. ],
  1031. path: "FirebaseAppCheck/Sources",
  1032. exclude: [
  1033. "Interop/CMakeLists.txt",
  1034. ],
  1035. publicHeadersPath: "Public",
  1036. cSettings: [
  1037. .headerSearchPath("../.."),
  1038. ],
  1039. linkerSettings: [
  1040. .linkedFramework("DeviceCheck"),
  1041. ]),
  1042. .testTarget(
  1043. name: "AppCheckUnit",
  1044. dependencies: ["FirebaseAppCheck", "OCMock", "SharedTestUtilities"],
  1045. path: "FirebaseAppCheck/Tests",
  1046. exclude: [
  1047. // Disable Swift tests as mixed targets are not supported (Xcode 12.3).
  1048. "Unit/Swift",
  1049. // Disable Keychain dependent tests as they require a host application on iOS.
  1050. "Integration",
  1051. "Unit/AppAttestProvider/Storage/FIRAppAttestArtifactStorageTests.m",
  1052. "Unit/Core/FIRAppCheckIntegrationTests.m",
  1053. "Unit/Core/FIRAppCheckStorageTests.m",
  1054. ],
  1055. resources: [
  1056. .process("Fixture"),
  1057. ],
  1058. cSettings: [
  1059. .headerSearchPath("../.."),
  1060. ]
  1061. ),
  1062. .testTarget(
  1063. name: "AppCheckUnitSwift",
  1064. dependencies: ["FirebaseAppCheck"],
  1065. path: "FirebaseAppCheck/Tests/Unit/Swift",
  1066. cSettings: [
  1067. .headerSearchPath("../.."),
  1068. ]
  1069. ),
  1070. // MARK: Testing support
  1071. .target(
  1072. name: "FirebaseFirestoreTestingSupport",
  1073. dependencies: ["FirebaseFirestore"],
  1074. path: "FirebaseTestingSupport/Firestore/Sources",
  1075. publicHeadersPath: "./",
  1076. cSettings: [
  1077. .headerSearchPath("../../.."),
  1078. .headerSearchPath("../../../Firestore/Source/Public/FirebaseFirestore"),
  1079. ]
  1080. ),
  1081. .testTarget(
  1082. name: "FirestoreTestingSupportTests",
  1083. dependencies: ["FirebaseFirestoreTestingSupport"],
  1084. path: "FirebaseTestingSupport/Firestore/Tests",
  1085. cSettings: [
  1086. .headerSearchPath("../../.."),
  1087. ]
  1088. ),
  1089. ],
  1090. cLanguageStandard: .c99,
  1091. cxxLanguageStandard: CXXLanguageStandard.gnucxx14
  1092. )