Package.swift 27 KB

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