Package.swift 46 KB

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