Package.swift 46 KB

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