Package.swift 50 KB

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