Package.swift 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539
  1. // swift-tools-version:5.6
  2. // The swift-tools-version declares the minimum version of Swift required to
  3. // build this package.
  4. // Copyright 2020 Google LLC
  5. //
  6. // Licensed under the Apache License, Version 2.0 (the "License");
  7. // you may not use this file except in compliance with the License.
  8. // You may obtain a copy of the License at
  9. //
  10. // http://www.apache.org/licenses/LICENSE-2.0
  11. //
  12. // Unless required by applicable law or agreed to in writing, software
  13. // distributed under the License is distributed on an "AS IS" BASIS,
  14. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. // See the License for the specific language governing permissions and
  16. // limitations under the License.
  17. import PackageDescription
  18. import class Foundation.ProcessInfo
  19. let firebaseVersion = "10.18.0"
  20. let package = Package(
  21. name: "Firebase",
  22. platforms: [.iOS(.v11), .macCatalyst(.v13), .macOS(.v10_13), .tvOS(.v12), .watchOS(.v7)],
  23. products: [
  24. .library(
  25. name: "FirebaseAnalytics",
  26. targets: ["FirebaseAnalyticsTarget"]
  27. ),
  28. // Adding this library to your project is enough for it to take effect. The module
  29. // does not need to be imported into any source files.
  30. .library(
  31. name: "FirebaseAnalyticsWithoutAdIdSupport",
  32. targets: ["FirebaseAnalyticsWithoutAdIdSupportTarget"]
  33. ),
  34. // Adding this library to your project is enough for it to take effect. The module
  35. // does not need to be imported into any source files.
  36. .library(
  37. name: "FirebaseAnalyticsOnDeviceConversion",
  38. targets: ["FirebaseAnalyticsOnDeviceConversionTarget"]
  39. ),
  40. .library(
  41. name: "FirebaseAnalyticsSwift",
  42. targets: ["FirebaseAnalyticsSwiftTarget"]
  43. ),
  44. .library(
  45. name: "FirebaseAuth",
  46. targets: ["FirebaseAuth"]
  47. ),
  48. .library(
  49. name: "FirebaseAppCheck",
  50. targets: ["FirebaseAppCheck"]
  51. ),
  52. .library(
  53. name: "FirebaseAppDistribution-Beta",
  54. targets: ["FirebaseAppDistributionTarget"]
  55. ),
  56. .library(
  57. name: "FirebaseAuthCombine-Community",
  58. targets: ["FirebaseAuthCombineSwift"]
  59. ),
  60. .library(
  61. name: "FirebaseFirestoreCombine-Community",
  62. targets: ["FirebaseFirestoreCombineSwift"]
  63. ),
  64. .library(
  65. name: "FirebaseFunctionsCombine-Community",
  66. targets: ["FirebaseFunctionsCombineSwift"]
  67. ),
  68. .library(
  69. name: "FirebaseStorageCombine-Community",
  70. targets: ["FirebaseStorageCombineSwift"]
  71. ),
  72. .library(
  73. name: "FirebaseCrashlytics",
  74. targets: ["FirebaseCrashlytics"]
  75. ),
  76. .library(
  77. name: "FirebaseDatabase",
  78. targets: ["FirebaseDatabase"]
  79. ),
  80. .library(
  81. name: "FirebaseDatabaseSwift",
  82. targets: ["FirebaseDatabaseSwift"]
  83. ),
  84. .library(
  85. name: "FirebaseDynamicLinks",
  86. targets: ["FirebaseDynamicLinksTarget"]
  87. ),
  88. .library(
  89. name: "FirebaseFirestore",
  90. targets: ["FirebaseFirestoreTarget"]
  91. ),
  92. .library(
  93. name: "FirebaseFirestoreSwift",
  94. targets: ["FirebaseFirestoreSwiftTarget"]
  95. ),
  96. .library(
  97. name: "FirebaseFunctions",
  98. targets: ["FirebaseFunctions"]
  99. ),
  100. .library(
  101. name: "FirebaseInAppMessaging-Beta",
  102. targets: ["FirebaseInAppMessagingTarget"]
  103. ),
  104. .library(
  105. name: "FirebaseInAppMessagingSwift-Beta",
  106. targets: ["FirebaseInAppMessagingSwift"]
  107. ),
  108. .library(
  109. name: "FirebaseInstallations",
  110. targets: ["FirebaseInstallations"]
  111. ),
  112. .library(
  113. name: "FirebaseMessaging",
  114. targets: ["FirebaseMessaging"]
  115. ),
  116. .library(
  117. name: "FirebaseMLModelDownloader",
  118. targets: ["FirebaseMLModelDownloader"]
  119. ),
  120. .library(
  121. name: "FirebasePerformance",
  122. targets: ["FirebasePerformanceTarget"]
  123. ),
  124. .library(
  125. name: "FirebaseRemoteConfig",
  126. targets: ["FirebaseRemoteConfig"]
  127. ),
  128. .library(
  129. name: "FirebaseRemoteConfigSwift",
  130. targets: ["FirebaseRemoteConfigSwift"]
  131. ),
  132. .library(
  133. name: "FirebaseStorage",
  134. targets: ["FirebaseStorage"]
  135. ),
  136. ],
  137. dependencies: [
  138. .package(
  139. url: "https://github.com/google/promises.git",
  140. "2.1.0" ..< "3.0.0"
  141. ),
  142. .package(
  143. url: "https://github.com/apple/swift-protobuf.git",
  144. "1.19.0" ..< "2.0.0"
  145. ),
  146. googleAppMeasurementDependency(),
  147. .package(
  148. url: "https://github.com/google/GoogleDataTransport.git",
  149. "9.2.0" ..< "10.0.0"
  150. ),
  151. .package(
  152. url: "https://github.com/google/GoogleUtilities.git",
  153. "7.11.0" ..< "8.0.0"
  154. ),
  155. .package(
  156. url: "https://github.com/google/gtm-session-fetcher.git",
  157. "2.1.0" ..< "4.0.0"
  158. ),
  159. .package(
  160. url: "https://github.com/firebase/nanopb.git",
  161. "2.30909.0" ..< "2.30910.0"
  162. ),
  163. abseilDependency(),
  164. grpcDependency(),
  165. .package(
  166. url: "https://github.com/erikdoe/ocmock.git",
  167. revision: "c5eeaa6dde7c308a5ce48ae4d4530462dd3a1110"
  168. ),
  169. .package(
  170. url: "https://github.com/firebase/leveldb.git",
  171. "1.22.2" ..< "1.23.0"
  172. ),
  173. .package(
  174. url: "https://github.com/SlaunchaMan/GCDWebServer.git",
  175. revision: "935e2736044e71e5341663c3cc9a335ba6867a2b"
  176. ),
  177. .package(
  178. url: "https://github.com/google/interop-ios-for-google-sdks.git",
  179. "100.0.0" ..< "101.0.0"
  180. ),
  181. ],
  182. targets: [
  183. .target(
  184. name: "Firebase",
  185. path: "CoreOnly/Sources",
  186. publicHeadersPath: "./"
  187. ),
  188. .target(
  189. name: "FirebaseCore",
  190. dependencies: [
  191. "Firebase",
  192. "FirebaseCoreInternal",
  193. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  194. .product(name: "GULLogger", package: "GoogleUtilities"),
  195. ],
  196. path: "FirebaseCore/Sources",
  197. publicHeadersPath: "Public",
  198. cSettings: [
  199. .headerSearchPath("../.."),
  200. .define("Firebase_VERSION", to: firebaseVersion),
  201. // TODO: - Add support for cflags cSetting so that we can set the -fno-autolink option
  202. ],
  203. linkerSettings: [
  204. .linkedFramework("UIKit", .when(platforms: [.iOS, .macCatalyst, .tvOS])),
  205. .linkedFramework("AppKit", .when(platforms: [.macOS])),
  206. ]
  207. ),
  208. .testTarget(
  209. name: "CoreUnit",
  210. dependencies: [
  211. "FirebaseCore",
  212. "SharedTestUtilities",
  213. .product(name: "OCMock", package: "ocmock"),
  214. ],
  215. path: "FirebaseCore/Tests/Unit",
  216. exclude: ["Resources/GoogleService-Info.plist"],
  217. cSettings: [
  218. .headerSearchPath("../../.."),
  219. ]
  220. ),
  221. // MARK: - Firebase Core Extension
  222. // Extension of FirebaseCore for consuming by Swift product SDKs.
  223. // When depending on `FirebaseCoreExtension`, also depend on `FirebaseCore`
  224. // to avoid potential linker issues.
  225. .target(
  226. name: "FirebaseCoreExtension",
  227. path: "FirebaseCore/Extension",
  228. publicHeadersPath: ".",
  229. cSettings: [
  230. .headerSearchPath("../../"),
  231. ]
  232. ),
  233. // MARK: - Firebase Core Internal
  234. // Shared collection of APIs for internal FirebaseCore usage.
  235. .target(
  236. name: "FirebaseCoreInternal",
  237. dependencies: [
  238. .product(name: "GULNSData", package: "GoogleUtilities"),
  239. ],
  240. path: "FirebaseCore/Internal/Sources"
  241. ),
  242. .testTarget(
  243. name: "FirebaseCoreInternalTests",
  244. dependencies: [
  245. "FirebaseCoreInternal",
  246. ],
  247. path: "FirebaseCore/Internal/Tests"
  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", .product(name: "OCMock", package: "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, .macCatalyst, .macOS, .tvOS]))],
  271. path: "SwiftPM-PlatformExclude/FirebaseAnalyticsWrap"
  272. ),
  273. .target(
  274. name: "FirebaseAnalyticsWrapper",
  275. dependencies: [
  276. .target(
  277. name: "FirebaseAnalytics",
  278. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  279. ),
  280. .product(name: "GoogleAppMeasurement",
  281. package: "GoogleAppMeasurement",
  282. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])),
  283. "FirebaseCore",
  284. "FirebaseInstallations",
  285. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  286. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  287. .product(name: "GULNSData", package: "GoogleUtilities"),
  288. .product(name: "GULNetwork", package: "GoogleUtilities"),
  289. .product(name: "nanopb", package: "nanopb"),
  290. ],
  291. path: "FirebaseAnalyticsWrapper",
  292. linkerSettings: [
  293. .linkedLibrary("sqlite3"),
  294. .linkedLibrary("c++"),
  295. .linkedLibrary("z"),
  296. .linkedFramework("StoreKit"),
  297. ]
  298. ),
  299. .binaryTarget(
  300. name: "FirebaseAnalytics",
  301. url: "https://dl.google.com/firebase/ios/swiftpm/10.17.0/FirebaseAnalytics.zip",
  302. checksum: "94a559d3801a445802c4bc6e6a50b283eff7dd25f8994e63a06589dbb6c18bdf"
  303. ),
  304. .target(
  305. name: "FirebaseAnalyticsSwiftTarget",
  306. dependencies: [.target(name: "FirebaseAnalyticsSwift",
  307. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS]))],
  308. path: "SwiftPM-PlatformExclude/FirebaseAnalyticsSwiftWrap"
  309. ),
  310. .target(
  311. name: "FirebaseAnalyticsSwift",
  312. dependencies: ["FirebaseAnalyticsWrapper"],
  313. path: "FirebaseAnalyticsSwift/Sources"
  314. ),
  315. .testTarget(
  316. name: "AnalyticsSwiftUnit",
  317. dependencies: ["FirebaseAnalyticsSwift"],
  318. path: "FirebaseAnalyticsSwift/Tests/SwiftUnit"
  319. ),
  320. .testTarget(
  321. name: "AnalyticsObjCAPI",
  322. dependencies: ["FirebaseAnalyticsSwift"],
  323. path: "FirebaseAnalyticsSwift/Tests/ObjCAPI"
  324. ),
  325. .target(
  326. name: "FirebaseAnalyticsWithoutAdIdSupportTarget",
  327. dependencies: [.target(name: "FirebaseAnalyticsWithoutAdIdSupportWrapper",
  328. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS]))],
  329. path: "SwiftPM-PlatformExclude/FirebaseAnalyticsWithoutAdIdSupportWrap"
  330. ),
  331. .target(
  332. name: "FirebaseAnalyticsWithoutAdIdSupportWrapper",
  333. dependencies: [
  334. .target(
  335. name: "FirebaseAnalytics",
  336. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  337. ),
  338. .product(name: "GoogleAppMeasurementWithoutAdIdSupport",
  339. package: "GoogleAppMeasurement",
  340. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])),
  341. "FirebaseCore",
  342. "FirebaseInstallations",
  343. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  344. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  345. .product(name: "GULNSData", package: "GoogleUtilities"),
  346. .product(name: "GULNetwork", package: "GoogleUtilities"),
  347. .product(name: "nanopb", package: "nanopb"),
  348. ],
  349. path: "FirebaseAnalyticsWithoutAdIdSupportWrapper",
  350. linkerSettings: [
  351. .linkedLibrary("sqlite3"),
  352. .linkedLibrary("c++"),
  353. .linkedLibrary("z"),
  354. .linkedFramework("StoreKit"),
  355. ]
  356. ),
  357. .target(
  358. name: "FirebaseAnalyticsOnDeviceConversionTarget",
  359. dependencies: [
  360. .product(name: "GoogleAppMeasurementOnDeviceConversion",
  361. package: "GoogleAppMeasurement",
  362. condition: .when(platforms: [.iOS])),
  363. ],
  364. path: "FirebaseAnalyticsOnDeviceConversionWrapper",
  365. linkerSettings: [
  366. .linkedLibrary("c++"),
  367. ]
  368. ),
  369. .target(
  370. name: "FirebaseAppDistributionTarget",
  371. dependencies: [.target(name: "FirebaseAppDistribution",
  372. condition: .when(platforms: [.iOS]))],
  373. path: "SwiftPM-PlatformExclude/FirebaseAppDistributionWrap"
  374. ),
  375. .target(
  376. name: "FirebaseAppDistribution",
  377. dependencies: [
  378. "FirebaseCore",
  379. "FirebaseInstallations",
  380. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  381. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  382. ],
  383. path: "FirebaseAppDistribution/Sources",
  384. publicHeadersPath: "Public",
  385. cSettings: [
  386. .headerSearchPath("../../"),
  387. ]
  388. ),
  389. .testTarget(
  390. name: "AppDistributionUnit",
  391. dependencies: ["FirebaseAppDistribution", .product(name: "OCMock", package: "ocmock")],
  392. path: "FirebaseAppDistribution/Tests/Unit",
  393. exclude: ["Swift/"],
  394. resources: [.process("Resources")],
  395. cSettings: [
  396. .headerSearchPath("../../.."),
  397. ]
  398. ),
  399. .testTarget(
  400. name: "AppDistributionUnitSwift",
  401. dependencies: ["FirebaseAppDistribution"],
  402. path: "FirebaseAppDistribution/Tests/Unit/Swift",
  403. cSettings: [
  404. .headerSearchPath("../../../.."),
  405. ]
  406. ),
  407. .target(
  408. name: "FirebaseAuth",
  409. dependencies: [
  410. "FirebaseAppCheckInterop",
  411. "FirebaseCore",
  412. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  413. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  414. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  415. .product(name: "RecaptchaInterop", package: "interop-ios-for-google-sdks"),
  416. ],
  417. path: "FirebaseAuth/Sources",
  418. publicHeadersPath: "Public",
  419. cSettings: [
  420. .headerSearchPath("../../"),
  421. ],
  422. linkerSettings: [
  423. .linkedFramework("Security"),
  424. .linkedFramework("SafariServices", .when(platforms: [.iOS])),
  425. ]
  426. ),
  427. // Internal headers only for consuming from Swift.
  428. .target(
  429. name: "FirebaseAuthInterop",
  430. path: "FirebaseAuth/Interop",
  431. exclude: [
  432. "CMakeLists.txt",
  433. ],
  434. publicHeadersPath: ".",
  435. cSettings: [
  436. .headerSearchPath("../../"),
  437. ]
  438. ),
  439. .testTarget(
  440. name: "AuthUnit",
  441. dependencies: [
  442. "FirebaseAuth",
  443. .product(name: "OCMock", package: "ocmock"),
  444. ],
  445. path: "FirebaseAuth/Tests/Unit",
  446. exclude: [
  447. "FIRAuthKeychainServicesTests.m", // TODO: figure out SPM keychain testing
  448. "FIRAuthTests.m",
  449. "FIRUserTests.m",
  450. ],
  451. cSettings: [
  452. .headerSearchPath("../../.."),
  453. ]
  454. ),
  455. .target(
  456. name: "FirebaseAuthCombineSwift",
  457. dependencies: ["FirebaseAuth"],
  458. path: "FirebaseCombineSwift/Sources/Auth"
  459. ),
  460. .target(
  461. name: "FirebaseFirestoreCombineSwift",
  462. dependencies: [
  463. "FirebaseFirestoreTarget",
  464. "FirebaseFirestoreSwift",
  465. ],
  466. path: "FirebaseCombineSwift/Sources/Firestore"
  467. ),
  468. .target(
  469. name: "FirebaseStorageCombineSwift",
  470. dependencies: [
  471. "FirebaseStorage",
  472. ],
  473. path: "FirebaseCombineSwift/Sources/Storage"
  474. ),
  475. .target(
  476. name: "FirebaseCrashlytics",
  477. dependencies: ["FirebaseCore", "FirebaseInstallations", "FirebaseSessions",
  478. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  479. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  480. .product(name: "FBLPromises", package: "Promises"),
  481. .product(name: "nanopb", package: "nanopb")],
  482. path: "Crashlytics",
  483. exclude: [
  484. "run",
  485. "CHANGELOG.md",
  486. "LICENSE",
  487. "README.md",
  488. "ProtoSupport/",
  489. "UnitTests/",
  490. "generate_project.sh",
  491. "upload-symbols",
  492. "CrashlyticsInputFiles.xcfilelist",
  493. "third_party/libunwind/LICENSE",
  494. ],
  495. sources: [
  496. "Crashlytics/",
  497. "Protogen/",
  498. "Shared/",
  499. "third_party/libunwind/dwarf.h",
  500. ],
  501. publicHeadersPath: "Crashlytics/Public",
  502. cSettings: [
  503. .headerSearchPath(".."),
  504. .define("DISPLAY_VERSION", to: firebaseVersion),
  505. .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])),
  506. .define(
  507. "CLS_SDK_NAME",
  508. to: "Crashlytics macOS SDK",
  509. .when(platforms: [.macOS, .macCatalyst])
  510. ),
  511. .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])),
  512. .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])),
  513. .define("PB_FIELD_32BIT", to: "1"),
  514. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  515. .define("PB_ENABLE_MALLOC", to: "1"),
  516. ],
  517. linkerSettings: [
  518. .linkedFramework("Security"),
  519. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  520. ]
  521. ),
  522. .testTarget(
  523. name: "FirebaseCrashlyticsUnit",
  524. dependencies: ["FirebaseCrashlytics", .product(name: "OCMock", package: "ocmock")],
  525. path: "Crashlytics/UnitTests",
  526. resources: [
  527. .copy("FIRCLSMachO/machO_data"),
  528. .copy("Data"),
  529. ],
  530. cSettings: [
  531. .headerSearchPath("../.."),
  532. .define("DISPLAY_VERSION", to: firebaseVersion),
  533. .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])),
  534. .define(
  535. "CLS_SDK_NAME",
  536. to: "Crashlytics macOS SDK",
  537. .when(platforms: [.macOS, .macCatalyst])
  538. ),
  539. .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])),
  540. .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])),
  541. ]
  542. ),
  543. .target(
  544. name: "FirebaseDatabaseInternal",
  545. dependencies: [
  546. "FirebaseAppCheckInterop",
  547. "FirebaseCore",
  548. "leveldb",
  549. ],
  550. path: "FirebaseDatabase/Sources",
  551. exclude: [
  552. "third_party/Wrap-leveldb/LICENSE",
  553. "third_party/SocketRocket/LICENSE",
  554. "third_party/FImmutableSortedDictionary/LICENSE",
  555. "third_party/SocketRocket/aa2297808c225710e267afece4439c256f6efdb3",
  556. ],
  557. publicHeadersPath: "Public",
  558. cSettings: [
  559. .headerSearchPath("../../"),
  560. ],
  561. linkerSettings: [
  562. .linkedFramework("CFNetwork"),
  563. .linkedFramework("Security"),
  564. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  565. .linkedFramework("WatchKit", .when(platforms: [.watchOS])),
  566. ]
  567. ),
  568. .testTarget(
  569. name: "DatabaseUnit",
  570. dependencies: [
  571. "FirebaseDatabase",
  572. "SharedTestUtilities",
  573. .product(name: "OCMock", package: "ocmock"),
  574. ],
  575. path: "FirebaseDatabase/Tests/",
  576. exclude: [
  577. // Disable Swift tests as mixed targets are not supported (Xcode 12.4).
  578. "Unit/Swift",
  579. "Integration/",
  580. ],
  581. resources: [.process("Resources")],
  582. cSettings: [
  583. .headerSearchPath("../.."),
  584. ]
  585. ),
  586. .testTarget(
  587. name: "DatabaseUnitSwift",
  588. dependencies: ["FirebaseDatabase"],
  589. path: "FirebaseDatabase/Tests/Unit/Swift",
  590. cSettings: [
  591. .headerSearchPath("../.."),
  592. ]
  593. ),
  594. .target(
  595. name: "FirebaseDatabase",
  596. dependencies: ["FirebaseDatabaseInternal", "FirebaseSharedSwift"],
  597. path: "FirebaseDatabase/Swift/Sources"
  598. ),
  599. .target(
  600. name: "FirebaseDatabaseSwift",
  601. dependencies: ["FirebaseDatabase"],
  602. path: "FirebaseDatabaseSwift/Sources"
  603. ),
  604. .testTarget(
  605. name: "FirebaseDatabaseSwiftTests",
  606. dependencies: ["FirebaseDatabase", "FirebaseDatabaseSwift"],
  607. path: "FirebaseDatabaseSwift/Tests/"
  608. ),
  609. .target(
  610. name: "FirebaseSharedSwift",
  611. path: "FirebaseSharedSwift/Sources",
  612. exclude: [
  613. "third_party/FirebaseDataEncoder/LICENSE",
  614. "third_party/FirebaseDataEncoder/METADATA",
  615. ]
  616. ),
  617. .testTarget(
  618. name: "FirebaseSharedSwiftTests",
  619. dependencies: ["FirebaseSharedSwift"],
  620. path: "FirebaseSharedSwift/Tests/"
  621. ),
  622. .target(
  623. name: "FirebaseDynamicLinksTarget",
  624. dependencies: [.target(name: "FirebaseDynamicLinks",
  625. condition: .when(platforms: [.iOS]))],
  626. path: "SwiftPM-PlatformExclude/FirebaseDynamicLinksWrap"
  627. ),
  628. .target(
  629. name: "FirebaseDynamicLinks",
  630. dependencies: ["FirebaseCore"],
  631. path: "FirebaseDynamicLinks/Sources",
  632. publicHeadersPath: "Public",
  633. cSettings: [
  634. .headerSearchPath("../../"),
  635. .define("FIRDynamicLinks3P", to: "1"),
  636. .define("GIN_SCION_LOGGING", to: "1"),
  637. ],
  638. linkerSettings: [
  639. .linkedFramework("QuartzCore"),
  640. ]
  641. ),
  642. firestoreWrapperTarget(),
  643. .target(
  644. name: "FirebaseFirestoreSwiftTarget",
  645. dependencies: [.target(name: "FirebaseFirestoreSwift",
  646. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS,
  647. .firebaseVisionOS]))],
  648. path: "SwiftPM-PlatformExclude/FirebaseFirestoreSwiftWrap"
  649. ),
  650. .target(
  651. name: "FirebaseFirestoreSwift",
  652. dependencies: [
  653. "FirebaseFirestoreTarget",
  654. ],
  655. path: "FirebaseFirestoreSwift/Sources"
  656. ),
  657. // MARK: - Firebase Functions
  658. .target(
  659. name: "FirebaseFunctions",
  660. dependencies: [
  661. "FirebaseAppCheckInterop",
  662. "FirebaseAuthInterop",
  663. "FirebaseCore",
  664. "FirebaseCoreExtension",
  665. "FirebaseMessagingInterop",
  666. "FirebaseSharedSwift",
  667. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  668. ],
  669. path: "FirebaseFunctions/Sources"
  670. ),
  671. .testTarget(
  672. name: "FirebaseFunctionsUnit",
  673. dependencies: ["FirebaseFunctions",
  674. "FirebaseAppCheckInterop",
  675. "FirebaseAuthInterop",
  676. "FirebaseMessagingInterop",
  677. "SharedTestUtilities"],
  678. path: "FirebaseFunctions/Tests/Unit",
  679. cSettings: [
  680. .headerSearchPath("../../../"),
  681. ]
  682. ),
  683. .testTarget(
  684. name: "FirebaseFunctionsIntegration",
  685. dependencies: ["FirebaseFunctions",
  686. "SharedTestUtilities"],
  687. path: "FirebaseFunctions/Tests/Integration"
  688. ),
  689. .testTarget(
  690. name: "FirebaseFunctionsObjCIntegration",
  691. dependencies: ["FirebaseFunctions",
  692. "SharedTestUtilities"],
  693. path: "FirebaseFunctions/Tests/ObjCIntegration",
  694. // See https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730
  695. exclude: [
  696. "ObjCPPAPITests.mm",
  697. ],
  698. cSettings: [
  699. .headerSearchPath("../../.."),
  700. ]
  701. ),
  702. .target(
  703. name: "FirebaseFunctionsCombineSwift",
  704. dependencies: ["FirebaseFunctions"],
  705. path: "FirebaseCombineSwift/Sources/Functions"
  706. ),
  707. .testTarget(
  708. name: "FunctionsCombineUnit",
  709. dependencies: ["FirebaseFunctionsCombineSwift",
  710. "SharedTestUtilities"],
  711. path: "FirebaseFunctions/Tests/CombineUnit"
  712. ),
  713. // MARK: - Firebase In App Messaging
  714. .target(
  715. name: "FirebaseInAppMessagingTarget",
  716. dependencies: [
  717. .target(name: "FirebaseInAppMessaging", condition: .when(platforms: [.iOS, .tvOS])),
  718. ],
  719. path: "SwiftPM-PlatformExclude/FirebaseInAppMessagingWrap"
  720. ),
  721. .target(
  722. name: "FirebaseInAppMessagingInternal",
  723. dependencies: [
  724. "FirebaseCore",
  725. "FirebaseInstallations",
  726. "FirebaseABTesting",
  727. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  728. .product(name: "nanopb", package: "nanopb"),
  729. .target(name: "FirebaseInAppMessaging_iOS", condition: .when(platforms: [.iOS])),
  730. ],
  731. path: "FirebaseInAppMessaging/Sources",
  732. exclude: [
  733. "DefaultUI/CHANGELOG.md",
  734. "DefaultUI/README.md",
  735. ],
  736. publicHeadersPath: "Public",
  737. cSettings: [
  738. .headerSearchPath("../../"),
  739. .define("PB_FIELD_32BIT", to: "1"),
  740. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  741. .define("PB_ENABLE_MALLOC", to: "1"),
  742. ]
  743. ),
  744. .target(
  745. name: "FirebaseInAppMessaging_iOS",
  746. path: "FirebaseInAppMessaging/iOS",
  747. resources: [.process("Resources")]
  748. ),
  749. .target(
  750. name: "FirebaseInAppMessaging",
  751. dependencies: ["FirebaseInAppMessagingInternal"],
  752. path: "FirebaseInAppMessaging/Swift/Source"
  753. ),
  754. .target(
  755. name: "FirebaseInAppMessagingSwift",
  756. dependencies: ["FirebaseInAppMessaging"],
  757. path: "FirebaseInAppMessagingSwift/Sources"
  758. ),
  759. .target(
  760. name: "FirebaseInstallations",
  761. dependencies: [
  762. "FirebaseCore",
  763. .product(name: "FBLPromises", package: "Promises"),
  764. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  765. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  766. ],
  767. path: "FirebaseInstallations/Source/Library",
  768. publicHeadersPath: "Public",
  769. cSettings: [
  770. .headerSearchPath("../../../"),
  771. ],
  772. linkerSettings: [
  773. .linkedFramework("Security"),
  774. ]
  775. ),
  776. .target(
  777. name: "FirebaseMLModelDownloader",
  778. dependencies: [
  779. "FirebaseCore",
  780. "FirebaseInstallations",
  781. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  782. .product(name: "GULLogger", package: "GoogleUtilities"),
  783. .product(name: "SwiftProtobuf", package: "swift-protobuf"),
  784. ],
  785. path: "FirebaseMLModelDownloader/Sources",
  786. exclude: [
  787. "proto/firebase_ml_log_sdk.proto",
  788. ],
  789. cSettings: [
  790. .define("FIRMLModelDownloader_VERSION", to: firebaseVersion),
  791. ]
  792. ),
  793. .testTarget(
  794. name: "FirebaseMLModelDownloaderUnit",
  795. dependencies: ["FirebaseMLModelDownloader"],
  796. path: "FirebaseMLModelDownloader/Tests/Unit"
  797. ),
  798. .target(
  799. name: "FirebaseMessaging",
  800. dependencies: [
  801. "FirebaseCore",
  802. "FirebaseInstallations",
  803. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  804. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  805. .product(name: "GULReachability", package: "GoogleUtilities"),
  806. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  807. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  808. .product(name: "nanopb", package: "nanopb"),
  809. ],
  810. path: "FirebaseMessaging/Sources",
  811. publicHeadersPath: "Public",
  812. cSettings: [
  813. .headerSearchPath("../../"),
  814. .define("PB_FIELD_32BIT", to: "1"),
  815. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  816. .define("PB_ENABLE_MALLOC", to: "1"),
  817. ],
  818. linkerSettings: [
  819. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  820. ]
  821. ),
  822. // Internal headers only for consuming from Swift.
  823. .target(
  824. name: "FirebaseMessagingInterop",
  825. path: "FirebaseMessaging/Interop",
  826. publicHeadersPath: ".",
  827. cSettings: [
  828. .headerSearchPath("../../"),
  829. ]
  830. ),
  831. .testTarget(
  832. name: "MessagingUnit",
  833. dependencies: [
  834. "FirebaseMessaging",
  835. "SharedTestUtilities",
  836. .product(name: "OCMock", package: "ocmock"),
  837. ],
  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, .firebaseVisionOS]))],
  850. path: "SwiftPM-PlatformExclude/FirebasePerformanceWrap"
  851. ),
  852. .target(
  853. name: "FirebasePerformance",
  854. dependencies: [
  855. "FirebaseCore",
  856. "FirebaseInstallations",
  857. // Performance depends on the Obj-C target of FirebaseRemoteConfig to
  858. // avoid including Swift code from the `FirebaseRemoteConfig` target
  859. // that is unneeded.
  860. "FirebaseRemoteConfigInternal",
  861. "FirebaseSessions",
  862. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  863. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  864. .product(name: "GULISASwizzler", package: "GoogleUtilities"),
  865. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  866. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  867. .product(name: "nanopb", package: "nanopb"),
  868. ],
  869. path: "FirebasePerformance/Sources",
  870. publicHeadersPath: "Public",
  871. cSettings: [
  872. .headerSearchPath("../../"),
  873. .define("PB_FIELD_32BIT", to: "1"),
  874. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  875. .define("PB_ENABLE_MALLOC", to: "1"),
  876. .define("FIRPerformance_LIB_VERSION", to: firebaseVersion),
  877. ],
  878. linkerSettings: [
  879. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .tvOS])),
  880. .linkedFramework("MobileCoreServices", .when(platforms: [.iOS, .tvOS])),
  881. .linkedFramework("QuartzCore", .when(platforms: [.iOS, .tvOS])),
  882. ]
  883. ),
  884. .testTarget(
  885. name: "PerformanceUnit",
  886. dependencies: [
  887. "FirebasePerformanceTarget",
  888. "SharedTestUtilities",
  889. "GCDWebServer",
  890. .product(name: "OCMock", package: "ocmock"),
  891. ],
  892. path: "FirebasePerformance/Tests/Unit",
  893. resources: [
  894. .process("FPRURLFilterTests-Info.plist"),
  895. .process("Server/smallDownloadFile"),
  896. .process("Server/bigDownloadFile"),
  897. ],
  898. cSettings: [
  899. .headerSearchPath("../../.."),
  900. .define("PB_FIELD_32BIT", to: "1"),
  901. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  902. .define("PB_ENABLE_MALLOC", to: "1"),
  903. ]
  904. ),
  905. .target(
  906. name: "SharedTestUtilities",
  907. dependencies: ["FirebaseCore",
  908. "FirebaseAppCheckInterop",
  909. "FirebaseAuthInterop",
  910. "FirebaseMessagingInterop",
  911. "GoogleDataTransport",
  912. .product(name: "OCMock", package: "ocmock")],
  913. path: "SharedTestUtilities",
  914. publicHeadersPath: "./",
  915. cSettings: [
  916. .headerSearchPath("../"),
  917. ]
  918. ),
  919. // MARK: - Firebase Remote Config
  920. .target(
  921. name: "FirebaseRemoteConfigInternal",
  922. dependencies: [
  923. "FirebaseCore",
  924. "FirebaseABTesting",
  925. "FirebaseInstallations",
  926. .product(name: "GULNSData", package: "GoogleUtilities"),
  927. ],
  928. path: "FirebaseRemoteConfig/Sources",
  929. publicHeadersPath: "Public",
  930. cSettings: [
  931. .headerSearchPath("../../"),
  932. ]
  933. ),
  934. .testTarget(
  935. name: "RemoteConfigUnit",
  936. dependencies: ["FirebaseRemoteConfigInternal", .product(name: "OCMock", package: "ocmock")],
  937. path: "FirebaseRemoteConfig/Tests/Unit",
  938. exclude: [
  939. // Need to be evaluated/ported to RC V2.
  940. "RCNConfigAnalyticsTest.m",
  941. "RCNConfigSettingsTest.m",
  942. "RCNConfigTest.m",
  943. "RCNRemoteConfig+FIRAppTest.m",
  944. "RCNThrottlingTests.m",
  945. ],
  946. resources: [
  947. .process("SecondApp-GoogleService-Info.plist"),
  948. .process("Defaults-testInfo.plist"),
  949. .process("TestABTPayload.txt"),
  950. ],
  951. cSettings: [
  952. .headerSearchPath("../../.."),
  953. ]
  954. ),
  955. .target(
  956. name: "FirebaseRemoteConfig",
  957. dependencies: [
  958. "FirebaseRemoteConfigInternal",
  959. "FirebaseSharedSwift",
  960. ],
  961. path: "FirebaseRemoteConfig/Swift"
  962. ),
  963. .target(
  964. name: "FirebaseRemoteConfigSwift",
  965. dependencies: [
  966. "FirebaseRemoteConfig",
  967. ],
  968. path: "FirebaseRemoteConfigSwift/Sources"
  969. ),
  970. .testTarget(
  971. name: "RemoteConfigFakeConsole",
  972. dependencies: ["FirebaseRemoteConfig",
  973. "FirebaseRemoteConfigSwift",
  974. "RemoteConfigFakeConsoleObjC"],
  975. path: "FirebaseRemoteConfigSwift/Tests",
  976. exclude: [
  977. "AccessToken.json",
  978. "README.md",
  979. "ObjC/",
  980. ],
  981. resources: [
  982. .process("Defaults-testInfo.plist"),
  983. ],
  984. cSettings: [
  985. .headerSearchPath("../../"),
  986. ]
  987. ),
  988. .target(
  989. name: "RemoteConfigFakeConsoleObjC",
  990. dependencies: [.product(name: "OCMock", package: "ocmock")],
  991. path: "FirebaseRemoteConfigSwift/Tests/ObjC",
  992. publicHeadersPath: ".",
  993. cSettings: [
  994. .headerSearchPath("../../../"),
  995. ]
  996. ),
  997. // MARK: - Firebase Sessions
  998. .target(
  999. name: "FirebaseSessions",
  1000. dependencies: [
  1001. "FirebaseCore",
  1002. "FirebaseInstallations",
  1003. "FirebaseCoreExtension",
  1004. "FirebaseSessionsObjC",
  1005. .product(name: "Promises", package: "Promises"),
  1006. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  1007. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1008. ],
  1009. path: "FirebaseSessions/Sources",
  1010. cSettings: [
  1011. .headerSearchPath(".."),
  1012. .define("DISPLAY_VERSION", to: firebaseVersion),
  1013. .define("PB_FIELD_32BIT", to: "1"),
  1014. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1015. .define("PB_ENABLE_MALLOC", to: "1"),
  1016. ],
  1017. linkerSettings: [
  1018. .linkedFramework("Security"),
  1019. .linkedFramework(
  1020. "SystemConfiguration",
  1021. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1022. ),
  1023. ]
  1024. ),
  1025. // The Sessions SDK is Swift-first with Objective-C code to support
  1026. // nanopb. Because Swift Package Manager doesn't support mixed
  1027. // language targets, the ObjC code has been extracted out into
  1028. // a separate target.
  1029. .target(
  1030. name: "FirebaseSessionsObjC",
  1031. dependencies: [
  1032. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1033. .product(name: "nanopb", package: "nanopb"),
  1034. ],
  1035. path: "FirebaseSessions",
  1036. exclude: [
  1037. "README.md",
  1038. "Sources/",
  1039. "Tests/",
  1040. "ProtoSupport/",
  1041. "generate_project.sh",
  1042. "generate_protos.sh",
  1043. "generate_testapp.sh",
  1044. ],
  1045. publicHeadersPath: "SourcesObjC",
  1046. cSettings: [
  1047. .headerSearchPath(".."),
  1048. .define("DISPLAY_VERSION", to: firebaseVersion),
  1049. .define("PB_FIELD_32BIT", to: "1"),
  1050. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1051. .define("PB_ENABLE_MALLOC", to: "1"),
  1052. ],
  1053. linkerSettings: [
  1054. .linkedFramework("Security"),
  1055. .linkedFramework(
  1056. "SystemConfiguration",
  1057. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1058. ),
  1059. ]
  1060. ),
  1061. .testTarget(
  1062. name: "FirebaseSessionsUnit",
  1063. dependencies: ["FirebaseSessions"],
  1064. path: "FirebaseSessions/Tests/Unit"
  1065. ),
  1066. // MARK: - Firebase Storage
  1067. .target(
  1068. name: "FirebaseStorage",
  1069. dependencies: [
  1070. "FirebaseAppCheckInterop",
  1071. "FirebaseAuthInterop",
  1072. "FirebaseCore",
  1073. "FirebaseCoreExtension",
  1074. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  1075. ],
  1076. path: "FirebaseStorage/Sources"
  1077. ),
  1078. .testTarget(
  1079. name: "FirebaseStorageUnit",
  1080. dependencies: ["FirebaseStorage",
  1081. "SharedTestUtilities"],
  1082. path: "FirebaseStorage/Tests/Unit",
  1083. cSettings: [
  1084. .headerSearchPath("../../../"),
  1085. ]
  1086. ),
  1087. .testTarget(
  1088. name: "StorageObjCIntegration",
  1089. dependencies: ["FirebaseStorage"],
  1090. path: "FirebaseStorage/Tests/ObjCIntegration",
  1091. exclude: [
  1092. // See https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730
  1093. "FIRStorageIntegrationTests.m",
  1094. "ObjCPPAPITests.mm",
  1095. "Credentials.h",
  1096. ],
  1097. cSettings: [
  1098. .headerSearchPath("../../.."),
  1099. ]
  1100. ),
  1101. .testTarget(
  1102. name: "swift-test",
  1103. dependencies: [
  1104. "Firebase",
  1105. "FirebaseAuth",
  1106. "FirebaseAppCheck",
  1107. "FirebaseABTesting",
  1108. "FirebaseAnalytics",
  1109. "FirebaseAnalyticsSwift",
  1110. .target(name: "FirebaseAppDistribution",
  1111. condition: .when(platforms: [.iOS])),
  1112. "FirebaseAuthCombineSwift",
  1113. "FirebaseFirestoreCombineSwift",
  1114. "FirebaseFunctionsCombineSwift",
  1115. "FirebaseStorageCombineSwift",
  1116. "FirebaseCrashlytics",
  1117. "FirebaseCore",
  1118. "FirebaseDatabase",
  1119. "FirebaseDynamicLinks",
  1120. "FirebaseFirestoreTarget",
  1121. "FirebaseFirestoreSwift",
  1122. "FirebaseFunctions",
  1123. .target(name: "FirebaseInAppMessaging",
  1124. condition: .when(platforms: [.iOS, .tvOS])),
  1125. .target(name: "FirebaseInAppMessagingSwift",
  1126. condition: .when(platforms: [.iOS, .tvOS])),
  1127. "FirebaseInstallations",
  1128. "FirebaseMessaging",
  1129. .target(name: "FirebasePerformance",
  1130. condition: .when(platforms: [.iOS, .tvOS])),
  1131. "FirebaseRemoteConfig",
  1132. "FirebaseSessions",
  1133. "FirebaseStorage",
  1134. .product(name: "nanopb", package: "nanopb"),
  1135. ],
  1136. path: "SwiftPMTests/swift-test"
  1137. ),
  1138. .testTarget(
  1139. name: "analytics-import-test",
  1140. dependencies: [
  1141. "FirebaseAnalyticsSwiftTarget",
  1142. "FirebaseAnalyticsWrapper",
  1143. "Firebase",
  1144. ],
  1145. path: "SwiftPMTests/analytics-import-test"
  1146. ),
  1147. .testTarget(
  1148. name: "objc-import-test",
  1149. dependencies: [
  1150. "Firebase",
  1151. "FirebaseAuth",
  1152. "FirebaseABTesting",
  1153. "FirebaseAppCheck",
  1154. .target(name: "FirebaseAppDistribution",
  1155. condition: .when(platforms: [.iOS])),
  1156. "FirebaseCrashlytics",
  1157. "FirebaseCore",
  1158. "FirebaseDatabase",
  1159. "FirebaseDynamicLinks",
  1160. "FirebaseFirestoreTarget",
  1161. "FirebaseFunctions",
  1162. .target(name: "FirebaseInAppMessaging",
  1163. condition: .when(platforms: [.iOS, .tvOS])),
  1164. "FirebaseInstallations",
  1165. "FirebaseMessaging",
  1166. .target(name: "FirebasePerformance",
  1167. condition: .when(platforms: [.iOS, .tvOS])),
  1168. "FirebaseRemoteConfig",
  1169. "FirebaseStorage",
  1170. ],
  1171. path: "SwiftPMTests/objc-import-test"
  1172. ),
  1173. .testTarget(
  1174. name: "version-test",
  1175. dependencies: [
  1176. "FirebaseCore",
  1177. ],
  1178. path: "SwiftPMTests/version-test",
  1179. cSettings: [
  1180. .define("FIR_VERSION", to: firebaseVersion),
  1181. ]
  1182. ),
  1183. // MARK: - Firebase App Check
  1184. .target(name: "FirebaseAppCheck",
  1185. dependencies: [
  1186. "FirebaseAppCheckInterop",
  1187. "FirebaseCore",
  1188. .product(name: "FBLPromises", package: "Promises"),
  1189. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1190. ],
  1191. path: "FirebaseAppCheck/Sources",
  1192. publicHeadersPath: "Public",
  1193. cSettings: [
  1194. .headerSearchPath("../.."),
  1195. ],
  1196. linkerSettings: [
  1197. .linkedFramework(
  1198. "DeviceCheck",
  1199. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1200. ),
  1201. ]),
  1202. // Internal headers only for consuming from Swift.
  1203. .target(
  1204. name: "FirebaseAppCheckInterop",
  1205. path: "FirebaseAppCheck/Interop",
  1206. exclude: [
  1207. "CMakeLists.txt",
  1208. ],
  1209. publicHeadersPath: "Public",
  1210. cSettings: [
  1211. .headerSearchPath("../../"),
  1212. ]
  1213. ),
  1214. .testTarget(
  1215. name: "FirebaseAppCheckUnit",
  1216. dependencies: [
  1217. "FirebaseAppCheck",
  1218. "SharedTestUtilities",
  1219. .product(name: "OCMock", package: "ocmock"),
  1220. ],
  1221. path: "FirebaseAppCheck/Tests/Unit",
  1222. exclude: [
  1223. // Swift tests are in the target `FirebaseAppCheckUnitSwift` since mixed language targets
  1224. // are not supported (as of Xcode 15.0).
  1225. "Swift",
  1226. ],
  1227. resources: [
  1228. .process("Fixture"),
  1229. ],
  1230. cSettings: [
  1231. .headerSearchPath("../../.."),
  1232. ]
  1233. ),
  1234. .testTarget(
  1235. name: "FirebaseAppCheckUnitSwift",
  1236. dependencies: ["FirebaseAppCheck"],
  1237. path: "FirebaseAppCheck/Tests/Unit/Swift",
  1238. cSettings: [
  1239. .headerSearchPath("../.."),
  1240. ]
  1241. ),
  1242. // MARK: Testing support
  1243. .target(
  1244. name: "FirebaseFirestoreTestingSupport",
  1245. dependencies: ["FirebaseFirestoreTarget"],
  1246. path: "FirebaseTestingSupport/Firestore/Sources",
  1247. publicHeadersPath: "./",
  1248. cSettings: [
  1249. .headerSearchPath("../../.."),
  1250. .headerSearchPath("../../../Firestore/Source/Public/FirebaseFirestore"),
  1251. ]
  1252. ),
  1253. .testTarget(
  1254. name: "FirestoreTestingSupportTests",
  1255. dependencies: ["FirebaseFirestoreTestingSupport"],
  1256. path: "FirebaseTestingSupport/Firestore/Tests",
  1257. cSettings: [
  1258. .headerSearchPath("../../.."),
  1259. ]
  1260. ),
  1261. ] + firestoreTargets(),
  1262. cLanguageStandard: .c99,
  1263. cxxLanguageStandard: CXXLanguageStandard.gnucxx14
  1264. )
  1265. // MARK: - Helper Functions
  1266. func googleAppMeasurementDependency() -> Package.Dependency {
  1267. let appMeasurementURL = "https://github.com/google/GoogleAppMeasurement.git"
  1268. // Point SPM CI to the tip of main of https://github.com/google/GoogleAppMeasurement so that the
  1269. // release process can defer publishing the GoogleAppMeasurement tag until after testing.
  1270. if ProcessInfo.processInfo.environment["FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT"] != nil {
  1271. return .package(url: appMeasurementURL, branch: "main")
  1272. }
  1273. return .package(url: appMeasurementURL, exact: "10.17.0")
  1274. }
  1275. func abseilDependency() -> Package.Dependency {
  1276. let packageInfo: (url: String, range: Range<Version>)
  1277. // If building Firestore from source, abseil will need to be built as source
  1278. // as the headers in the binary version of abseil are unusable.
  1279. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1280. packageInfo = (
  1281. "https://github.com/firebase/abseil-cpp-SwiftPM.git",
  1282. "0.20220623.0" ..< "0.20220624.0"
  1283. )
  1284. } else {
  1285. packageInfo = (
  1286. "https://github.com/google/abseil-cpp-binary.git",
  1287. "1.2022062300.0" ..< "1.2022062400.0"
  1288. )
  1289. }
  1290. return .package(url: packageInfo.url, packageInfo.range)
  1291. }
  1292. func grpcDependency() -> Package.Dependency {
  1293. let packageInfo: (url: String, range: Range<Version>)
  1294. // If building Firestore from source, abseil will need to be built as source
  1295. // as the headers in the binary version of abseil are unusable.
  1296. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1297. packageInfo = ("https://github.com/grpc/grpc-ios.git", "1.49.1" ..< "1.50.0")
  1298. } else {
  1299. packageInfo = ("https://github.com/google/grpc-binary.git", "1.49.1" ..< "1.50.0")
  1300. }
  1301. return .package(url: packageInfo.url, packageInfo.range)
  1302. }
  1303. func firestoreWrapperTarget() -> Target {
  1304. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1305. return .target(
  1306. name: "FirebaseFirestoreTarget",
  1307. dependencies: [.target(name: "FirebaseFirestore",
  1308. condition: .when(platforms: [.iOS, .tvOS, .macOS,
  1309. .firebaseVisionOS]))],
  1310. path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap"
  1311. )
  1312. }
  1313. return .target(
  1314. name: "FirebaseFirestoreTarget",
  1315. dependencies: [.target(name: "FirebaseFirestore",
  1316. condition: .when(platforms: [.iOS, .tvOS, .macOS, .macCatalyst]))],
  1317. path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap"
  1318. )
  1319. }
  1320. func firestoreTargets() -> [Target] {
  1321. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1322. return [
  1323. .target(
  1324. name: "FirebaseFirestoreInternalWrapper",
  1325. dependencies: [
  1326. "FirebaseAppCheckInterop",
  1327. "FirebaseCore",
  1328. "leveldb",
  1329. .product(name: "nanopb", package: "nanopb"),
  1330. .product(name: "abseil", package: "abseil-cpp-SwiftPM"),
  1331. .product(name: "gRPC-cpp", package: "grpc-ios"),
  1332. ],
  1333. path: "Firestore",
  1334. exclude: [
  1335. "CHANGELOG.md",
  1336. "CMakeLists.txt",
  1337. "Example/",
  1338. "LICENSE",
  1339. "Protos/CMakeLists.txt",
  1340. "Protos/Podfile",
  1341. "Protos/README.md",
  1342. "Protos/build_protos.py",
  1343. "Protos/cpp/",
  1344. "Protos/lib/",
  1345. "Protos/nanopb_cpp_generator.py",
  1346. "Protos/protos/",
  1347. "README.md",
  1348. "Source/CMakeLists.txt",
  1349. "Swift/",
  1350. "core/CMakeLists.txt",
  1351. "core/src/util/config_detected.h.in",
  1352. "core/test/",
  1353. "fuzzing/",
  1354. "test.sh",
  1355. // Swift PM doesn't recognize hpp files, so we're relying on search paths
  1356. // to find third_party/nlohmann_json/json.hpp.
  1357. "third_party/",
  1358. // Exclude alternate implementations for other platforms
  1359. "core/src/remote/connectivity_monitor_noop.cc",
  1360. "core/src/util/filesystem_win.cc",
  1361. "core/src/util/log_stdio.cc",
  1362. "core/src/util/secure_random_openssl.cc",
  1363. ],
  1364. sources: [
  1365. "Source/",
  1366. "Protos/nanopb/",
  1367. "core/include/",
  1368. "core/src",
  1369. ],
  1370. publicHeadersPath: "Source/Public",
  1371. cSettings: [
  1372. .headerSearchPath("../"),
  1373. .headerSearchPath("Source/Public/FirebaseFirestore"),
  1374. .headerSearchPath("Protos/nanopb"),
  1375. .define("PB_FIELD_32BIT", to: "1"),
  1376. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1377. .define("PB_ENABLE_MALLOC", to: "1"),
  1378. .define("FIRFirestore_VERSION", to: firebaseVersion),
  1379. ],
  1380. linkerSettings: [
  1381. .linkedFramework(
  1382. "SystemConfiguration",
  1383. .when(platforms: [.iOS, .macOS, .tvOS, .firebaseVisionOS])
  1384. ),
  1385. .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS, .firebaseVisionOS])),
  1386. .linkedLibrary("c++"),
  1387. ]
  1388. ),
  1389. .target(
  1390. name: "FirebaseFirestore",
  1391. dependencies: [
  1392. "FirebaseCore",
  1393. "FirebaseCoreExtension",
  1394. "FirebaseFirestoreInternalWrapper",
  1395. "FirebaseSharedSwift",
  1396. ],
  1397. path: "Firestore",
  1398. exclude: [
  1399. "CHANGELOG.md",
  1400. "CMakeLists.txt",
  1401. "Example/",
  1402. "LICENSE",
  1403. "Protos/",
  1404. "README.md",
  1405. "Source/",
  1406. "core/",
  1407. "fuzzing/",
  1408. "test.sh",
  1409. "Swift/CHANGELOG.md",
  1410. "Swift/Tests/",
  1411. "third_party/nlohmann_json",
  1412. ],
  1413. sources: [
  1414. "Swift/Source/",
  1415. ]
  1416. ),
  1417. ]
  1418. }
  1419. let firestoreInternalTarget: Target = {
  1420. if ProcessInfo.processInfo.environment["FIREBASECI_USE_LOCAL_FIRESTORE_ZIP"] != nil {
  1421. // This is set when running `scripts/check_firestore_symbols.sh`.
  1422. return .binaryTarget(
  1423. name: "FirebaseFirestoreInternal",
  1424. // The `xcframework` should be moved to the root of the repo.
  1425. path: "FirebaseFirestoreInternal.xcframework"
  1426. )
  1427. } else {
  1428. return .binaryTarget(
  1429. name: "FirebaseFirestoreInternal",
  1430. url: "https://dl.google.com/firebase/ios/bin/firestore/10.17.0/FirebaseFirestoreInternal.zip",
  1431. checksum: "9102f56ad70d97c8ad81b1047fc38bbbacde672eb86d861b19c454829210cd55"
  1432. )
  1433. }
  1434. }()
  1435. return [
  1436. .target(
  1437. name: "FirebaseFirestore",
  1438. dependencies: [
  1439. .target(
  1440. name: "FirebaseFirestoreInternalWrapper",
  1441. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1442. ),
  1443. .product(name: "abseil", package: "abseil-cpp-binary"),
  1444. .product(name: "gRPC-C++", package: "grpc-binary"),
  1445. .product(name: "nanopb", package: "nanopb"),
  1446. "FirebaseAppCheckInterop",
  1447. "FirebaseCore",
  1448. "FirebaseCoreExtension",
  1449. "leveldb",
  1450. "FirebaseSharedSwift",
  1451. ],
  1452. path: "Firestore/Swift/Source",
  1453. linkerSettings: [
  1454. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  1455. .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS])),
  1456. .linkedLibrary("c++"),
  1457. ]
  1458. ),
  1459. .target(
  1460. name: "FirebaseFirestoreInternalWrapper",
  1461. dependencies: ["FirebaseFirestoreInternal"],
  1462. path: "FirebaseFirestoreInternal",
  1463. publicHeadersPath: "."
  1464. ),
  1465. firestoreInternalTarget,
  1466. ]
  1467. }
  1468. extension Platform {
  1469. // Xcode dependent value for the visionOS platform. Namespaced with
  1470. // "firebase" prefix to prevent any API collisions (such issues should not
  1471. // arise as the manifest APIs should be confined to the `Package.swift`).
  1472. static var firebaseVisionOS: Self {
  1473. #if swift(>=5.9)
  1474. // For Xcode 15, return the available `visionOS` platform.
  1475. return .visionOS
  1476. #else
  1477. // For Xcode 14, return `iOS` as visionOS is unavailable. Since all targets
  1478. // support iOS, this acts as a no-op.
  1479. return .iOS
  1480. #endif // swift(>=5.9)
  1481. }
  1482. }