Package.swift 52 KB

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