Package.swift 51 KB

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