Package.swift 36 KB

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