Package.swift 46 KB

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