Package.swift 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113
  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.8.1"
  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. .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: ["FirebaseFunctionsTarget"]
  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.8.0")
  144. ),
  145. .package(
  146. name: "GoogleDataTransport",
  147. url: "https://github.com/google/GoogleDataTransport.git",
  148. "9.1.1" ..< "10.0.0"
  149. ),
  150. .package(
  151. name: "GoogleUtilities",
  152. url: "https://github.com/google/GoogleUtilities.git",
  153. "7.5.2" ..< "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("21cce26d223d49a9ab5ae47f28864f422bfe3951")
  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])),
  273. .product(name: "GoogleAppMeasurement",
  274. package: "GoogleAppMeasurement",
  275. condition: .when(platforms: [.iOS])),
  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.8.0/FirebaseAnalytics.zip",
  295. checksum: "819afe896c8a2c34c5e00676b4a452815b1b6bcd11b0de7043a9eed449c442ea"
  296. ),
  297. .target(
  298. name: "FirebaseAnalyticsSwiftTarget",
  299. dependencies: [.target(name: "FirebaseAnalyticsSwift",
  300. condition: .when(platforms: [.iOS]))],
  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]))],
  312. path: "SwiftPM-PlatformExclude/FirebaseAnalyticsWithoutAdIdSupportWrap"
  313. ),
  314. .target(
  315. name: "FirebaseAnalyticsWithoutAdIdSupportWrapper",
  316. dependencies: [
  317. .target(name: "FirebaseAnalytics", condition: .when(platforms: [.iOS])),
  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: "FirebaseFunctionsTarget",
  643. dependencies: [.target(name: "FirebaseFunctions",
  644. condition: .when(platforms: [.iOS, .tvOS, .macOS]))],
  645. path: "SwiftPM-PlatformExclude/FirebaseFunctionsWrap"
  646. ),
  647. .target(
  648. name: "FirebaseFunctions",
  649. dependencies: [
  650. "FirebaseCore",
  651. .product(name: "GTMSessionFetcherCore", package: "GTMSessionFetcher"),
  652. ],
  653. path: "Functions/FirebaseFunctions",
  654. publicHeadersPath: "Public",
  655. cSettings: [
  656. .headerSearchPath("../../"),
  657. ]
  658. ),
  659. .target(
  660. name: "FirebaseFunctionsCombineSwift",
  661. dependencies: ["FirebaseFunctions"],
  662. path: "FirebaseCombineSwift/Sources/Functions"
  663. ),
  664. .testTarget(
  665. name: "FunctionsCombineUnit",
  666. dependencies: ["FirebaseFunctionsCombineSwift",
  667. "FirebaseFunctionsTestingSupport",
  668. "SharedTestUtilities"],
  669. path: "Functions/Tests/CombineUnit"
  670. ),
  671. .testTarget(
  672. name: "FunctionsUnit",
  673. dependencies: ["FirebaseFunctions",
  674. "SharedTestUtilities"],
  675. path: "Functions/Example/Tests/",
  676. cSettings: [
  677. .headerSearchPath("../../../"),
  678. ]
  679. ),
  680. .testTarget(
  681. name: "FunctionsUnitSwift",
  682. dependencies: ["FirebaseFunctions"],
  683. path: "Functions/Tests/Unit/Swift"
  684. ),
  685. .target(
  686. name: "FirebaseFunctionsTestingSupport",
  687. dependencies: ["FirebaseFunctions"],
  688. path: "FirebaseTestingSupport/Functions/Sources",
  689. publicHeadersPath: "Public",
  690. cSettings: [
  691. .headerSearchPath("../../.."),
  692. ]
  693. ),
  694. .target(
  695. name: "FirebaseInAppMessagingTarget",
  696. dependencies: [
  697. .target(name: "FirebaseInAppMessaging", condition: .when(platforms: [.iOS, .tvOS])),
  698. ],
  699. path: "SwiftPM-PlatformExclude/FirebaseInAppMessagingWrap"
  700. ),
  701. .target(
  702. name: "FirebaseInAppMessaging",
  703. dependencies: [
  704. "FirebaseCore",
  705. "FirebaseInstallations",
  706. "FirebaseABTesting",
  707. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  708. .product(name: "nanopb", package: "nanopb"),
  709. .target(name: "FirebaseInAppMessaging_iOS", condition: .when(platforms: [.iOS])),
  710. ],
  711. path: "FirebaseInAppMessaging/Sources",
  712. exclude: [
  713. "DefaultUI/CHANGELOG.md",
  714. "DefaultUI/README.md",
  715. ],
  716. publicHeadersPath: "Public",
  717. cSettings: [
  718. .headerSearchPath("../../"),
  719. .define("PB_FIELD_32BIT", to: "1"),
  720. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  721. .define("PB_ENABLE_MALLOC", to: "1"),
  722. ]
  723. ),
  724. .target(
  725. name: "FirebaseInAppMessaging_iOS",
  726. path: "FirebaseInAppMessaging/iOS",
  727. resources: [.process("Resources")]
  728. ),
  729. .target(
  730. name: "FirebaseInAppMessagingSwift",
  731. dependencies: ["FirebaseInAppMessaging"],
  732. path: "FirebaseInAppMessaging/Swift/Source"
  733. ),
  734. .target(
  735. name: "FirebaseInstallations",
  736. dependencies: [
  737. "FirebaseCore",
  738. .product(name: "FBLPromises", package: "Promises"),
  739. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  740. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  741. ],
  742. path: "FirebaseInstallations/Source/Library",
  743. publicHeadersPath: "Public",
  744. cSettings: [
  745. .headerSearchPath("../../../"),
  746. ],
  747. linkerSettings: [
  748. .linkedFramework("Security"),
  749. ]
  750. ),
  751. .target(
  752. name: "FirebaseMLModelDownloader",
  753. dependencies: [
  754. "FirebaseCore",
  755. "FirebaseInstallations",
  756. .product(name: "GULLogger", package: "GoogleUtilities"),
  757. "SwiftProtobuf",
  758. ],
  759. path: "FirebaseMLModelDownloader/Sources",
  760. exclude: [
  761. "proto/firebase_ml_log_sdk.proto",
  762. ],
  763. cSettings: [
  764. .define("FIRMLModelDownloader_VERSION", to: firebaseVersion),
  765. ]
  766. ),
  767. .testTarget(
  768. name: "FirebaseMLModelDownloaderUnit",
  769. dependencies: ["FirebaseMLModelDownloader"],
  770. path: "FirebaseMLModelDownloader/Tests/Unit"
  771. ),
  772. .target(
  773. name: "FirebaseMessaging",
  774. dependencies: [
  775. "FirebaseCore",
  776. "FirebaseInstallations",
  777. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  778. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  779. .product(name: "GULReachability", package: "GoogleUtilities"),
  780. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  781. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  782. .product(name: "nanopb", package: "nanopb"),
  783. ],
  784. path: "FirebaseMessaging/Sources",
  785. publicHeadersPath: "Public",
  786. cSettings: [
  787. .headerSearchPath("../../"),
  788. .define("PB_FIELD_32BIT", to: "1"),
  789. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  790. .define("PB_ENABLE_MALLOC", to: "1"),
  791. ],
  792. linkerSettings: [
  793. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  794. ]
  795. ),
  796. .testTarget(
  797. name: "MessagingUnit",
  798. dependencies: ["FirebaseMessaging", "SharedTestUtilities", "OCMock"],
  799. path: "FirebaseMessaging/Tests/UnitTests",
  800. exclude: [
  801. "FIRMessagingContextManagerServiceTest.m", // TODO: Adapt its NSBundle usage to SPM.
  802. ],
  803. cSettings: [
  804. .headerSearchPath("../../.."),
  805. ]
  806. ),
  807. .target(
  808. name: "FirebasePerformanceTarget",
  809. dependencies: [.target(name: "FirebasePerformance",
  810. condition: .when(platforms: [.iOS, .tvOS]))],
  811. path: "SwiftPM-PlatformExclude/FirebasePerformanceWrap"
  812. ),
  813. .target(
  814. name: "FirebasePerformance",
  815. dependencies: [
  816. "FirebaseCore",
  817. "FirebaseInstallations",
  818. "FirebaseRemoteConfig",
  819. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  820. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  821. .product(name: "GULISASwizzler", package: "GoogleUtilities"),
  822. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  823. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  824. .product(name: "nanopb", package: "nanopb"),
  825. ],
  826. path: "FirebasePerformance/Sources",
  827. publicHeadersPath: "Public",
  828. cSettings: [
  829. .headerSearchPath("../../"),
  830. .define("PB_FIELD_32BIT", to: "1"),
  831. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  832. .define("PB_ENABLE_MALLOC", to: "1"),
  833. .define("FIRPerformance_LIB_VERSION", to: firebaseVersion),
  834. ],
  835. linkerSettings: [
  836. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .tvOS])),
  837. .linkedFramework("MobileCoreServices", .when(platforms: [.iOS, .tvOS])),
  838. .linkedFramework("QuartzCore", .when(platforms: [.iOS, .tvOS])),
  839. ]
  840. ),
  841. .testTarget(
  842. name: "PerformanceUnit",
  843. dependencies: [
  844. "FirebasePerformanceTarget",
  845. "OCMock",
  846. "SharedTestUtilities",
  847. "GCDWebServer",
  848. ],
  849. path: "FirebasePerformance/Tests/Unit",
  850. resources: [
  851. .process("FPRURLFilterTests-Info.plist"),
  852. .process("Server/smallDownloadFile"),
  853. .process("Server/bigDownloadFile"),
  854. ],
  855. cSettings: [
  856. .headerSearchPath("../../.."),
  857. .define("PB_FIELD_32BIT", to: "1"),
  858. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  859. .define("PB_ENABLE_MALLOC", to: "1"),
  860. ]
  861. ),
  862. .target(
  863. name: "SharedTestUtilities",
  864. dependencies: ["FirebaseCore", "OCMock"],
  865. path: "SharedTestUtilities",
  866. publicHeadersPath: "./",
  867. cSettings: [
  868. .headerSearchPath("../"),
  869. ]
  870. ),
  871. .target(
  872. name: "FirebaseRemoteConfig",
  873. dependencies: [
  874. "FirebaseCore",
  875. "FirebaseABTesting",
  876. "FirebaseInstallations",
  877. .product(name: "GULNSData", package: "GoogleUtilities"),
  878. ],
  879. path: "FirebaseRemoteConfig/Sources",
  880. publicHeadersPath: "Public",
  881. cSettings: [
  882. .headerSearchPath("../../"),
  883. ]
  884. ),
  885. .testTarget(
  886. name: "RemoteConfigUnit",
  887. dependencies: ["FirebaseRemoteConfig", "OCMock"],
  888. path: "FirebaseRemoteConfig/Tests/Unit",
  889. exclude: [
  890. // Need to be evaluated/ported to RC V2.
  891. "RCNConfigAnalyticsTest.m",
  892. "RCNConfigSettingsTest.m",
  893. "RCNConfigTest.m",
  894. "RCNRemoteConfig+FIRAppTest.m",
  895. "RCNThrottlingTests.m",
  896. ],
  897. resources: [
  898. .process("SecondApp-GoogleService-Info.plist"),
  899. .process("Defaults-testInfo.plist"),
  900. .process("TestABTPayload.txt"),
  901. ],
  902. cSettings: [
  903. .headerSearchPath("../../.."),
  904. ]
  905. ),
  906. .target(
  907. name: "FirebaseStorage",
  908. dependencies: [
  909. "FirebaseCore",
  910. .product(name: "GTMSessionFetcherCore", package: "GTMSessionFetcher"),
  911. ],
  912. path: "FirebaseStorage/Sources",
  913. publicHeadersPath: "Public",
  914. cSettings: [
  915. .headerSearchPath("../../"),
  916. ],
  917. linkerSettings: [
  918. .linkedFramework("MobileCoreServices", .when(platforms: [.iOS])),
  919. .linkedFramework("CoreServices", .when(platforms: [.macOS])),
  920. ]
  921. ),
  922. .testTarget(
  923. name: "StorageUnit",
  924. dependencies: ["FirebaseStorage", "OCMock", "SharedTestUtilities"],
  925. path: "FirebaseStorage/Tests/Unit",
  926. cSettings: [
  927. .headerSearchPath("../../.."),
  928. ]
  929. ),
  930. .target(
  931. name: "FirebaseStorageSwift",
  932. dependencies: ["FirebaseStorage"],
  933. path: "FirebaseStorageSwift/Sources"
  934. ),
  935. .testTarget(
  936. name: "swift-test",
  937. dependencies: [
  938. "Firebase",
  939. "FirebaseAuth",
  940. "FirebaseAppCheck",
  941. "FirebaseABTesting",
  942. .target(name: "FirebaseAppDistribution",
  943. condition: .when(platforms: [.iOS])),
  944. "FirebaseAuthCombineSwift",
  945. "FirebaseFirestoreCombineSwift",
  946. "FirebaseFunctionsCombineSwift",
  947. "FirebaseStorageCombineSwift",
  948. "FirebaseCrashlytics",
  949. "FirebaseCore",
  950. "FirebaseDatabase",
  951. "FirebaseDynamicLinks",
  952. "FirebaseFirestore",
  953. "FirebaseFirestoreSwift",
  954. "FirebaseFunctions",
  955. "FirebaseInAppMessaging",
  956. .target(name: "FirebaseInAppMessagingSwift",
  957. condition: .when(platforms: [.iOS, .tvOS])),
  958. "FirebaseInstallations",
  959. "FirebaseMessaging",
  960. .target(name: "FirebasePerformance",
  961. condition: .when(platforms: [.iOS, .tvOS])),
  962. "FirebaseRemoteConfig",
  963. "FirebaseStorage",
  964. "FirebaseStorageSwift",
  965. .product(name: "nanopb", package: "nanopb"),
  966. ],
  967. path: "SwiftPMTests/swift-test"
  968. ),
  969. .testTarget(
  970. name: "analytics-import-test",
  971. dependencies: [
  972. "FirebaseAnalyticsSwiftTarget",
  973. "FirebaseAnalyticsWrapper",
  974. "Firebase",
  975. ],
  976. path: "SwiftPMTests/analytics-import-test"
  977. ),
  978. .testTarget(
  979. name: "objc-import-test",
  980. dependencies: [
  981. "Firebase",
  982. "FirebaseAuth",
  983. "FirebaseABTesting",
  984. "FirebaseAppCheck",
  985. .target(name: "FirebaseAppDistribution",
  986. condition: .when(platforms: [.iOS])),
  987. "FirebaseCrashlytics",
  988. "FirebaseCore",
  989. "FirebaseDatabase",
  990. "FirebaseDynamicLinks",
  991. "FirebaseFirestore",
  992. "FirebaseFunctions",
  993. "FirebaseInAppMessaging",
  994. "FirebaseInstallations",
  995. "FirebaseMessaging",
  996. .target(name: "FirebasePerformance",
  997. condition: .when(platforms: [.iOS, .tvOS])),
  998. "FirebaseRemoteConfig",
  999. "FirebaseStorage",
  1000. ],
  1001. path: "SwiftPMTests/objc-import-test"
  1002. ),
  1003. .testTarget(
  1004. name: "version-test",
  1005. dependencies: [
  1006. "FirebaseCore",
  1007. ],
  1008. path: "SwiftPMTests/version-test",
  1009. cSettings: [
  1010. .define("FIR_VERSION", to: firebaseVersion),
  1011. ]
  1012. ),
  1013. // MARK: - Firebase App Check
  1014. .target(name: "FirebaseAppCheck",
  1015. dependencies: [
  1016. "FirebaseCore",
  1017. .product(name: "FBLPromises", package: "Promises"),
  1018. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1019. ],
  1020. path: "FirebaseAppCheck/Sources",
  1021. publicHeadersPath: "Public",
  1022. cSettings: [
  1023. .headerSearchPath("../.."),
  1024. ],
  1025. linkerSettings: [
  1026. .linkedFramework("DeviceCheck"),
  1027. ]),
  1028. .testTarget(
  1029. name: "AppCheckUnit",
  1030. dependencies: ["FirebaseAppCheck", "OCMock", "SharedTestUtilities"],
  1031. path: "FirebaseAppCheck/Tests",
  1032. exclude: [
  1033. // Disable Swift tests as mixed targets are not supported (Xcode 12.3).
  1034. "Unit/Swift",
  1035. // Disable Keychain dependent tests as they require a host application on iOS.
  1036. "Integration",
  1037. "Unit/AppAttestProvider/Storage/FIRAppAttestArtifactStorageTests.m",
  1038. "Unit/Core/FIRAppCheckIntegrationTests.m",
  1039. "Unit/Core/FIRAppCheckStorageTests.m",
  1040. ],
  1041. resources: [
  1042. .process("Fixture"),
  1043. ],
  1044. cSettings: [
  1045. .headerSearchPath("../.."),
  1046. ]
  1047. ),
  1048. .testTarget(
  1049. name: "AppCheckUnitSwift",
  1050. dependencies: ["FirebaseAppCheck"],
  1051. path: "FirebaseAppCheck/Tests/Unit/Swift",
  1052. cSettings: [
  1053. .headerSearchPath("../.."),
  1054. ]
  1055. ),
  1056. // MARK: Testing support
  1057. .target(
  1058. name: "FirebaseFirestoreTestingSupport",
  1059. dependencies: ["FirebaseFirestore"],
  1060. path: "FirebaseTestingSupport/Firestore/Sources",
  1061. publicHeadersPath: "./",
  1062. cSettings: [
  1063. .headerSearchPath("../../.."),
  1064. .headerSearchPath("../../../Firestore/Source/Public/FirebaseFirestore"),
  1065. ]
  1066. ),
  1067. .testTarget(
  1068. name: "FirestoreTestingSupportTests",
  1069. dependencies: ["FirebaseFirestoreTestingSupport"],
  1070. path: "FirebaseTestingSupport/Firestore/Tests",
  1071. cSettings: [
  1072. .headerSearchPath("../../.."),
  1073. ]
  1074. ),
  1075. ],
  1076. cLanguageStandard: .c99,
  1077. cxxLanguageStandard: CXXLanguageStandard.gnucxx14
  1078. )