Package.swift 31 KB

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