Package.swift 52 KB

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