Package.swift 50 KB

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