Package.swift 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564
  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.3.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-Preview",
  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" ..< "4.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.3.0/FirebaseAnalytics.zip",
  296. checksum: "1d4c06ccb6ffbf44e80934ab9190d2473421f94e7116c95c13cb2744c3873852"
  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. linkerSettings: [
  408. .linkedFramework("Security"),
  409. .linkedFramework("SafariServices", .when(platforms: [.iOS])),
  410. ]
  411. ),
  412. .target(
  413. name: "FirebaseAuthInternal",
  414. dependencies: [
  415. .product(name: "RecaptchaInterop", package: "interop-ios-for-google-sdks"),
  416. ],
  417. path: "FirebaseAuth/Sources",
  418. exclude: [
  419. "Swift", "Resources",
  420. ],
  421. publicHeadersPath: "Public",
  422. cSettings: [
  423. .headerSearchPath("../../"),
  424. ]
  425. ),
  426. // Internal headers only for consuming from Swift.
  427. .target(
  428. name: "FirebaseAuthInterop",
  429. path: "FirebaseAuth/Interop",
  430. exclude: [
  431. "CMakeLists.txt",
  432. ],
  433. publicHeadersPath: "Public",
  434. cSettings: [
  435. .headerSearchPath("../../"),
  436. ]
  437. ),
  438. .testTarget(
  439. name: "AuthUnit",
  440. dependencies: [
  441. "FirebaseAuth",
  442. ],
  443. path: "FirebaseAuth/Tests/Unit",
  444. exclude: [
  445. // TODO: these tests rely on a non-zero UIApplication.shared. They run from CocoaPods.
  446. "PhoneAuthProviderTests.swift",
  447. "AuthNotificationManagerTests.swift",
  448. // TODO: The following tests run in CocoaPods only, until mixed language or separate target.
  449. "ObjCAPITests.m",
  450. "ObjCGlobalTests.m",
  451. "FIROAuthProviderTests.m",
  452. ]
  453. ),
  454. .target(
  455. name: "FirebaseAuthCombineSwift",
  456. dependencies: ["FirebaseAuth"],
  457. path: "FirebaseCombineSwift/Sources/Auth"
  458. ),
  459. .target(
  460. name: "FirebaseFirestoreCombineSwift",
  461. dependencies: [
  462. "FirebaseFirestoreTarget",
  463. ],
  464. path: "FirebaseCombineSwift/Sources/Firestore"
  465. ),
  466. .target(
  467. name: "FirebaseStorageCombineSwift",
  468. dependencies: [
  469. "FirebaseStorage",
  470. ],
  471. path: "FirebaseCombineSwift/Sources/Storage"
  472. ),
  473. .target(
  474. name: "FirebaseCrashlytics",
  475. dependencies: [
  476. "FirebaseCore",
  477. "FirebaseInstallations",
  478. "FirebaseSessions",
  479. "FirebaseRemoteConfigInterop",
  480. "FirebaseCrashlyticsSwift",
  481. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  482. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  483. .product(name: "FBLPromises", package: "Promises"),
  484. .product(name: "nanopb", package: "nanopb"),
  485. ],
  486. path: "Crashlytics",
  487. exclude: [
  488. "run",
  489. "CHANGELOG.md",
  490. "LICENSE",
  491. "README.md",
  492. "ProtoSupport/",
  493. "UnitTests/",
  494. "generate_project.sh",
  495. "upload-symbols",
  496. "CrashlyticsInputFiles.xcfilelist",
  497. "third_party/libunwind/LICENSE",
  498. "Crashlytics/Rollouts/",
  499. ],
  500. sources: [
  501. "Crashlytics/",
  502. "Protogen/",
  503. "Shared/",
  504. "third_party/libunwind/dwarf.h",
  505. ],
  506. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  507. publicHeadersPath: "Crashlytics/Public",
  508. cSettings: [
  509. .headerSearchPath(".."),
  510. .define("DISPLAY_VERSION", to: firebaseVersion),
  511. .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])),
  512. .define(
  513. "CLS_SDK_NAME",
  514. to: "Crashlytics macOS SDK",
  515. .when(platforms: [.macOS, .macCatalyst])
  516. ),
  517. .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])),
  518. .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])),
  519. .define("PB_FIELD_32BIT", to: "1"),
  520. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  521. .define("PB_ENABLE_MALLOC", to: "1"),
  522. ],
  523. linkerSettings: [
  524. .linkedFramework("Security"),
  525. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  526. ]
  527. ),
  528. .target(
  529. name: "FirebaseCrashlyticsSwift",
  530. dependencies: ["FirebaseRemoteConfigInterop"],
  531. path: "Crashlytics",
  532. sources: [
  533. "Crashlytics/Rollouts/",
  534. ]
  535. ),
  536. .testTarget(
  537. name: "FirebaseCrashlyticsSwiftUnit",
  538. dependencies: ["FirebaseCrashlyticsSwift"],
  539. path: "Crashlytics/UnitTestsSwift/"
  540. ),
  541. .testTarget(
  542. name: "FirebaseCrashlyticsUnit",
  543. dependencies: ["FirebaseCrashlytics", .product(name: "OCMock", package: "ocmock")],
  544. path: "Crashlytics/UnitTests",
  545. resources: [
  546. .copy("FIRCLSMachO/machO_data"),
  547. .copy("Data"),
  548. ],
  549. cSettings: [
  550. .headerSearchPath("../.."),
  551. .define("DISPLAY_VERSION", to: firebaseVersion),
  552. .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])),
  553. .define(
  554. "CLS_SDK_NAME",
  555. to: "Crashlytics macOS SDK",
  556. .when(platforms: [.macOS, .macCatalyst])
  557. ),
  558. .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])),
  559. .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])),
  560. ]
  561. ),
  562. .target(
  563. name: "FirebaseDatabaseInternal",
  564. dependencies: [
  565. "FirebaseAppCheckInterop",
  566. "FirebaseCore",
  567. "leveldb",
  568. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  569. ],
  570. path: "FirebaseDatabase/Sources",
  571. exclude: [
  572. "third_party/Wrap-leveldb/LICENSE",
  573. "third_party/FImmutableSortedDictionary/LICENSE",
  574. ],
  575. publicHeadersPath: "Public",
  576. cSettings: [
  577. .headerSearchPath("../../"),
  578. ],
  579. linkerSettings: [
  580. .linkedFramework("CFNetwork"),
  581. .linkedFramework("Security"),
  582. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  583. .linkedFramework("WatchKit", .when(platforms: [.watchOS])),
  584. ]
  585. ),
  586. .testTarget(
  587. name: "DatabaseUnit",
  588. dependencies: [
  589. "FirebaseDatabase",
  590. "SharedTestUtilities",
  591. .product(name: "OCMock", package: "ocmock"),
  592. ],
  593. path: "FirebaseDatabase/Tests/",
  594. exclude: [
  595. // Disable Swift tests as mixed targets are not supported (Xcode 12.4).
  596. "Unit/Swift",
  597. "Integration/",
  598. ],
  599. resources: [.process("Resources")],
  600. cSettings: [
  601. .headerSearchPath("../.."),
  602. ]
  603. ),
  604. .testTarget(
  605. name: "DatabaseUnitSwift",
  606. dependencies: ["FirebaseDatabase"],
  607. path: "FirebaseDatabase/Tests/Unit/Swift",
  608. cSettings: [
  609. .headerSearchPath("../.."),
  610. ]
  611. ),
  612. .target(
  613. name: "FirebaseDatabase",
  614. dependencies: ["FirebaseDatabaseInternal", "FirebaseSharedSwift"],
  615. path: "FirebaseDatabase/Swift/Sources"
  616. ),
  617. .target(
  618. name: "FirebaseSharedSwift",
  619. path: "FirebaseSharedSwift/Sources",
  620. exclude: [
  621. "third_party/FirebaseDataEncoder/LICENSE",
  622. "third_party/FirebaseDataEncoder/METADATA",
  623. ]
  624. ),
  625. .testTarget(
  626. name: "FirebaseSharedSwiftTests",
  627. dependencies: ["FirebaseSharedSwift"],
  628. path: "FirebaseSharedSwift/Tests/"
  629. ),
  630. .target(
  631. name: "FirebaseDynamicLinksTarget",
  632. dependencies: [.target(name: "FirebaseDynamicLinks",
  633. condition: .when(platforms: [.iOS]))],
  634. path: "SwiftPM-PlatformExclude/FirebaseDynamicLinksWrap"
  635. ),
  636. .target(
  637. name: "FirebaseDynamicLinks",
  638. dependencies: ["FirebaseCore"],
  639. path: "FirebaseDynamicLinks/Sources",
  640. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  641. publicHeadersPath: "Public",
  642. cSettings: [
  643. .headerSearchPath("../../"),
  644. .define("FIRDynamicLinks3P", to: "1"),
  645. .define("GIN_SCION_LOGGING", to: "1"),
  646. ],
  647. linkerSettings: [
  648. .linkedFramework("QuartzCore"),
  649. ]
  650. ),
  651. firestoreWrapperTarget(),
  652. // MARK: - Firebase Functions
  653. .target(
  654. name: "FirebaseFunctions",
  655. dependencies: [
  656. "FirebaseAppCheckInterop",
  657. "FirebaseAuthInterop",
  658. "FirebaseCore",
  659. "FirebaseCoreExtension",
  660. "FirebaseMessagingInterop",
  661. "FirebaseSharedSwift",
  662. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  663. ],
  664. path: "FirebaseFunctions/Sources"
  665. ),
  666. .testTarget(
  667. name: "FirebaseFunctionsUnit",
  668. dependencies: ["FirebaseFunctions",
  669. "FirebaseAppCheckInterop",
  670. "FirebaseAuthInterop",
  671. "FirebaseMessagingInterop",
  672. "SharedTestUtilities"],
  673. path: "FirebaseFunctions/Tests/Unit",
  674. cSettings: [
  675. .headerSearchPath("../../../"),
  676. ]
  677. ),
  678. .testTarget(
  679. name: "FirebaseFunctionsIntegration",
  680. dependencies: ["FirebaseFunctions",
  681. "SharedTestUtilities"],
  682. path: "FirebaseFunctions/Tests/Integration"
  683. ),
  684. .testTarget(
  685. name: "FirebaseFunctionsObjCIntegration",
  686. dependencies: ["FirebaseFunctions",
  687. "SharedTestUtilities"],
  688. path: "FirebaseFunctions/Tests/ObjCIntegration",
  689. // See https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730
  690. exclude: [
  691. "ObjCPPAPITests.mm",
  692. ],
  693. cSettings: [
  694. .headerSearchPath("../../.."),
  695. ]
  696. ),
  697. .target(
  698. name: "FirebaseFunctionsCombineSwift",
  699. dependencies: ["FirebaseFunctions"],
  700. path: "FirebaseCombineSwift/Sources/Functions"
  701. ),
  702. .testTarget(
  703. name: "FunctionsCombineUnit",
  704. dependencies: ["FirebaseFunctionsCombineSwift",
  705. "SharedTestUtilities"],
  706. path: "FirebaseFunctions/Tests/CombineUnit"
  707. ),
  708. // MARK: - Firebase In App Messaging
  709. .target(
  710. name: "FirebaseInAppMessagingTarget",
  711. dependencies: [
  712. .target(name: "FirebaseInAppMessaging", condition: .when(platforms: [.iOS, .tvOS])),
  713. ],
  714. path: "SwiftPM-PlatformExclude/FirebaseInAppMessagingWrap"
  715. ),
  716. .target(
  717. name: "FirebaseInAppMessagingInternal",
  718. dependencies: [
  719. "FirebaseCore",
  720. "FirebaseInstallations",
  721. "FirebaseABTesting",
  722. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  723. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  724. .product(name: "nanopb", package: "nanopb"),
  725. .target(name: "FirebaseInAppMessaging_iOS", condition: .when(platforms: [.iOS])),
  726. ],
  727. path: "FirebaseInAppMessaging/Sources",
  728. exclude: [
  729. "DefaultUI/CHANGELOG.md",
  730. "DefaultUI/README.md",
  731. ],
  732. publicHeadersPath: "Public",
  733. cSettings: [
  734. .headerSearchPath("../../"),
  735. .define("PB_FIELD_32BIT", to: "1"),
  736. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  737. .define("PB_ENABLE_MALLOC", to: "1"),
  738. ]
  739. ),
  740. .target(
  741. name: "FirebaseInAppMessaging_iOS",
  742. path: "FirebaseInAppMessaging/iOS",
  743. resources: [.process("Resources")]
  744. ),
  745. .target(
  746. name: "FirebaseInAppMessaging",
  747. dependencies: ["FirebaseInAppMessagingInternal"],
  748. path: "FirebaseInAppMessaging/Swift/Source"
  749. ),
  750. .target(
  751. name: "FirebaseInstallations",
  752. dependencies: [
  753. "FirebaseCore",
  754. .product(name: "FBLPromises", package: "Promises"),
  755. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  756. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  757. ],
  758. path: "FirebaseInstallations/Source/Library",
  759. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  760. publicHeadersPath: "Public",
  761. cSettings: [
  762. .headerSearchPath("../../../"),
  763. ],
  764. linkerSettings: [
  765. .linkedFramework("Security"),
  766. ]
  767. ),
  768. .target(
  769. name: "FirebaseMLModelDownloader",
  770. dependencies: [
  771. "FirebaseCore",
  772. "FirebaseCoreExtension",
  773. "FirebaseInstallations",
  774. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  775. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  776. .product(name: "SwiftProtobuf", package: "swift-protobuf"),
  777. ],
  778. path: "FirebaseMLModelDownloader/Sources",
  779. exclude: [
  780. "proto/firebase_ml_log_sdk.proto",
  781. ],
  782. cSettings: [
  783. .define("FIRMLModelDownloader_VERSION", to: firebaseVersion),
  784. ]
  785. ),
  786. .testTarget(
  787. name: "FirebaseMLModelDownloaderUnit",
  788. dependencies: ["FirebaseMLModelDownloader"],
  789. path: "FirebaseMLModelDownloader/Tests/Unit"
  790. ),
  791. .target(
  792. name: "FirebaseMessaging",
  793. dependencies: [
  794. "FirebaseCore",
  795. "FirebaseInstallations",
  796. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  797. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  798. .product(name: "GULReachability", package: "GoogleUtilities"),
  799. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  800. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  801. .product(name: "nanopb", package: "nanopb"),
  802. ],
  803. path: "FirebaseMessaging/Sources",
  804. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  805. publicHeadersPath: "Public",
  806. cSettings: [
  807. .headerSearchPath("../../"),
  808. .define("PB_FIELD_32BIT", to: "1"),
  809. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  810. .define("PB_ENABLE_MALLOC", to: "1"),
  811. ],
  812. linkerSettings: [
  813. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  814. ]
  815. ),
  816. // Internal headers only for consuming from Swift.
  817. .target(
  818. name: "FirebaseMessagingInterop",
  819. path: "FirebaseMessaging/Interop",
  820. publicHeadersPath: ".",
  821. cSettings: [
  822. .headerSearchPath("../../"),
  823. ]
  824. ),
  825. .testTarget(
  826. name: "MessagingUnit",
  827. dependencies: [
  828. "FirebaseMessaging",
  829. "SharedTestUtilities",
  830. .product(name: "OCMock", package: "ocmock"),
  831. ],
  832. path: "FirebaseMessaging/Tests/UnitTests",
  833. exclude: [
  834. "FIRMessagingContextManagerServiceTest.m", // TODO: Adapt its NSBundle usage to SPM.
  835. ],
  836. cSettings: [
  837. .headerSearchPath("../../.."),
  838. ]
  839. ),
  840. .target(
  841. name: "FirebasePerformanceTarget",
  842. dependencies: [.target(name: "FirebasePerformance",
  843. condition: .when(platforms: [.iOS, .tvOS, .visionOS]))],
  844. path: "SwiftPM-PlatformExclude/FirebasePerformanceWrap"
  845. ),
  846. .target(
  847. name: "FirebasePerformance",
  848. dependencies: [
  849. "FirebaseCore",
  850. "FirebaseInstallations",
  851. // Performance depends on the Obj-C target of FirebaseRemoteConfig to
  852. // avoid including Swift code from the `FirebaseRemoteConfig` target
  853. // that is unneeded.
  854. "FirebaseRemoteConfigInternal",
  855. "FirebaseSessions",
  856. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  857. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  858. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  859. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  860. .product(name: "nanopb", package: "nanopb"),
  861. ],
  862. path: "FirebasePerformance/Sources",
  863. publicHeadersPath: "Public",
  864. cSettings: [
  865. .headerSearchPath("../../"),
  866. .define("PB_FIELD_32BIT", to: "1"),
  867. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  868. .define("PB_ENABLE_MALLOC", to: "1"),
  869. .define("FIRPerformance_LIB_VERSION", to: firebaseVersion),
  870. ],
  871. linkerSettings: [
  872. .linkedFramework("MobileCoreServices", .when(platforms: [.iOS, .tvOS])),
  873. .linkedFramework("QuartzCore", .when(platforms: [.iOS, .tvOS])),
  874. ]
  875. ),
  876. .testTarget(
  877. name: "PerformanceUnit",
  878. dependencies: [
  879. "FirebasePerformanceTarget",
  880. "SharedTestUtilities",
  881. "GCDWebServer",
  882. .product(name: "OCMock", package: "ocmock"),
  883. ],
  884. path: "FirebasePerformance/Tests/Unit",
  885. resources: [
  886. .process("FPRURLFilterTests-Info.plist"),
  887. .process("Server/smallDownloadFile"),
  888. .process("Server/bigDownloadFile"),
  889. ],
  890. cSettings: [
  891. .headerSearchPath("../../.."),
  892. .define("PB_FIELD_32BIT", to: "1"),
  893. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  894. .define("PB_ENABLE_MALLOC", to: "1"),
  895. ]
  896. ),
  897. .target(
  898. name: "SharedTestUtilities",
  899. dependencies: ["FirebaseCore",
  900. "FirebaseAppCheckInterop",
  901. "FirebaseAuthInterop",
  902. "FirebaseMessagingInterop",
  903. "GoogleDataTransport",
  904. .product(name: "OCMock", package: "ocmock")],
  905. path: "SharedTestUtilities",
  906. publicHeadersPath: "./",
  907. cSettings: [
  908. .headerSearchPath("../"),
  909. ]
  910. ),
  911. // MARK: - Firebase Remote Config
  912. .target(
  913. name: "FirebaseRemoteConfigInternal",
  914. dependencies: [
  915. "FirebaseCore",
  916. "FirebaseABTesting",
  917. "FirebaseInstallations",
  918. "FirebaseRemoteConfigInterop",
  919. .product(name: "GULNSData", package: "GoogleUtilities"),
  920. ],
  921. path: "FirebaseRemoteConfig/Sources",
  922. publicHeadersPath: "Public",
  923. cSettings: [
  924. .headerSearchPath("../../"),
  925. ]
  926. ),
  927. .testTarget(
  928. name: "RemoteConfigUnit",
  929. dependencies: ["FirebaseRemoteConfigInternal", .product(name: "OCMock", package: "ocmock")],
  930. path: "FirebaseRemoteConfig/Tests/Unit",
  931. exclude: [
  932. // Need to be evaluated/ported to RC V2.
  933. "RCNConfigAnalyticsTest.m",
  934. "RCNConfigSettingsTest.m",
  935. "RCNConfigTest.m",
  936. "RCNRemoteConfig+FIRAppTest.m",
  937. "RCNThrottlingTests.m",
  938. ],
  939. resources: [
  940. .process("SecondApp-GoogleService-Info.plist"),
  941. .process("Defaults-testInfo.plist"),
  942. .process("TestABTPayload.txt"),
  943. ],
  944. cSettings: [
  945. .headerSearchPath("../../.."),
  946. ]
  947. ),
  948. .testTarget(
  949. name: "RemoteConfigSwiftUnit",
  950. dependencies: ["FirebaseRemoteConfigInternal"],
  951. path: "FirebaseRemoteConfig/Tests/SwiftUnit",
  952. cSettings: [
  953. .headerSearchPath("../../.."),
  954. ]
  955. ),
  956. .target(
  957. name: "FirebaseRemoteConfig",
  958. dependencies: [
  959. "FirebaseRemoteConfigInternal",
  960. "FirebaseSharedSwift",
  961. ],
  962. path: "FirebaseRemoteConfig/Swift",
  963. resources: [.process("Resources/PrivacyInfo.xcprivacy")]
  964. ),
  965. .testTarget(
  966. name: "RemoteConfigFakeConsole",
  967. dependencies: ["FirebaseRemoteConfig",
  968. "RemoteConfigFakeConsoleObjC"],
  969. path: "FirebaseRemoteConfig/Tests/Swift",
  970. exclude: [
  971. "AccessToken.json",
  972. "README.md",
  973. "ObjC/",
  974. ],
  975. resources: [
  976. .process("Defaults-testInfo.plist"),
  977. ],
  978. cSettings: [
  979. .headerSearchPath("../../../"),
  980. ]
  981. ),
  982. .target(
  983. name: "RemoteConfigFakeConsoleObjC",
  984. dependencies: [.product(name: "OCMock", package: "ocmock")],
  985. path: "FirebaseRemoteConfig/Tests/Swift/ObjC",
  986. publicHeadersPath: ".",
  987. cSettings: [
  988. .headerSearchPath("../../../../"),
  989. ]
  990. ),
  991. // Internal headers only for consuming from other SDK.
  992. .target(
  993. name: "FirebaseRemoteConfigInterop",
  994. path: "FirebaseRemoteConfig/Interop",
  995. publicHeadersPath: ".",
  996. cSettings: [
  997. .headerSearchPath("../../"),
  998. ]
  999. ),
  1000. // MARK: - Firebase Sessions
  1001. .target(
  1002. name: "FirebaseSessions",
  1003. dependencies: [
  1004. "FirebaseCore",
  1005. "FirebaseInstallations",
  1006. "FirebaseCoreExtension",
  1007. "FirebaseSessionsObjC",
  1008. .product(name: "Promises", package: "Promises"),
  1009. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  1010. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1011. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  1012. ],
  1013. path: "FirebaseSessions/Sources",
  1014. cSettings: [
  1015. .headerSearchPath(".."),
  1016. .define("DISPLAY_VERSION", to: firebaseVersion),
  1017. .define("PB_FIELD_32BIT", to: "1"),
  1018. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1019. .define("PB_ENABLE_MALLOC", to: "1"),
  1020. ],
  1021. linkerSettings: [
  1022. .linkedFramework("Security"),
  1023. .linkedFramework(
  1024. "SystemConfiguration",
  1025. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1026. ),
  1027. ]
  1028. ),
  1029. // The Sessions SDK is Swift-first with Objective-C code to support
  1030. // nanopb. Because Swift Package Manager doesn't support mixed
  1031. // language targets, the ObjC code has been extracted out into
  1032. // a separate target.
  1033. .target(
  1034. name: "FirebaseSessionsObjC",
  1035. dependencies: [
  1036. "FirebaseCore",
  1037. "FirebaseCoreExtension",
  1038. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1039. .product(name: "nanopb", package: "nanopb"),
  1040. ],
  1041. path: "FirebaseSessions",
  1042. exclude: [
  1043. "README.md",
  1044. "Sources/",
  1045. "Tests/",
  1046. "ProtoSupport/",
  1047. "generate_project.sh",
  1048. "generate_protos.sh",
  1049. "generate_testapp.sh",
  1050. ],
  1051. publicHeadersPath: "SourcesObjC",
  1052. cSettings: [
  1053. .headerSearchPath(".."),
  1054. .define("DISPLAY_VERSION", to: firebaseVersion),
  1055. .define("PB_FIELD_32BIT", to: "1"),
  1056. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1057. .define("PB_ENABLE_MALLOC", to: "1"),
  1058. ],
  1059. linkerSettings: [
  1060. .linkedFramework("Security"),
  1061. .linkedFramework(
  1062. "SystemConfiguration",
  1063. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1064. ),
  1065. ]
  1066. ),
  1067. .testTarget(
  1068. name: "FirebaseSessionsUnit",
  1069. dependencies: ["FirebaseSessions"],
  1070. path: "FirebaseSessions/Tests/Unit"
  1071. ),
  1072. // MARK: - Firebase Storage
  1073. .target(
  1074. name: "FirebaseStorage",
  1075. dependencies: [
  1076. "FirebaseAppCheckInterop",
  1077. "FirebaseAuthInterop",
  1078. "FirebaseCore",
  1079. "FirebaseCoreExtension",
  1080. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  1081. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1082. ],
  1083. path: "FirebaseStorage/Sources"
  1084. ),
  1085. .testTarget(
  1086. name: "FirebaseStorageUnit",
  1087. dependencies: ["FirebaseStorage",
  1088. "SharedTestUtilities"],
  1089. path: "FirebaseStorage/Tests/Unit",
  1090. cSettings: [
  1091. .headerSearchPath("../../../"),
  1092. ]
  1093. ),
  1094. .testTarget(
  1095. name: "StorageObjCIntegration",
  1096. dependencies: ["FirebaseStorage"],
  1097. path: "FirebaseStorage/Tests/ObjCIntegration",
  1098. exclude: [
  1099. // See https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730
  1100. "FIRStorageIntegrationTests.m",
  1101. "ObjCPPAPITests.mm",
  1102. "Credentials.h",
  1103. ],
  1104. cSettings: [
  1105. .headerSearchPath("../../.."),
  1106. ]
  1107. ),
  1108. .testTarget(
  1109. name: "swift-test",
  1110. dependencies: [
  1111. "Firebase",
  1112. "FirebaseAuth",
  1113. "FirebaseAppCheck",
  1114. "FirebaseABTesting",
  1115. "FirebaseAnalytics",
  1116. .target(name: "FirebaseAppDistribution",
  1117. condition: .when(platforms: [.iOS])),
  1118. "FirebaseAuthCombineSwift",
  1119. "FirebaseFirestoreCombineSwift",
  1120. "FirebaseFunctionsCombineSwift",
  1121. "FirebaseStorageCombineSwift",
  1122. "FirebaseCrashlytics",
  1123. "FirebaseCore",
  1124. "FirebaseDatabase",
  1125. "FirebaseDynamicLinks",
  1126. "FirebaseFirestoreTarget",
  1127. "FirebaseFunctions",
  1128. .target(name: "FirebaseInAppMessaging",
  1129. condition: .when(platforms: [.iOS, .tvOS])),
  1130. "FirebaseInstallations",
  1131. "FirebaseMessaging",
  1132. .target(name: "FirebasePerformance",
  1133. condition: .when(platforms: [.iOS, .tvOS])),
  1134. "FirebaseRemoteConfig",
  1135. "FirebaseSessions",
  1136. "FirebaseStorage",
  1137. .product(name: "nanopb", package: "nanopb"),
  1138. ],
  1139. path: "SwiftPMTests/swift-test"
  1140. ),
  1141. .testTarget(
  1142. name: "analytics-import-test",
  1143. dependencies: [
  1144. "FirebaseAnalyticsWrapper",
  1145. "Firebase",
  1146. ],
  1147. path: "SwiftPMTests/analytics-import-test"
  1148. ),
  1149. .testTarget(
  1150. name: "objc-import-test",
  1151. dependencies: [
  1152. "Firebase",
  1153. "FirebaseAuth",
  1154. "FirebaseABTesting",
  1155. "FirebaseAppCheck",
  1156. .target(name: "FirebaseAppDistribution",
  1157. condition: .when(platforms: [.iOS])),
  1158. "FirebaseCrashlytics",
  1159. "FirebaseCore",
  1160. "FirebaseDatabase",
  1161. "FirebaseDynamicLinks",
  1162. "FirebaseFirestoreTarget",
  1163. "FirebaseFunctions",
  1164. .target(name: "FirebaseInAppMessaging",
  1165. condition: .when(platforms: [.iOS, .tvOS])),
  1166. "FirebaseInstallations",
  1167. "FirebaseMessaging",
  1168. .target(name: "FirebasePerformance",
  1169. condition: .when(platforms: [.iOS, .tvOS])),
  1170. "FirebaseRemoteConfig",
  1171. "FirebaseStorage",
  1172. ],
  1173. path: "SwiftPMTests/objc-import-test"
  1174. ),
  1175. .testTarget(
  1176. name: "version-test",
  1177. dependencies: [
  1178. "FirebaseCore",
  1179. ],
  1180. path: "SwiftPMTests/version-test",
  1181. cSettings: [
  1182. .define("FIR_VERSION", to: firebaseVersion),
  1183. ]
  1184. ),
  1185. // MARK: - Firebase App Check
  1186. .target(name: "FirebaseAppCheck",
  1187. dependencies: [
  1188. "FirebaseAppCheckInterop",
  1189. "FirebaseCore",
  1190. .product(name: "AppCheckCore", package: "app-check"),
  1191. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1192. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  1193. ],
  1194. path: "FirebaseAppCheck/Sources",
  1195. publicHeadersPath: "Public",
  1196. cSettings: [
  1197. .headerSearchPath("../.."),
  1198. ],
  1199. linkerSettings: [
  1200. .linkedFramework(
  1201. "DeviceCheck",
  1202. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1203. ),
  1204. ]),
  1205. // Internal headers only for consuming from Swift.
  1206. .target(
  1207. name: "FirebaseAppCheckInterop",
  1208. path: "FirebaseAppCheck/Interop",
  1209. exclude: [
  1210. "CMakeLists.txt",
  1211. ],
  1212. publicHeadersPath: "Public",
  1213. cSettings: [
  1214. .headerSearchPath("../../"),
  1215. ]
  1216. ),
  1217. .testTarget(
  1218. name: "FirebaseAppCheckUnit",
  1219. dependencies: [
  1220. "FirebaseAppCheck",
  1221. "SharedTestUtilities",
  1222. .product(name: "OCMock", package: "ocmock"),
  1223. ],
  1224. path: "FirebaseAppCheck/Tests/Unit",
  1225. exclude: [
  1226. // Swift tests are in the target `FirebaseAppCheckUnitSwift` since mixed language targets
  1227. // are not supported (as of Xcode 15.0).
  1228. "Swift",
  1229. ],
  1230. cSettings: [
  1231. .headerSearchPath("../../.."),
  1232. ]
  1233. ),
  1234. .testTarget(
  1235. name: "FirebaseAppCheckUnitSwift",
  1236. dependencies: ["FirebaseAppCheck"],
  1237. path: "FirebaseAppCheck/Tests/Unit/Swift"
  1238. ),
  1239. // MARK: Testing support
  1240. .target(
  1241. name: "FirebaseFirestoreTestingSupport",
  1242. dependencies: ["FirebaseFirestoreTarget"],
  1243. path: "FirebaseTestingSupport/Firestore/Sources",
  1244. publicHeadersPath: "./",
  1245. cSettings: [
  1246. .headerSearchPath("../../.."),
  1247. .headerSearchPath("../../../Firestore/Source/Public/FirebaseFirestore"),
  1248. ]
  1249. ),
  1250. .testTarget(
  1251. name: "FirestoreTestingSupportTests",
  1252. dependencies: ["FirebaseFirestoreTestingSupport"],
  1253. path: "FirebaseTestingSupport/Firestore/Tests",
  1254. cSettings: [
  1255. .headerSearchPath("../../.."),
  1256. ]
  1257. ),
  1258. // MARK: - Firebase Vertex AI
  1259. .target(
  1260. name: "FirebaseVertexAI",
  1261. dependencies: [
  1262. "FirebaseAppCheckInterop",
  1263. "FirebaseAuthInterop",
  1264. "FirebaseCore",
  1265. "FirebaseCoreExtension",
  1266. ],
  1267. path: "FirebaseVertexAI/Sources"
  1268. ),
  1269. .testTarget(
  1270. name: "FirebaseVertexAIUnit",
  1271. dependencies: ["FirebaseVertexAI"],
  1272. path: "FirebaseVertexAI/Tests/Unit",
  1273. resources: [
  1274. .process("vertexai-sdk-test-data/mock-responses"),
  1275. ],
  1276. cSettings: [
  1277. .headerSearchPath("../../../"),
  1278. ]
  1279. ),
  1280. .testTarget(
  1281. name: "FirebaseVertexAIIntegration",
  1282. dependencies: ["FirebaseVertexAI"],
  1283. path: "FirebaseVertexAI/Tests/Integration",
  1284. resources: [
  1285. .process("Resources"),
  1286. ]
  1287. ),
  1288. ] + firestoreTargets(),
  1289. cLanguageStandard: .c99,
  1290. cxxLanguageStandard: CXXLanguageStandard.gnucxx14
  1291. )
  1292. // MARK: - Helper Functions
  1293. func googleAppMeasurementDependency() -> Package.Dependency {
  1294. let appMeasurementURL = "https://github.com/google/GoogleAppMeasurement.git"
  1295. // Point SPM CI to the tip of main of https://github.com/google/GoogleAppMeasurement so that the
  1296. // release process can defer publishing the GoogleAppMeasurement tag until after testing.
  1297. if ProcessInfo.processInfo.environment["FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT"] != nil {
  1298. return .package(url: appMeasurementURL, branch: "main")
  1299. }
  1300. return .package(url: appMeasurementURL, exact: "11.3.0")
  1301. }
  1302. func abseilDependency() -> Package.Dependency {
  1303. let packageInfo: (url: String, range: Range<Version>)
  1304. // If building Firestore from source, abseil will need to be built as source
  1305. // as the headers in the binary version of abseil are unusable.
  1306. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1307. packageInfo = (
  1308. "https://github.com/firebase/abseil-cpp-SwiftPM.git",
  1309. "0.20240116.1" ..< "0.20240117.0"
  1310. )
  1311. } else {
  1312. packageInfo = (
  1313. "https://github.com/google/abseil-cpp-binary.git",
  1314. "1.2024011602.0" ..< "1.2024011700.0"
  1315. )
  1316. }
  1317. return .package(url: packageInfo.url, packageInfo.range)
  1318. }
  1319. func grpcDependency() -> Package.Dependency {
  1320. let packageInfo: (url: String, range: Range<Version>)
  1321. // If building Firestore from source, abseil will need to be built as source
  1322. // as the headers in the binary version of abseil are unusable.
  1323. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1324. packageInfo = ("https://github.com/grpc/grpc-ios.git", "1.65.0" ..< "1.66.0")
  1325. } else {
  1326. packageInfo = ("https://github.com/google/grpc-binary.git", "1.65.1" ..< "1.66.0")
  1327. }
  1328. return .package(url: packageInfo.url, packageInfo.range)
  1329. }
  1330. func firestoreWrapperTarget() -> Target {
  1331. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1332. return .target(
  1333. name: "FirebaseFirestoreTarget",
  1334. dependencies: [.target(name: "FirebaseFirestore",
  1335. condition: .when(platforms: [.iOS, .tvOS, .macOS, .visionOS]))],
  1336. path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap"
  1337. )
  1338. }
  1339. return .target(
  1340. name: "FirebaseFirestoreTarget",
  1341. dependencies: [.target(name: "FirebaseFirestore",
  1342. condition: .when(platforms: [.iOS, .tvOS, .macOS, .macCatalyst]))],
  1343. path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap",
  1344. cSettings: [.define("FIREBASE_BINARY_FIRESTORE", to: "1")]
  1345. )
  1346. }
  1347. func firestoreTargets() -> [Target] {
  1348. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1349. return [
  1350. .target(
  1351. name: "FirebaseFirestoreInternalWrapper",
  1352. dependencies: [
  1353. "FirebaseAppCheckInterop",
  1354. "FirebaseCore",
  1355. "leveldb",
  1356. .product(name: "nanopb", package: "nanopb"),
  1357. .product(name: "abseil", package: "abseil-cpp-SwiftPM"),
  1358. .product(name: "gRPC-cpp", package: "grpc-ios"),
  1359. ],
  1360. path: "Firestore",
  1361. exclude: [
  1362. "CHANGELOG.md",
  1363. "CMakeLists.txt",
  1364. "Example/",
  1365. "LICENSE",
  1366. "Protos/CMakeLists.txt",
  1367. "Protos/Podfile",
  1368. "Protos/README.md",
  1369. "Protos/build_protos.py",
  1370. "Protos/cpp/",
  1371. "Protos/lib/",
  1372. "Protos/nanopb_cpp_generator.py",
  1373. "Protos/protos/",
  1374. "README.md",
  1375. "Source/CMakeLists.txt",
  1376. "Swift/",
  1377. "core/CMakeLists.txt",
  1378. "core/src/util/config_detected.h.in",
  1379. "core/test/",
  1380. "fuzzing/",
  1381. "test.sh",
  1382. // Swift PM doesn't recognize hpp files, so we're relying on search paths
  1383. // to find third_party/nlohmann_json/json.hpp.
  1384. "third_party/",
  1385. // Exclude alternate implementations for other platforms
  1386. "core/src/remote/connectivity_monitor_noop.cc",
  1387. "core/src/util/filesystem_win.cc",
  1388. "core/src/util/log_stdio.cc",
  1389. "core/src/util/secure_random_openssl.cc",
  1390. ],
  1391. sources: [
  1392. "Source/",
  1393. "Protos/nanopb/",
  1394. "core/include/",
  1395. "core/src",
  1396. ],
  1397. publicHeadersPath: "Source/Public",
  1398. cSettings: [
  1399. .headerSearchPath("../"),
  1400. .headerSearchPath("Source/Public/FirebaseFirestore"),
  1401. .headerSearchPath("Protos/nanopb"),
  1402. .define("PB_FIELD_32BIT", to: "1"),
  1403. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1404. .define("PB_ENABLE_MALLOC", to: "1"),
  1405. .define("FIRFirestore_VERSION", to: firebaseVersion),
  1406. ],
  1407. linkerSettings: [
  1408. .linkedFramework(
  1409. "SystemConfiguration",
  1410. .when(platforms: [.iOS, .macOS, .tvOS, .visionOS])
  1411. ),
  1412. .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS, .visionOS])),
  1413. .linkedLibrary("c++"),
  1414. ]
  1415. ),
  1416. .target(
  1417. name: "FirebaseFirestore",
  1418. dependencies: [
  1419. "FirebaseCore",
  1420. "FirebaseCoreExtension",
  1421. "FirebaseFirestoreInternalWrapper",
  1422. "FirebaseSharedSwift",
  1423. ],
  1424. path: "Firestore",
  1425. exclude: [
  1426. "CHANGELOG.md",
  1427. "CMakeLists.txt",
  1428. "Example/",
  1429. "LICENSE",
  1430. "Protos/",
  1431. "README.md",
  1432. "Source/",
  1433. "core/",
  1434. "fuzzing/",
  1435. "test.sh",
  1436. "Swift/CHANGELOG.md",
  1437. "Swift/Tests/",
  1438. "third_party/nlohmann_json",
  1439. ],
  1440. sources: [
  1441. "Swift/Source/",
  1442. ],
  1443. resources: [.process("Source/Resources/PrivacyInfo.xcprivacy")]
  1444. ),
  1445. ]
  1446. }
  1447. let firestoreInternalTarget: Target = {
  1448. if ProcessInfo.processInfo.environment["FIREBASECI_USE_LOCAL_FIRESTORE_ZIP"] != nil {
  1449. // This is set when running `scripts/check_firestore_symbols.sh`.
  1450. return .binaryTarget(
  1451. name: "FirebaseFirestoreInternal",
  1452. // The `xcframework` should be moved to the root of the repo.
  1453. path: "FirebaseFirestoreInternal.xcframework"
  1454. )
  1455. } else {
  1456. return .binaryTarget(
  1457. name: "FirebaseFirestoreInternal",
  1458. url: "https://dl.google.com/firebase/ios/bin/firestore/11.3.0/rc0/FirebaseFirestoreInternal.zip",
  1459. checksum: "214f91ae3ad87fce55155ea3e6dacda4f237e703ea3935353c7c6819eddb1c17"
  1460. )
  1461. }
  1462. }()
  1463. return [
  1464. .target(
  1465. name: "FirebaseFirestore",
  1466. dependencies: [
  1467. .target(
  1468. name: "FirebaseFirestoreInternalWrapper",
  1469. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1470. ),
  1471. .product(
  1472. name: "abseil",
  1473. package: "abseil-cpp-binary",
  1474. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1475. ),
  1476. .product(
  1477. name: "gRPC-C++",
  1478. package: "grpc-binary",
  1479. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1480. ),
  1481. .product(name: "nanopb", package: "nanopb"),
  1482. "FirebaseAppCheckInterop",
  1483. "FirebaseCore",
  1484. "FirebaseCoreExtension",
  1485. "leveldb",
  1486. "FirebaseSharedSwift",
  1487. ],
  1488. path: "Firestore/Swift/Source",
  1489. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  1490. linkerSettings: [
  1491. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  1492. .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS])),
  1493. .linkedLibrary("c++"),
  1494. ]
  1495. ),
  1496. .target(
  1497. name: "FirebaseFirestoreInternalWrapper",
  1498. dependencies: [.target(
  1499. name: "FirebaseFirestoreInternal",
  1500. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1501. )],
  1502. path: "FirebaseFirestoreInternal",
  1503. publicHeadersPath: "."
  1504. ),
  1505. firestoreInternalTarget,
  1506. ]
  1507. }