Package.swift 34 KB

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