Package.swift 51 KB

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