Package.swift 49 KB

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