Package.swift 49 KB

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