Package.swift 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965
  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. // This Package.swift is a Work in Progress. We intend to keep it functional
  17. // on the master branch, but it is rapidly evolving and may have occasional
  18. // breakages. Please report any issues at
  19. // https://github.com/firebase/firebase-ios-sdk/issues/new/choose.
  20. import PackageDescription
  21. let firebaseVersion = "7.4.0"
  22. let package = Package(
  23. name: "Firebase",
  24. platforms: [.iOS(.v10), .macOS(.v10_12), .tvOS(.v10), .watchOS(.v6)],
  25. products: [
  26. .library(
  27. name: "FirebaseAnalytics",
  28. targets: ["FirebaseAnalyticsTarget"]
  29. ),
  30. .library(
  31. name: "FirebaseAuth",
  32. targets: ["FirebaseAuth"]
  33. ),
  34. .library(
  35. name: "FirebaseAppDistribution-Beta",
  36. targets: ["FirebaseAppDistributionTarget"]
  37. ),
  38. .library(
  39. name: "FirebaseCrashlytics",
  40. targets: ["FirebaseCrashlytics"]
  41. ),
  42. .library(
  43. name: "FirebaseDatabase",
  44. targets: ["FirebaseDatabaseTarget"]
  45. ),
  46. .library(
  47. name: "FirebaseDynamicLinks",
  48. targets: ["FirebaseDynamicLinksTarget"]
  49. ),
  50. .library(
  51. name: "FirebaseFirestore",
  52. targets: ["FirebaseFirestoreTarget"]
  53. ),
  54. .library(
  55. name: "FirebaseFirestoreSwift-Beta",
  56. targets: ["FirebaseFirestoreSwiftTarget"]
  57. ),
  58. .library(
  59. name: "FirebaseFunctions",
  60. targets: ["FirebaseFunctionsTarget"]
  61. ),
  62. .library(
  63. name: "FirebaseInAppMessaging-Beta",
  64. targets: ["FirebaseInAppMessagingTarget"]
  65. ),
  66. .library(
  67. name: "FirebaseInstallations",
  68. targets: ["FirebaseInstallations"]
  69. ),
  70. .library(
  71. name: "FirebaseMessaging",
  72. targets: ["FirebaseMessaging"]
  73. ),
  74. .library(
  75. name: "FirebaseRemoteConfig",
  76. targets: ["FirebaseRemoteConfigTarget"]
  77. ),
  78. .library(
  79. name: "FirebaseStorage",
  80. targets: ["FirebaseStorage"]
  81. ),
  82. .library(
  83. name: "FirebaseStorageSwift-Beta",
  84. targets: ["FirebaseStorageSwift"]
  85. ),
  86. // Not intended for public consumption, but needed for FirebaseUI.
  87. .library(
  88. name: "GoogleUtilities_UserDefaults",
  89. targets: ["GoogleUtilities_UserDefaults"]
  90. ),
  91. ],
  92. dependencies: [
  93. .package(name: "Promises", url: "https://github.com/google/promises.git", "1.2.8" ..< "1.3.0"),
  94. .package(
  95. name: "SwiftProtobuf",
  96. url: "https://github.com/apple/swift-protobuf.git",
  97. from: "1.14.0"
  98. ),
  99. .package(
  100. name: "GTMSessionFetcher",
  101. url: "https://github.com/google/gtm-session-fetcher.git",
  102. "1.4.0" ..< "2.0.0"
  103. ),
  104. .package(
  105. name: "nanopb",
  106. url: "https://github.com/firebase/nanopb.git",
  107. // This revision adds SPM enablement to the 0.3.9.6 release tag.
  108. "2.30907.0" ..< "2.30908.0"
  109. ),
  110. .package(name: "abseil",
  111. url: "https://github.com/firebase/abseil-cpp-SwiftPM.git",
  112. from: "0.20200225.0"),
  113. .package(
  114. name: "gRPC",
  115. url: "https://github.com/firebase/grpc-SwiftPM.git",
  116. "1.28.2" ..< "1.29.0"
  117. ),
  118. .package(
  119. name: "OCMock",
  120. url: "https://github.com/firebase/ocmock.git",
  121. .revision("7291762d3551c5c7e31c49cce40a0e391a52e889")
  122. ),
  123. .package(
  124. name: "leveldb",
  125. url: "https://github.com/firebase/leveldb.git",
  126. "1.22.1" ..< "1.23.0"
  127. ),
  128. // Branches need a force update with a run with the revision set like below.
  129. // .package(url: "https://github.com/paulb777/nanopb.git", .revision("564392bd87bd093c308a3aaed3997466efb95f74"))
  130. ],
  131. targets: [
  132. .target(
  133. name: "Firebase",
  134. path: "CoreOnly/Sources",
  135. publicHeadersPath: "./"
  136. ),
  137. .target(
  138. name: "FirebaseCore",
  139. dependencies: [
  140. "Firebase",
  141. "FirebaseCoreDiagnostics",
  142. "GoogleUtilities_Environment",
  143. "GoogleUtilities_Logger",
  144. ],
  145. path: "FirebaseCore/Sources",
  146. publicHeadersPath: "Public",
  147. cSettings: [
  148. .headerSearchPath("../.."),
  149. .define("Firebase_VERSION", to: firebaseVersion),
  150. // TODO: - Add support for cflags cSetting so that we can set the -fno-autolink option
  151. ],
  152. linkerSettings: [
  153. .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS])),
  154. .linkedFramework("AppKit", .when(platforms: [.macOS])),
  155. ]
  156. ),
  157. .testTarget(
  158. name: "CoreUnit",
  159. dependencies: ["FirebaseCore", "SharedTestUtilities", "OCMock"],
  160. path: "FirebaseCore/Tests/Unit",
  161. exclude: ["Resources/GoogleService-Info.plist"],
  162. cSettings: [
  163. .headerSearchPath("../../.."),
  164. ]
  165. ),
  166. .target(
  167. name: "FirebaseCoreDiagnostics",
  168. dependencies: [
  169. "GoogleDataTransport",
  170. "GoogleUtilities_Environment",
  171. "GoogleUtilities_Logger",
  172. .product(name: "nanopb", package: "nanopb"),
  173. ],
  174. path: "Firebase/CoreDiagnostics/FIRCDLibrary",
  175. publicHeadersPath: ".",
  176. cSettings: [
  177. .headerSearchPath("../../.."),
  178. .define("PB_FIELD_32BIT", to: "1"),
  179. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  180. .define("PB_ENABLE_MALLOC", to: "1"),
  181. ]
  182. ),
  183. .target(
  184. name: "FirebaseABTesting",
  185. dependencies: ["FirebaseCore"],
  186. path: "FirebaseABTesting/Sources",
  187. publicHeadersPath: "Public",
  188. cSettings: [
  189. .headerSearchPath("../../"),
  190. ]
  191. ),
  192. .testTarget(
  193. name: "ABTestingUnit",
  194. dependencies: ["FirebaseABTesting", "OCMock"],
  195. path: "FirebaseABTesting/Tests/Unit",
  196. resources: [.process("Resources")],
  197. cSettings: [
  198. .headerSearchPath("../../.."),
  199. ]
  200. ),
  201. .target(
  202. name: "FirebaseAnalyticsTarget",
  203. dependencies: [.target(name: "FirebaseAnalyticsWrapper",
  204. condition: .when(platforms: [.iOS]))],
  205. path: "SwiftPM-PlatformExclude/FirebaseAnalyticsWrap"
  206. ),
  207. .target(
  208. name: "FirebaseAnalyticsWrapper",
  209. dependencies: [
  210. .target(name: "FirebaseAnalytics", condition: .when(platforms: [.iOS])),
  211. .target(name: "GoogleAppMeasurement", condition: .when(platforms: [.iOS])),
  212. "FirebaseCore",
  213. "FirebaseInstallations",
  214. "GoogleUtilities_AppDelegateSwizzler",
  215. "GoogleUtilities_MethodSwizzler",
  216. "GoogleUtilities_NSData",
  217. "GoogleUtilities_Network",
  218. .product(name: "nanopb", package: "nanopb"),
  219. ],
  220. path: "FirebaseAnalyticsWrapper",
  221. linkerSettings: [
  222. .linkedLibrary("sqlite3"),
  223. .linkedLibrary("c++"),
  224. .linkedLibrary("z"),
  225. .linkedFramework("StoreKit"),
  226. ]
  227. ),
  228. .binaryTarget(
  229. name: "FirebaseAnalytics",
  230. url: "https://dl.google.com/firebase/ios/swiftpm/7.4.0/FirebaseAnalytics.zip",
  231. checksum: "560bf11462c9e064c0d55e10aef761af420f4f531415e896cac18edc88e9666f"
  232. ),
  233. .binaryTarget(
  234. name: "GoogleAppMeasurement",
  235. url: "https://dl.google.com/firebase/ios/swiftpm/7.4.0/GoogleAppMeasurement.zip",
  236. checksum: "5c4e13589e8b5c357309dd8e5f57d81ab3e3ee5a731b034c4703e700d60d667a"
  237. ),
  238. .target(
  239. name: "FirebaseAppDistributionTarget",
  240. dependencies: [.target(name: "FirebaseAppDistribution",
  241. condition: .when(platforms: [.iOS]))],
  242. path: "SwiftPM-PlatformExclude/FirebaseAppDistributionWrap"
  243. ),
  244. .target(
  245. name: "FirebaseAppDistribution",
  246. dependencies: ["FirebaseCore",
  247. "FirebaseInstallations",
  248. "GoogleDataTransport",
  249. "GoogleUtilities_AppDelegateSwizzler",
  250. "GoogleUtilities_UserDefaults"],
  251. path: "FirebaseAppDistribution/Sources",
  252. publicHeadersPath: "Public",
  253. cSettings: [
  254. .headerSearchPath("../../"),
  255. ]
  256. ),
  257. .testTarget(
  258. name: "AppDistributionUnit",
  259. dependencies: ["FirebaseAppDistribution", "OCMock"],
  260. path: "FirebaseAppDistribution/Tests/Unit",
  261. resources: [.process("Resources")],
  262. cSettings: [
  263. .headerSearchPath("../../.."),
  264. ]
  265. ),
  266. .target(
  267. name: "FirebaseAuth",
  268. dependencies: ["FirebaseCore",
  269. "GoogleUtilities_Environment",
  270. "GoogleUtilities_AppDelegateSwizzler",
  271. .product(name: "GTMSessionFetcherCore", package: "GTMSessionFetcher")],
  272. path: "FirebaseAuth/Sources",
  273. publicHeadersPath: "Public",
  274. cSettings: [
  275. .headerSearchPath("../../"),
  276. ],
  277. linkerSettings: [
  278. .linkedFramework("Security"),
  279. .linkedFramework("SafariServices", .when(platforms: [.iOS])),
  280. ]
  281. ),
  282. .testTarget(
  283. name: "AuthUnit",
  284. dependencies: ["FirebaseAuth", "OCMock"],
  285. path: "FirebaseAuth/Tests/Unit",
  286. exclude: [
  287. "FIRAuthKeychainServicesTests.m", // TODO: figure out SPM keychain testing
  288. "FIRAuthTests.m",
  289. "FIRUserTests.m",
  290. ],
  291. cSettings: [
  292. .headerSearchPath("../../.."),
  293. ]
  294. ),
  295. .target(
  296. name: "FirebaseCrashlytics",
  297. dependencies: ["FirebaseCore", "FirebaseInstallations", "GoogleDataTransport",
  298. .product(name: "FBLPromises", package: "Promises"),
  299. .product(name: "nanopb", package: "nanopb")],
  300. path: "Crashlytics",
  301. exclude: [
  302. "run",
  303. "CHANGELOG.md",
  304. "LICENSE",
  305. "README.md",
  306. "Data/",
  307. "Protos/",
  308. "ProtoSupport/",
  309. "UnitTests/",
  310. "generate_project.sh",
  311. "upload-symbols",
  312. "third_party/libunwind/LICENSE",
  313. ],
  314. sources: [
  315. "Crashlytics/",
  316. "Protogen/",
  317. "Shared/",
  318. "third_party/libunwind/dwarf.h",
  319. ],
  320. publicHeadersPath: "Crashlytics/Public",
  321. cSettings: [
  322. .headerSearchPath(".."),
  323. .define("DISPLAY_VERSION", to: firebaseVersion),
  324. .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])),
  325. .define("CLS_SDK_NAME", to: "Crashlytics macOS SDK", .when(platforms: [.macOS])),
  326. .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])),
  327. .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])),
  328. .define("PB_FIELD_32BIT", to: "1"),
  329. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  330. .define("PB_ENABLE_MALLOC", to: "1"),
  331. ],
  332. linkerSettings: [
  333. .linkedFramework("Security"),
  334. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  335. ]
  336. ),
  337. .target(
  338. name: "FirebaseDatabaseTarget",
  339. dependencies: [.target(name: "FirebaseDatabase",
  340. condition: .when(platforms: [.iOS, .tvOS, .macOS]))],
  341. path: "SwiftPM-PlatformExclude/FirebaseDatabaseWrap"
  342. ),
  343. .target(
  344. name: "FirebaseDatabase",
  345. dependencies: [
  346. "FirebaseCore",
  347. "leveldb",
  348. ],
  349. path: "FirebaseDatabase/Sources",
  350. exclude: [
  351. "third_party/Wrap-leveldb/LICENSE",
  352. "third_party/SocketRocket/LICENSE",
  353. "third_party/FImmutableSortedDictionary/LICENSE",
  354. "third_party/SocketRocket/aa2297808c225710e267afece4439c256f6efdb3",
  355. ],
  356. publicHeadersPath: "Public",
  357. cSettings: [
  358. .headerSearchPath("../../"),
  359. ],
  360. linkerSettings: [
  361. .linkedFramework("CFNetwork"),
  362. .linkedFramework("Security"),
  363. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  364. ]
  365. ),
  366. .testTarget(
  367. name: "DatabaseUnit",
  368. dependencies: ["FirebaseDatabase", "OCMock", "SharedTestUtilities"],
  369. path: "FirebaseDatabase/Tests/",
  370. exclude: [
  371. "Integration/",
  372. ],
  373. resources: [.process("Resources")],
  374. cSettings: [
  375. .headerSearchPath("../.."),
  376. ]
  377. ),
  378. .target(
  379. name: "FirebaseDynamicLinksTarget",
  380. dependencies: [.target(name: "FirebaseDynamicLinks",
  381. condition: .when(platforms: [.iOS]))],
  382. path: "SwiftPM-PlatformExclude/FirebaseDynamicLinksWrap"
  383. ),
  384. .target(
  385. name: "FirebaseDynamicLinks",
  386. dependencies: ["FirebaseCore"],
  387. path: "FirebaseDynamicLinks/Sources",
  388. publicHeadersPath: "Public",
  389. cSettings: [
  390. .headerSearchPath("../../"),
  391. .define("FIRDynamicLinks3P", to: "1"),
  392. .define("GIN_SCION_LOGGING", to: "1"),
  393. ],
  394. linkerSettings: [
  395. .linkedFramework("QuartzCore"),
  396. ]
  397. ),
  398. .target(
  399. name: "FirebaseFirestoreTarget",
  400. dependencies: [.target(name: "FirebaseFirestore",
  401. condition: .when(platforms: [.iOS, .tvOS, .macOS]))],
  402. path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap"
  403. ),
  404. .target(
  405. name: "FirebaseFirestore",
  406. dependencies: [
  407. "FirebaseCore",
  408. "leveldb",
  409. .product(name: "nanopb", package: "nanopb"),
  410. .product(name: "abseil", package: "abseil"),
  411. .product(name: "gRPC-cpp", package: "gRPC"),
  412. ],
  413. path: "Firestore",
  414. exclude: [
  415. "CHANGELOG.md",
  416. "CMakeLists.txt",
  417. "Example/",
  418. "Protos/CMakeLists.txt",
  419. "Protos/Podfile",
  420. "Protos/README.md",
  421. "Protos/build_protos.py",
  422. "Protos/cpp/",
  423. "Protos/lib/",
  424. "Protos/nanopb_cpp_generator.py",
  425. "Protos/protos/",
  426. "README.md",
  427. "Source/CMakeLists.txt",
  428. "Swift/",
  429. "core/CMakeLists.txt",
  430. "core/src/util/config_detected.h.in",
  431. "core/test/",
  432. "fuzzing/",
  433. "test.sh",
  434. "third_party/",
  435. // Exclude alternate implementations for other platforms
  436. "core/src/api/input_validation_std.cc",
  437. "core/src/remote/connectivity_monitor_noop.cc",
  438. "core/src/util/filesystem_win.cc",
  439. "core/src/util/hard_assert_stdio.cc",
  440. "core/src/util/log_stdio.cc",
  441. "core/src/util/secure_random_openssl.cc",
  442. ],
  443. sources: [
  444. "Source/",
  445. "Protos/nanopb/",
  446. "core/include/",
  447. "core/src",
  448. ],
  449. publicHeadersPath: "Source/Public",
  450. cSettings: [
  451. .headerSearchPath("../"),
  452. .headerSearchPath("Source/Public/FirebaseFirestore"),
  453. .headerSearchPath("Protos/nanopb"),
  454. .define("PB_FIELD_32BIT", to: "1"),
  455. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  456. .define("PB_ENABLE_MALLOC", to: "1"),
  457. .define("FIRFirestore_VERSION", to: firebaseVersion),
  458. ],
  459. linkerSettings: [
  460. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  461. .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS])),
  462. .linkedLibrary("c++"),
  463. ]
  464. ),
  465. .target(
  466. name: "FirebaseFirestoreSwiftTarget",
  467. dependencies: [.target(name: "FirebaseFirestoreSwift",
  468. condition: .when(platforms: [.iOS, .tvOS, .macOS]))],
  469. path: "SwiftPM-PlatformExclude/FirebaseFirestoreSwiftWrap"
  470. ),
  471. .target(
  472. name: "FirebaseFirestoreSwift",
  473. dependencies: ["FirebaseFirestore"],
  474. path: "Firestore",
  475. exclude: [
  476. "CHANGELOG.md",
  477. "CMakeLists.txt",
  478. "Example/",
  479. "Protos/",
  480. "README.md",
  481. "Source/",
  482. "core/",
  483. "fuzzing/",
  484. "test.sh",
  485. "Swift/CHANGELOG.md",
  486. "Swift/README.md",
  487. "Swift/Tests/",
  488. "third_party/FirestoreEncoder/LICENSE",
  489. "third_party/FirestoreEncoder/METADATA",
  490. ],
  491. sources: [
  492. "Swift/Source/",
  493. "third_party/FirestoreEncoder/",
  494. ]
  495. ),
  496. .target(
  497. name: "FirebaseFunctionsTarget",
  498. dependencies: [.target(name: "FirebaseFunctions",
  499. condition: .when(platforms: [.iOS, .tvOS, .macOS]))],
  500. path: "SwiftPM-PlatformExclude/FirebaseFunctionsWrap"
  501. ),
  502. .target(
  503. name: "FirebaseFunctions",
  504. dependencies: [
  505. "FirebaseCore",
  506. .product(name: "GTMSessionFetcherCore", package: "GTMSessionFetcher"),
  507. ],
  508. path: "Functions/FirebaseFunctions",
  509. publicHeadersPath: "Public",
  510. cSettings: [
  511. .headerSearchPath("../../"),
  512. ]
  513. ),
  514. .target(
  515. name: "FirebaseInAppMessagingTarget",
  516. dependencies: [.target(name: "FirebaseInAppMessaging",
  517. condition: .when(platforms: [.iOS]))],
  518. path: "SwiftPM-PlatformExclude/FirebaseInAppMessagingWrap"
  519. ),
  520. .target(
  521. name: "FirebaseInAppMessaging",
  522. dependencies: [
  523. "FirebaseCore",
  524. "FirebaseInstallations",
  525. "FirebaseABTesting",
  526. "GoogleUtilities_Environment",
  527. .product(name: "nanopb", package: "nanopb"),
  528. ],
  529. path: "FirebaseInAppMessaging/Sources",
  530. exclude: [
  531. "DefaultUI/CHANGELOG.md",
  532. "DefaultUI/README.md",
  533. ],
  534. resources: [.process("Resources")],
  535. publicHeadersPath: "Public",
  536. cSettings: [
  537. .headerSearchPath("../../"),
  538. .define("PB_FIELD_32BIT", to: "1"),
  539. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  540. .define("PB_ENABLE_MALLOC", to: "1"),
  541. ]
  542. ),
  543. .target(
  544. name: "FirebaseInstanceID",
  545. dependencies: ["FirebaseCore", "FirebaseInstallations",
  546. "GoogleUtilities_Environment", "GoogleUtilities_UserDefaults"],
  547. path: "Firebase/InstanceID",
  548. exclude: [
  549. "CHANGELOG.md",
  550. ],
  551. publicHeadersPath: "Public",
  552. cSettings: [
  553. .headerSearchPath("../../"),
  554. ]
  555. ),
  556. .target(
  557. name: "FirebaseInstallations",
  558. dependencies: ["FirebaseCore", .product(name: "FBLPromises", package: "Promises"),
  559. "GoogleUtilities_Environment", "GoogleUtilities_UserDefaults"],
  560. path: "FirebaseInstallations/Source/Library",
  561. publicHeadersPath: "Public",
  562. cSettings: [
  563. .headerSearchPath("../../../"),
  564. ],
  565. linkerSettings: [
  566. .linkedFramework("Security"),
  567. ]
  568. ),
  569. .target(
  570. name: "FirebaseMLModelDownloader",
  571. dependencies: [
  572. "FirebaseCore",
  573. "FirebaseInstallations",
  574. "SwiftProtobuf",
  575. ],
  576. path: "FirebaseMLModelDownloader/Sources",
  577. cSettings: [
  578. .define("FIRMLModelDownloader_VERSION", to: firebaseVersion),
  579. ]
  580. ),
  581. .testTarget(
  582. name: "FirebaseMLModelDownloaderUnit",
  583. dependencies: ["FirebaseMLModelDownloader"],
  584. path: "FirebaseMLModelDownloader/Tests/Unit"
  585. ),
  586. .target(
  587. name: "FirebaseMessaging",
  588. dependencies: [
  589. "FirebaseCore",
  590. "FirebaseInstanceID",
  591. "GoogleUtilities_AppDelegateSwizzler",
  592. "GoogleUtilities_Environment",
  593. "GoogleUtilities_Reachability",
  594. "GoogleUtilities_UserDefaults",
  595. ],
  596. path: "FirebaseMessaging/Sources",
  597. publicHeadersPath: "Public",
  598. cSettings: [
  599. .headerSearchPath("../../"),
  600. ],
  601. linkerSettings: [
  602. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  603. ]
  604. ),
  605. .testTarget(
  606. name: "MessagingUnit",
  607. dependencies: ["FirebaseMessaging", "OCMock"],
  608. path: "FirebaseMessaging/Tests/UnitTests",
  609. exclude: [
  610. "FIRMessagingContextManagerServiceTest.m", // TODO: Adapt its NSBundle usage to SPM.
  611. ],
  612. cSettings: [
  613. .headerSearchPath("../../.."),
  614. ]
  615. ),
  616. .target(
  617. name: "SharedTestUtilities",
  618. dependencies: ["FirebaseCore", "OCMock"],
  619. path: "SharedTestUtilities",
  620. publicHeadersPath: "./",
  621. cSettings: [
  622. .headerSearchPath("../"),
  623. ]
  624. ),
  625. .target(
  626. name: "FirebaseRemoteConfigTarget",
  627. dependencies: [.target(name: "FirebaseRemoteConfig",
  628. condition: .when(platforms: [.iOS, .tvOS, .macOS]))],
  629. path: "SwiftPM-PlatformExclude/FirebaseRemoteConfigWrap"
  630. ),
  631. .target(
  632. name: "FirebaseRemoteConfig",
  633. dependencies: [
  634. "FirebaseCore",
  635. "FirebaseABTesting",
  636. "FirebaseInstallations",
  637. "GoogleUtilities_NSData",
  638. ],
  639. path: "FirebaseRemoteConfig/Sources",
  640. publicHeadersPath: "Public",
  641. cSettings: [
  642. .headerSearchPath("../../"),
  643. ]
  644. ),
  645. .testTarget(
  646. name: "RemoteConfigUnit",
  647. dependencies: ["FirebaseRemoteConfig", "OCMock"],
  648. path: "FirebaseRemoteConfig/Tests/Unit",
  649. exclude: [
  650. // Need to be evaluated/ported to RC V2.
  651. "RCNConfigAnalyticsTest.m",
  652. "RCNConfigSettingsTest.m",
  653. "RCNConfigTest.m",
  654. "RCNRemoteConfig+FIRAppTest.m",
  655. "RCNThrottlingTests.m",
  656. ],
  657. resources: [
  658. .process("SecondApp-GoogleService-Info.plist"),
  659. .process("Defaults-testInfo.plist"),
  660. .process("TestABTPayload.txt"),
  661. ],
  662. cSettings: [
  663. .headerSearchPath("../../.."),
  664. ]
  665. ),
  666. .target(
  667. name: "FirebaseStorage",
  668. dependencies: [
  669. "FirebaseCore",
  670. .product(name: "GTMSessionFetcherCore", package: "GTMSessionFetcher"),
  671. ],
  672. path: "FirebaseStorage/Sources",
  673. publicHeadersPath: "Public",
  674. cSettings: [
  675. .headerSearchPath("../../"),
  676. ],
  677. linkerSettings: [
  678. .linkedFramework("MobileCoreServices", .when(platforms: [.iOS])),
  679. .linkedFramework("CoreServices", .when(platforms: [.macOS])),
  680. ]
  681. ),
  682. .testTarget(
  683. name: "StorageUnit",
  684. dependencies: ["FirebaseStorage", "OCMock", "SharedTestUtilities"],
  685. path: "FirebaseStorage/Tests/Unit",
  686. cSettings: [
  687. .headerSearchPath("../../.."),
  688. ]
  689. ),
  690. .target(
  691. name: "FirebaseStorageSwift",
  692. dependencies: ["FirebaseStorage"],
  693. path: "FirebaseStorageSwift/Sources"
  694. ),
  695. .target(
  696. name: "GoogleDataTransport",
  697. dependencies: [
  698. .product(name: "nanopb", package: "nanopb"),
  699. ],
  700. path: "GoogleDataTransport",
  701. exclude: [
  702. "CHANGELOG.md",
  703. "README.md",
  704. "generate_project.sh",
  705. "GDTCCTWatchOSTestApp/",
  706. "GDTWatchOSTestApp/",
  707. "GDTCCTTestApp/",
  708. "GDTTestApp/",
  709. "GDTCCTTests/",
  710. "GDTCORTests/",
  711. "ProtoSupport/",
  712. ],
  713. sources: [
  714. "GDTCORLibrary",
  715. "GDTCCTLibrary",
  716. ],
  717. publicHeadersPath: "GDTCORLibrary/Public",
  718. cSettings: [
  719. .headerSearchPath("../"),
  720. .define("GDTCOR_VERSION", to: "0.0.1"),
  721. .define("PB_FIELD_32BIT", to: "1"),
  722. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  723. .define("PB_ENABLE_MALLOC", to: "1"),
  724. ],
  725. linkerSettings: [
  726. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  727. .linkedFramework("CoreTelephony", .when(platforms: [.macOS, .iOS])),
  728. ]
  729. ),
  730. .testTarget(
  731. name: "swift-test",
  732. dependencies: [
  733. "FirebaseAuth",
  734. "FirebaseABTesting",
  735. .target(name: "FirebaseAppDistribution",
  736. condition: .when(platforms: [.iOS])),
  737. "Firebase",
  738. "FirebaseCrashlytics",
  739. "FirebaseCore",
  740. "FirebaseDatabase",
  741. "FirebaseDynamicLinks",
  742. "FirebaseFirestore",
  743. "FirebaseFirestoreSwift",
  744. "FirebaseFunctions",
  745. "FirebaseInAppMessaging",
  746. "FirebaseInstallations",
  747. "FirebaseMessaging",
  748. "FirebaseRemoteConfig",
  749. "FirebaseStorage",
  750. "FirebaseStorageSwift",
  751. "GoogleDataTransport",
  752. "GoogleUtilities_AppDelegateSwizzler",
  753. "GoogleUtilities_Environment",
  754. // "GoogleUtilities_ISASwizzler", // Build needs to disable ARC.
  755. "GoogleUtilities_Logger",
  756. "GoogleUtilities_MethodSwizzler",
  757. "GoogleUtilities_Network",
  758. "GoogleUtilities_NSData",
  759. "GoogleUtilities_Reachability",
  760. "GoogleUtilities_UserDefaults",
  761. .product(name: "nanopb", package: "nanopb"),
  762. ],
  763. path: "SwiftPMTests/swift-test"
  764. ),
  765. .testTarget(
  766. name: "analytics-import-test",
  767. dependencies: [
  768. "FirebaseAnalyticsWrapper",
  769. "Firebase",
  770. ],
  771. path: "SwiftPMTests/analytics-import-test"
  772. ),
  773. .testTarget(
  774. name: "objc-import-test",
  775. dependencies: [
  776. "FirebaseAuth",
  777. "FirebaseABTesting",
  778. .target(name: "FirebaseAppDistribution",
  779. condition: .when(platforms: [.iOS])),
  780. "Firebase",
  781. "FirebaseCrashlytics",
  782. "FirebaseCore",
  783. "FirebaseDatabase",
  784. "FirebaseDynamicLinks",
  785. "FirebaseFirestore",
  786. "FirebaseFunctions",
  787. "FirebaseInAppMessaging",
  788. "FirebaseInstallations",
  789. "FirebaseMessaging",
  790. "FirebaseRemoteConfig",
  791. "FirebaseStorage",
  792. ],
  793. path: "SwiftPMTests/objc-import-test"
  794. ),
  795. .testTarget(
  796. name: "version-test",
  797. dependencies: [
  798. "FirebaseCore",
  799. ],
  800. path: "SwiftPMTests/version-test",
  801. cSettings: [
  802. .define("FIR_VERSION", to: firebaseVersion),
  803. ]
  804. ),
  805. .target(
  806. name: "GoogleUtilities_AppDelegateSwizzler",
  807. dependencies: ["GoogleUtilities_Environment", "GoogleUtilities_Logger",
  808. "GoogleUtilities_Network"],
  809. path: "GoogleUtilities",
  810. exclude: [
  811. "CHANGELOG.md",
  812. "CMakeLists.txt",
  813. "LICENSE",
  814. "README.md",
  815. "AppDelegateSwizzler/README.md",
  816. "Environment/",
  817. "Network/",
  818. "ISASwizzler/",
  819. "Logger/",
  820. "MethodSwizzler/",
  821. "NSData+zlib/",
  822. "Reachability",
  823. "SwizzlerTestHelpers/",
  824. "Tests",
  825. "UserDefaults/",
  826. ],
  827. sources: [
  828. "AppDelegateSwizzler/",
  829. "SceneDelegateSwizzler/",
  830. "Common/*.h",
  831. ],
  832. publicHeadersPath: "AppDelegateSwizzler/Public",
  833. cSettings: [
  834. .headerSearchPath("../"),
  835. ]
  836. ),
  837. .target(
  838. name: "GoogleUtilities_Environment",
  839. dependencies: [.product(name: "FBLPromises", package: "Promises")],
  840. path: "GoogleUtilities/Environment",
  841. exclude: ["third_party/LICENSE"],
  842. publicHeadersPath: "Public",
  843. cSettings: [
  844. .headerSearchPath("../../"),
  845. ]
  846. ),
  847. .target(
  848. name: "GoogleUtilities_Logger",
  849. dependencies: ["GoogleUtilities_Environment"],
  850. path: "GoogleUtilities/Logger",
  851. publicHeadersPath: "Public",
  852. cSettings: [
  853. .headerSearchPath("../../"),
  854. ]
  855. ),
  856. // TODO: ISA_Swizzler requires building without ARC.
  857. .target(
  858. name: "GoogleUtilities_MethodSwizzler",
  859. dependencies: ["GoogleUtilities_Logger"],
  860. path: "GoogleUtilities/MethodSwizzler",
  861. publicHeadersPath: "Public",
  862. cSettings: [
  863. .headerSearchPath("../../"),
  864. ]
  865. ),
  866. .target(
  867. name: "GoogleUtilities_Network",
  868. dependencies: ["GoogleUtilities_Logger", "GoogleUtilities_NSData",
  869. "GoogleUtilities_Reachability"],
  870. path: "GoogleUtilities/Network",
  871. publicHeadersPath: "Public",
  872. cSettings: [
  873. .headerSearchPath("../.."),
  874. ]
  875. ),
  876. .target(
  877. name: "GoogleUtilities_NSData",
  878. path: "GoogleUtilities/NSData+zlib",
  879. publicHeadersPath: "Public",
  880. cSettings: [
  881. .headerSearchPath("../.."),
  882. ],
  883. linkerSettings: [
  884. .linkedLibrary("z"),
  885. ]
  886. ),
  887. .target(
  888. name: "GoogleUtilities_Reachability",
  889. dependencies: ["GoogleUtilities_Logger"],
  890. path: "GoogleUtilities/Reachability",
  891. publicHeadersPath: "Public",
  892. cSettings: [
  893. .headerSearchPath("../../"),
  894. ]
  895. ),
  896. .target(
  897. name: "GoogleUtilities_UserDefaults",
  898. dependencies: ["GoogleUtilities_Logger"],
  899. path: "GoogleUtilities/UserDefaults",
  900. publicHeadersPath: "Public",
  901. cSettings: [
  902. .headerSearchPath("../../"),
  903. ]
  904. ),
  905. // TODO: - need to port Network/third_party/GTMHTTPServer.m to ARC.
  906. // .testTarget(
  907. // name: "UtilitiesUnit",
  908. // dependencies: [
  909. // "OCMock",
  910. // "GoogleUtilities_AppDelegateSwizzler",
  911. // "GoogleUtilities_Environment",
  912. // "GoogleUtilities_ISASwizzler", // Build needs to disable ARC.
  913. // "GoogleUtilities_Logger",
  914. // "GoogleUtilities_MethodSwizzler",
  915. // "GoogleUtilities_Network",
  916. // "GoogleUtilities_NSData",
  917. // "GoogleUtilities_Reachability",
  918. // "GoogleUtilities_UserDefaults",
  919. // ],
  920. // path: "GoogleUtilities/Tests/Unit",
  921. // exclude: [
  922. // "Network/third_party/LICENSE",
  923. // "Network/third_party/GTMHTTPServer.m", // Requires disabling ARC
  924. // ],
  925. // cSettings: [
  926. // .headerSearchPath("../../.."),
  927. // ]
  928. // ),
  929. ],
  930. cLanguageStandard: .c99,
  931. cxxLanguageStandard: CXXLanguageStandard.gnucxx14
  932. )