Package.swift 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537
  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 class Foundation.ProcessInfo
  18. import PackageDescription
  19. let firebaseVersion = "10.20.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.3.0" ..< "10.0.0"
  150. ),
  151. .package(
  152. url: "https://github.com/google/GoogleUtilities.git",
  153. "7.12.1" ..< "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", "10.18.0" ..< "11.0.0"),
  182. ],
  183. targets: [
  184. .target(
  185. name: "Firebase",
  186. path: "CoreOnly/Sources",
  187. publicHeadersPath: "./"
  188. ),
  189. .target(
  190. name: "FirebaseCore",
  191. dependencies: [
  192. "Firebase",
  193. "FirebaseCoreInternal",
  194. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  195. .product(name: "GULLogger", package: "GoogleUtilities"),
  196. ],
  197. path: "FirebaseCore/Sources",
  198. publicHeadersPath: "Public",
  199. cSettings: [
  200. .headerSearchPath("../.."),
  201. .define("Firebase_VERSION", to: firebaseVersion),
  202. // TODO: - Add support for cflags cSetting so that we can set the -fno-autolink option
  203. ],
  204. linkerSettings: [
  205. .linkedFramework("UIKit", .when(platforms: [.iOS, .macCatalyst, .tvOS])),
  206. .linkedFramework("AppKit", .when(platforms: [.macOS])),
  207. ]
  208. ),
  209. .testTarget(
  210. name: "CoreUnit",
  211. dependencies: [
  212. "FirebaseCore",
  213. "SharedTestUtilities",
  214. .product(name: "OCMock", package: "ocmock"),
  215. ],
  216. path: "FirebaseCore/Tests/Unit",
  217. exclude: ["Resources/GoogleService-Info.plist"],
  218. cSettings: [
  219. .headerSearchPath("../../.."),
  220. ]
  221. ),
  222. // MARK: - Firebase Core Extension
  223. // Extension of FirebaseCore for consuming by Swift product SDKs.
  224. // When depending on `FirebaseCoreExtension`, also depend on `FirebaseCore`
  225. // to avoid potential linker issues.
  226. .target(
  227. name: "FirebaseCoreExtension",
  228. path: "FirebaseCore/Extension",
  229. publicHeadersPath: ".",
  230. cSettings: [
  231. .headerSearchPath("../../"),
  232. ]
  233. ),
  234. // MARK: - Firebase Core Internal
  235. // Shared collection of APIs for internal FirebaseCore usage.
  236. .target(
  237. name: "FirebaseCoreInternal",
  238. dependencies: [
  239. .product(name: "GULNSData", package: "GoogleUtilities"),
  240. ],
  241. path: "FirebaseCore/Internal/Sources"
  242. ),
  243. .testTarget(
  244. name: "FirebaseCoreInternalTests",
  245. dependencies: [
  246. "FirebaseCoreInternal",
  247. ],
  248. path: "FirebaseCore/Internal/Tests"
  249. ),
  250. .target(
  251. name: "FirebaseABTesting",
  252. dependencies: ["FirebaseCore"],
  253. path: "FirebaseABTesting/Sources",
  254. publicHeadersPath: "Public",
  255. cSettings: [
  256. .headerSearchPath("../../"),
  257. ]
  258. ),
  259. .testTarget(
  260. name: "ABTestingUnit",
  261. dependencies: ["FirebaseABTesting", .product(name: "OCMock", package: "ocmock")],
  262. path: "FirebaseABTesting/Tests/Unit",
  263. resources: [.process("Resources")],
  264. cSettings: [
  265. .headerSearchPath("../../.."),
  266. ]
  267. ),
  268. .target(
  269. name: "FirebaseAnalyticsTarget",
  270. dependencies: [.target(name: "FirebaseAnalyticsWrapper",
  271. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS]))],
  272. path: "SwiftPM-PlatformExclude/FirebaseAnalyticsWrap"
  273. ),
  274. .target(
  275. name: "FirebaseAnalyticsWrapper",
  276. dependencies: [
  277. .target(
  278. name: "FirebaseAnalytics",
  279. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  280. ),
  281. .product(name: "GoogleAppMeasurement",
  282. package: "GoogleAppMeasurement",
  283. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])),
  284. "FirebaseCore",
  285. "FirebaseInstallations",
  286. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  287. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  288. .product(name: "GULNSData", package: "GoogleUtilities"),
  289. .product(name: "GULNetwork", package: "GoogleUtilities"),
  290. .product(name: "nanopb", package: "nanopb"),
  291. ],
  292. path: "FirebaseAnalyticsWrapper",
  293. linkerSettings: [
  294. .linkedLibrary("sqlite3"),
  295. .linkedLibrary("c++"),
  296. .linkedLibrary("z"),
  297. .linkedFramework("StoreKit"),
  298. ]
  299. ),
  300. .binaryTarget(
  301. name: "FirebaseAnalytics",
  302. url: "https://dl.google.com/firebase/ios/swiftpm/10.17.0/FirebaseAnalytics.zip",
  303. checksum: "94a559d3801a445802c4bc6e6a50b283eff7dd25f8994e63a06589dbb6c18bdf"
  304. ),
  305. .target(
  306. name: "FirebaseAnalyticsSwiftTarget",
  307. dependencies: [.target(name: "FirebaseAnalyticsSwift",
  308. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS]))],
  309. path: "SwiftPM-PlatformExclude/FirebaseAnalyticsSwiftWrap"
  310. ),
  311. .target(
  312. name: "FirebaseAnalyticsSwift",
  313. dependencies: ["FirebaseAnalyticsWrapper"],
  314. path: "FirebaseAnalyticsSwift/Sources"
  315. ),
  316. .testTarget(
  317. name: "AnalyticsSwiftUnit",
  318. dependencies: ["FirebaseAnalyticsSwift"],
  319. path: "FirebaseAnalyticsSwift/Tests/SwiftUnit"
  320. ),
  321. .testTarget(
  322. name: "AnalyticsObjCAPI",
  323. dependencies: ["FirebaseAnalyticsSwift"],
  324. path: "FirebaseAnalyticsSwift/Tests/ObjCAPI"
  325. ),
  326. .target(
  327. name: "FirebaseAnalyticsWithoutAdIdSupportTarget",
  328. dependencies: [.target(name: "FirebaseAnalyticsWithoutAdIdSupportWrapper",
  329. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS]))],
  330. path: "SwiftPM-PlatformExclude/FirebaseAnalyticsWithoutAdIdSupportWrap"
  331. ),
  332. .target(
  333. name: "FirebaseAnalyticsWithoutAdIdSupportWrapper",
  334. dependencies: [
  335. .target(
  336. name: "FirebaseAnalytics",
  337. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  338. ),
  339. .product(name: "GoogleAppMeasurementWithoutAdIdSupport",
  340. package: "GoogleAppMeasurement",
  341. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])),
  342. "FirebaseCore",
  343. "FirebaseInstallations",
  344. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  345. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  346. .product(name: "GULNSData", package: "GoogleUtilities"),
  347. .product(name: "GULNetwork", package: "GoogleUtilities"),
  348. .product(name: "nanopb", package: "nanopb"),
  349. ],
  350. path: "FirebaseAnalyticsWithoutAdIdSupportWrapper",
  351. linkerSettings: [
  352. .linkedLibrary("sqlite3"),
  353. .linkedLibrary("c++"),
  354. .linkedLibrary("z"),
  355. .linkedFramework("StoreKit"),
  356. ]
  357. ),
  358. .target(
  359. name: "FirebaseAnalyticsOnDeviceConversionTarget",
  360. dependencies: [
  361. .product(name: "GoogleAppMeasurementOnDeviceConversion",
  362. package: "GoogleAppMeasurement",
  363. condition: .when(platforms: [.iOS])),
  364. ],
  365. path: "FirebaseAnalyticsOnDeviceConversionWrapper",
  366. linkerSettings: [
  367. .linkedLibrary("c++"),
  368. ]
  369. ),
  370. .target(
  371. name: "FirebaseAppDistributionTarget",
  372. dependencies: [.target(name: "FirebaseAppDistribution",
  373. condition: .when(platforms: [.iOS]))],
  374. path: "SwiftPM-PlatformExclude/FirebaseAppDistributionWrap"
  375. ),
  376. .target(
  377. name: "FirebaseAppDistribution",
  378. dependencies: [
  379. "FirebaseCore",
  380. "FirebaseInstallations",
  381. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  382. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  383. ],
  384. path: "FirebaseAppDistribution/Sources",
  385. publicHeadersPath: "Public",
  386. cSettings: [
  387. .headerSearchPath("../../"),
  388. ]
  389. ),
  390. .testTarget(
  391. name: "AppDistributionUnit",
  392. dependencies: ["FirebaseAppDistribution", .product(name: "OCMock", package: "ocmock")],
  393. path: "FirebaseAppDistribution/Tests/Unit",
  394. exclude: ["Swift/"],
  395. resources: [.process("Resources")],
  396. cSettings: [
  397. .headerSearchPath("../../.."),
  398. ]
  399. ),
  400. .testTarget(
  401. name: "AppDistributionUnitSwift",
  402. dependencies: ["FirebaseAppDistribution"],
  403. path: "FirebaseAppDistribution/Tests/Unit/Swift",
  404. cSettings: [
  405. .headerSearchPath("../../../.."),
  406. ]
  407. ),
  408. .target(
  409. name: "FirebaseAuth",
  410. dependencies: [
  411. "FirebaseAppCheckInterop",
  412. "FirebaseCore",
  413. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  414. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  415. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  416. .product(name: "RecaptchaInterop", package: "interop-ios-for-google-sdks"),
  417. ],
  418. path: "FirebaseAuth/Sources",
  419. publicHeadersPath: "Public",
  420. cSettings: [
  421. .headerSearchPath("../../"),
  422. ],
  423. linkerSettings: [
  424. .linkedFramework("Security"),
  425. .linkedFramework("SafariServices", .when(platforms: [.iOS])),
  426. ]
  427. ),
  428. // Internal headers only for consuming from Swift.
  429. .target(
  430. name: "FirebaseAuthInterop",
  431. path: "FirebaseAuth/Interop",
  432. exclude: [
  433. "CMakeLists.txt",
  434. ],
  435. publicHeadersPath: ".",
  436. cSettings: [
  437. .headerSearchPath("../../"),
  438. ]
  439. ),
  440. .testTarget(
  441. name: "AuthUnit",
  442. dependencies: [
  443. "FirebaseAuth",
  444. .product(name: "OCMock", package: "ocmock"),
  445. ],
  446. path: "FirebaseAuth/Tests/Unit",
  447. exclude: [
  448. "FIRAuthKeychainServicesTests.m", // TODO: figure out SPM keychain testing
  449. "FIRAuthTests.m",
  450. "FIRUserTests.m",
  451. "SwiftAPI.swift", // Only builds via CocoaPods testing until Swift source update.
  452. "SwiftGlobalTests.swift", // Only builds via CocoaPods testing until Swift source update.
  453. ],
  454. cSettings: [
  455. .headerSearchPath("../../.."),
  456. ]
  457. ),
  458. .target(
  459. name: "FirebaseAuthCombineSwift",
  460. dependencies: ["FirebaseAuth"],
  461. path: "FirebaseCombineSwift/Sources/Auth"
  462. ),
  463. .target(
  464. name: "FirebaseFirestoreCombineSwift",
  465. dependencies: [
  466. "FirebaseFirestoreTarget",
  467. "FirebaseFirestoreSwift",
  468. ],
  469. path: "FirebaseCombineSwift/Sources/Firestore"
  470. ),
  471. .target(
  472. name: "FirebaseStorageCombineSwift",
  473. dependencies: [
  474. "FirebaseStorage",
  475. ],
  476. path: "FirebaseCombineSwift/Sources/Storage"
  477. ),
  478. .target(
  479. name: "FirebaseCrashlytics",
  480. dependencies: ["FirebaseCore", "FirebaseInstallations", "FirebaseSessions",
  481. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  482. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  483. .product(name: "FBLPromises", package: "Promises"),
  484. .product(name: "nanopb", package: "nanopb")],
  485. path: "Crashlytics",
  486. exclude: [
  487. "run",
  488. "CHANGELOG.md",
  489. "LICENSE",
  490. "README.md",
  491. "ProtoSupport/",
  492. "UnitTests/",
  493. "generate_project.sh",
  494. "upload-symbols",
  495. "CrashlyticsInputFiles.xcfilelist",
  496. "third_party/libunwind/LICENSE",
  497. ],
  498. sources: [
  499. "Crashlytics/",
  500. "Protogen/",
  501. "Shared/",
  502. "third_party/libunwind/dwarf.h",
  503. ],
  504. publicHeadersPath: "Crashlytics/Public",
  505. cSettings: [
  506. .headerSearchPath(".."),
  507. .define("DISPLAY_VERSION", to: firebaseVersion),
  508. .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])),
  509. .define(
  510. "CLS_SDK_NAME",
  511. to: "Crashlytics macOS SDK",
  512. .when(platforms: [.macOS, .macCatalyst])
  513. ),
  514. .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])),
  515. .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])),
  516. .define("PB_FIELD_32BIT", to: "1"),
  517. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  518. .define("PB_ENABLE_MALLOC", to: "1"),
  519. ],
  520. linkerSettings: [
  521. .linkedFramework("Security"),
  522. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  523. ]
  524. ),
  525. .testTarget(
  526. name: "FirebaseCrashlyticsUnit",
  527. dependencies: ["FirebaseCrashlytics", .product(name: "OCMock", package: "ocmock")],
  528. path: "Crashlytics/UnitTests",
  529. resources: [
  530. .copy("FIRCLSMachO/machO_data"),
  531. .copy("Data"),
  532. ],
  533. cSettings: [
  534. .headerSearchPath("../.."),
  535. .define("DISPLAY_VERSION", to: firebaseVersion),
  536. .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])),
  537. .define(
  538. "CLS_SDK_NAME",
  539. to: "Crashlytics macOS SDK",
  540. .when(platforms: [.macOS, .macCatalyst])
  541. ),
  542. .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])),
  543. .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])),
  544. ]
  545. ),
  546. .target(
  547. name: "FirebaseDatabaseInternal",
  548. dependencies: [
  549. "FirebaseAppCheckInterop",
  550. "FirebaseCore",
  551. "leveldb",
  552. ],
  553. path: "FirebaseDatabase/Sources",
  554. exclude: [
  555. "third_party/Wrap-leveldb/LICENSE",
  556. "third_party/SocketRocket/LICENSE",
  557. "third_party/FImmutableSortedDictionary/LICENSE",
  558. "third_party/SocketRocket/aa2297808c225710e267afece4439c256f6efdb3",
  559. ],
  560. publicHeadersPath: "Public",
  561. cSettings: [
  562. .headerSearchPath("../../"),
  563. ],
  564. linkerSettings: [
  565. .linkedFramework("CFNetwork"),
  566. .linkedFramework("Security"),
  567. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  568. .linkedFramework("WatchKit", .when(platforms: [.watchOS])),
  569. ]
  570. ),
  571. .testTarget(
  572. name: "DatabaseUnit",
  573. dependencies: [
  574. "FirebaseDatabase",
  575. "SharedTestUtilities",
  576. .product(name: "OCMock", package: "ocmock"),
  577. ],
  578. path: "FirebaseDatabase/Tests/",
  579. exclude: [
  580. // Disable Swift tests as mixed targets are not supported (Xcode 12.4).
  581. "Unit/Swift",
  582. "Integration/",
  583. ],
  584. resources: [.process("Resources")],
  585. cSettings: [
  586. .headerSearchPath("../.."),
  587. ]
  588. ),
  589. .testTarget(
  590. name: "DatabaseUnitSwift",
  591. dependencies: ["FirebaseDatabase"],
  592. path: "FirebaseDatabase/Tests/Unit/Swift",
  593. cSettings: [
  594. .headerSearchPath("../.."),
  595. ]
  596. ),
  597. .target(
  598. name: "FirebaseDatabase",
  599. dependencies: ["FirebaseDatabaseInternal", "FirebaseSharedSwift"],
  600. path: "FirebaseDatabase/Swift/Sources"
  601. ),
  602. .target(
  603. name: "FirebaseDatabaseSwift",
  604. dependencies: ["FirebaseDatabase"],
  605. path: "FirebaseDatabaseSwift/Sources"
  606. ),
  607. .testTarget(
  608. name: "FirebaseDatabaseSwiftTests",
  609. dependencies: ["FirebaseDatabase", "FirebaseDatabaseSwift"],
  610. path: "FirebaseDatabaseSwift/Tests/"
  611. ),
  612. .target(
  613. name: "FirebaseSharedSwift",
  614. path: "FirebaseSharedSwift/Sources",
  615. exclude: [
  616. "third_party/FirebaseDataEncoder/LICENSE",
  617. "third_party/FirebaseDataEncoder/METADATA",
  618. ]
  619. ),
  620. .testTarget(
  621. name: "FirebaseSharedSwiftTests",
  622. dependencies: ["FirebaseSharedSwift"],
  623. path: "FirebaseSharedSwift/Tests/"
  624. ),
  625. .target(
  626. name: "FirebaseDynamicLinksTarget",
  627. dependencies: [.target(name: "FirebaseDynamicLinks",
  628. condition: .when(platforms: [.iOS]))],
  629. path: "SwiftPM-PlatformExclude/FirebaseDynamicLinksWrap"
  630. ),
  631. .target(
  632. name: "FirebaseDynamicLinks",
  633. dependencies: ["FirebaseCore"],
  634. path: "FirebaseDynamicLinks/Sources",
  635. publicHeadersPath: "Public",
  636. cSettings: [
  637. .headerSearchPath("../../"),
  638. .define("FIRDynamicLinks3P", to: "1"),
  639. .define("GIN_SCION_LOGGING", to: "1"),
  640. ],
  641. linkerSettings: [
  642. .linkedFramework("QuartzCore"),
  643. ]
  644. ),
  645. firestoreWrapperTarget(),
  646. .target(
  647. name: "FirebaseFirestoreSwiftTarget",
  648. dependencies: [.target(name: "FirebaseFirestoreSwift",
  649. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS,
  650. .firebaseVisionOS]))],
  651. path: "SwiftPM-PlatformExclude/FirebaseFirestoreSwiftWrap"
  652. ),
  653. .target(
  654. name: "FirebaseFirestoreSwift",
  655. dependencies: [
  656. "FirebaseFirestoreTarget",
  657. ],
  658. path: "FirebaseFirestoreSwift/Sources"
  659. ),
  660. // MARK: - Firebase Functions
  661. .target(
  662. name: "FirebaseFunctions",
  663. dependencies: [
  664. "FirebaseAppCheckInterop",
  665. "FirebaseAuthInterop",
  666. "FirebaseCore",
  667. "FirebaseCoreExtension",
  668. "FirebaseMessagingInterop",
  669. "FirebaseSharedSwift",
  670. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  671. ],
  672. path: "FirebaseFunctions/Sources"
  673. ),
  674. .testTarget(
  675. name: "FirebaseFunctionsUnit",
  676. dependencies: ["FirebaseFunctions",
  677. "FirebaseAppCheckInterop",
  678. "FirebaseAuthInterop",
  679. "FirebaseMessagingInterop",
  680. "SharedTestUtilities"],
  681. path: "FirebaseFunctions/Tests/Unit",
  682. cSettings: [
  683. .headerSearchPath("../../../"),
  684. ]
  685. ),
  686. .testTarget(
  687. name: "FirebaseFunctionsIntegration",
  688. dependencies: ["FirebaseFunctions",
  689. "SharedTestUtilities"],
  690. path: "FirebaseFunctions/Tests/Integration"
  691. ),
  692. .testTarget(
  693. name: "FirebaseFunctionsObjCIntegration",
  694. dependencies: ["FirebaseFunctions",
  695. "SharedTestUtilities"],
  696. path: "FirebaseFunctions/Tests/ObjCIntegration",
  697. // See https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730
  698. exclude: [
  699. "ObjCPPAPITests.mm",
  700. ],
  701. cSettings: [
  702. .headerSearchPath("../../.."),
  703. ]
  704. ),
  705. .target(
  706. name: "FirebaseFunctionsCombineSwift",
  707. dependencies: ["FirebaseFunctions"],
  708. path: "FirebaseCombineSwift/Sources/Functions"
  709. ),
  710. .testTarget(
  711. name: "FunctionsCombineUnit",
  712. dependencies: ["FirebaseFunctionsCombineSwift",
  713. "SharedTestUtilities"],
  714. path: "FirebaseFunctions/Tests/CombineUnit"
  715. ),
  716. // MARK: - Firebase In App Messaging
  717. .target(
  718. name: "FirebaseInAppMessagingTarget",
  719. dependencies: [
  720. .target(name: "FirebaseInAppMessaging", condition: .when(platforms: [.iOS, .tvOS])),
  721. ],
  722. path: "SwiftPM-PlatformExclude/FirebaseInAppMessagingWrap"
  723. ),
  724. .target(
  725. name: "FirebaseInAppMessagingInternal",
  726. dependencies: [
  727. "FirebaseCore",
  728. "FirebaseInstallations",
  729. "FirebaseABTesting",
  730. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  731. .product(name: "nanopb", package: "nanopb"),
  732. .target(name: "FirebaseInAppMessaging_iOS", condition: .when(platforms: [.iOS])),
  733. ],
  734. path: "FirebaseInAppMessaging/Sources",
  735. exclude: [
  736. "DefaultUI/CHANGELOG.md",
  737. "DefaultUI/README.md",
  738. ],
  739. publicHeadersPath: "Public",
  740. cSettings: [
  741. .headerSearchPath("../../"),
  742. .define("PB_FIELD_32BIT", to: "1"),
  743. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  744. .define("PB_ENABLE_MALLOC", to: "1"),
  745. ]
  746. ),
  747. .target(
  748. name: "FirebaseInAppMessaging_iOS",
  749. path: "FirebaseInAppMessaging/iOS",
  750. resources: [.process("Resources")]
  751. ),
  752. .target(
  753. name: "FirebaseInAppMessaging",
  754. dependencies: ["FirebaseInAppMessagingInternal"],
  755. path: "FirebaseInAppMessaging/Swift/Source"
  756. ),
  757. .target(
  758. name: "FirebaseInAppMessagingSwift",
  759. dependencies: ["FirebaseInAppMessaging"],
  760. path: "FirebaseInAppMessagingSwift/Sources"
  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, .firebaseVisionOS]))],
  853. path: "SwiftPM-PlatformExclude/FirebasePerformanceWrap"
  854. ),
  855. .target(
  856. name: "FirebasePerformance",
  857. dependencies: [
  858. "FirebaseCore",
  859. "FirebaseInstallations",
  860. // Performance depends on the Obj-C target of FirebaseRemoteConfig to
  861. // avoid including Swift code from the `FirebaseRemoteConfig` target
  862. // that is unneeded.
  863. "FirebaseRemoteConfigInternal",
  864. "FirebaseSessions",
  865. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  866. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  867. .product(name: "GULISASwizzler", package: "GoogleUtilities"),
  868. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  869. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  870. .product(name: "nanopb", package: "nanopb"),
  871. ],
  872. path: "FirebasePerformance/Sources",
  873. publicHeadersPath: "Public",
  874. cSettings: [
  875. .headerSearchPath("../../"),
  876. .define("PB_FIELD_32BIT", to: "1"),
  877. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  878. .define("PB_ENABLE_MALLOC", to: "1"),
  879. .define("FIRPerformance_LIB_VERSION", to: firebaseVersion),
  880. ],
  881. linkerSettings: [
  882. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .tvOS])),
  883. .linkedFramework("MobileCoreServices", .when(platforms: [.iOS, .tvOS])),
  884. .linkedFramework("QuartzCore", .when(platforms: [.iOS, .tvOS])),
  885. ]
  886. ),
  887. .testTarget(
  888. name: "PerformanceUnit",
  889. dependencies: [
  890. "FirebasePerformanceTarget",
  891. "SharedTestUtilities",
  892. "GCDWebServer",
  893. .product(name: "OCMock", package: "ocmock"),
  894. ],
  895. path: "FirebasePerformance/Tests/Unit",
  896. resources: [
  897. .process("FPRURLFilterTests-Info.plist"),
  898. .process("Server/smallDownloadFile"),
  899. .process("Server/bigDownloadFile"),
  900. ],
  901. cSettings: [
  902. .headerSearchPath("../../.."),
  903. .define("PB_FIELD_32BIT", to: "1"),
  904. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  905. .define("PB_ENABLE_MALLOC", to: "1"),
  906. ]
  907. ),
  908. .target(
  909. name: "SharedTestUtilities",
  910. dependencies: ["FirebaseCore",
  911. "FirebaseAppCheckInterop",
  912. "FirebaseAuthInterop",
  913. "FirebaseMessagingInterop",
  914. "GoogleDataTransport",
  915. .product(name: "OCMock", package: "ocmock")],
  916. path: "SharedTestUtilities",
  917. publicHeadersPath: "./",
  918. cSettings: [
  919. .headerSearchPath("../"),
  920. ]
  921. ),
  922. // MARK: - Firebase Remote Config
  923. .target(
  924. name: "FirebaseRemoteConfigInternal",
  925. dependencies: [
  926. "FirebaseCore",
  927. "FirebaseABTesting",
  928. "FirebaseInstallations",
  929. .product(name: "GULNSData", package: "GoogleUtilities"),
  930. ],
  931. path: "FirebaseRemoteConfig/Sources",
  932. publicHeadersPath: "Public",
  933. cSettings: [
  934. .headerSearchPath("../../"),
  935. ]
  936. ),
  937. .testTarget(
  938. name: "RemoteConfigUnit",
  939. dependencies: ["FirebaseRemoteConfigInternal", .product(name: "OCMock", package: "ocmock")],
  940. path: "FirebaseRemoteConfig/Tests/Unit",
  941. exclude: [
  942. // Need to be evaluated/ported to RC V2.
  943. "RCNConfigAnalyticsTest.m",
  944. "RCNConfigSettingsTest.m",
  945. "RCNConfigTest.m",
  946. "RCNRemoteConfig+FIRAppTest.m",
  947. "RCNThrottlingTests.m",
  948. ],
  949. resources: [
  950. .process("SecondApp-GoogleService-Info.plist"),
  951. .process("Defaults-testInfo.plist"),
  952. .process("TestABTPayload.txt"),
  953. ],
  954. cSettings: [
  955. .headerSearchPath("../../.."),
  956. ]
  957. ),
  958. .target(
  959. name: "FirebaseRemoteConfig",
  960. dependencies: [
  961. "FirebaseRemoteConfigInternal",
  962. "FirebaseSharedSwift",
  963. ],
  964. path: "FirebaseRemoteConfig/Swift"
  965. ),
  966. .target(
  967. name: "FirebaseRemoteConfigSwift",
  968. dependencies: [
  969. "FirebaseRemoteConfig",
  970. ],
  971. path: "FirebaseRemoteConfigSwift/Sources"
  972. ),
  973. .testTarget(
  974. name: "RemoteConfigFakeConsole",
  975. dependencies: ["FirebaseRemoteConfig",
  976. "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. .target(name: "FirebaseInAppMessaging",
  1127. condition: .when(platforms: [.iOS, .tvOS])),
  1128. .target(name: "FirebaseInAppMessagingSwift",
  1129. condition: .when(platforms: [.iOS, .tvOS])),
  1130. "FirebaseInstallations",
  1131. "FirebaseMessaging",
  1132. .target(name: "FirebasePerformance",
  1133. condition: .when(platforms: [.iOS, .tvOS])),
  1134. "FirebaseRemoteConfig",
  1135. "FirebaseSessions",
  1136. "FirebaseStorage",
  1137. .product(name: "nanopb", package: "nanopb"),
  1138. ],
  1139. path: "SwiftPMTests/swift-test"
  1140. ),
  1141. .testTarget(
  1142. name: "analytics-import-test",
  1143. dependencies: [
  1144. "FirebaseAnalyticsSwiftTarget",
  1145. "FirebaseAnalyticsWrapper",
  1146. "Firebase",
  1147. ],
  1148. path: "SwiftPMTests/analytics-import-test"
  1149. ),
  1150. .testTarget(
  1151. name: "objc-import-test",
  1152. dependencies: [
  1153. "Firebase",
  1154. "FirebaseAuth",
  1155. "FirebaseABTesting",
  1156. "FirebaseAppCheck",
  1157. .target(name: "FirebaseAppDistribution",
  1158. condition: .when(platforms: [.iOS])),
  1159. "FirebaseCrashlytics",
  1160. "FirebaseCore",
  1161. "FirebaseDatabase",
  1162. "FirebaseDynamicLinks",
  1163. "FirebaseFirestoreTarget",
  1164. "FirebaseFunctions",
  1165. .target(name: "FirebaseInAppMessaging",
  1166. condition: .when(platforms: [.iOS, .tvOS])),
  1167. "FirebaseInstallations",
  1168. "FirebaseMessaging",
  1169. .target(name: "FirebasePerformance",
  1170. condition: .when(platforms: [.iOS, .tvOS])),
  1171. "FirebaseRemoteConfig",
  1172. "FirebaseStorage",
  1173. ],
  1174. path: "SwiftPMTests/objc-import-test"
  1175. ),
  1176. .testTarget(
  1177. name: "version-test",
  1178. dependencies: [
  1179. "FirebaseCore",
  1180. ],
  1181. path: "SwiftPMTests/version-test",
  1182. cSettings: [
  1183. .define("FIR_VERSION", to: firebaseVersion),
  1184. ]
  1185. ),
  1186. // MARK: - Firebase App Check
  1187. .target(name: "FirebaseAppCheck",
  1188. dependencies: [
  1189. "FirebaseAppCheckInterop",
  1190. "FirebaseCore",
  1191. .product(name: "AppCheckCore", package: "app-check"),
  1192. .product(name: "FBLPromises", package: "Promises"),
  1193. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1194. ],
  1195. path: "FirebaseAppCheck/Sources",
  1196. publicHeadersPath: "Public",
  1197. cSettings: [
  1198. .headerSearchPath("../.."),
  1199. ],
  1200. linkerSettings: [
  1201. .linkedFramework(
  1202. "DeviceCheck",
  1203. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1204. ),
  1205. ]),
  1206. // Internal headers only for consuming from Swift.
  1207. .target(
  1208. name: "FirebaseAppCheckInterop",
  1209. path: "FirebaseAppCheck/Interop",
  1210. exclude: [
  1211. "CMakeLists.txt",
  1212. ],
  1213. publicHeadersPath: "Public",
  1214. cSettings: [
  1215. .headerSearchPath("../../"),
  1216. ]
  1217. ),
  1218. .testTarget(
  1219. name: "FirebaseAppCheckUnit",
  1220. dependencies: [
  1221. "FirebaseAppCheck",
  1222. "SharedTestUtilities",
  1223. .product(name: "OCMock", package: "ocmock"),
  1224. ],
  1225. path: "FirebaseAppCheck/Tests/Unit",
  1226. exclude: [
  1227. // Swift tests are in the target `FirebaseAppCheckUnitSwift` since mixed language targets
  1228. // are not supported (as of Xcode 15.0).
  1229. "Swift",
  1230. ],
  1231. cSettings: [
  1232. .headerSearchPath("../../.."),
  1233. ]
  1234. ),
  1235. .testTarget(
  1236. name: "FirebaseAppCheckUnitSwift",
  1237. dependencies: ["FirebaseAppCheck"],
  1238. path: "FirebaseAppCheck/Tests/Unit/Swift"
  1239. ),
  1240. // MARK: Testing support
  1241. .target(
  1242. name: "FirebaseFirestoreTestingSupport",
  1243. dependencies: ["FirebaseFirestoreTarget"],
  1244. path: "FirebaseTestingSupport/Firestore/Sources",
  1245. publicHeadersPath: "./",
  1246. cSettings: [
  1247. .headerSearchPath("../../.."),
  1248. .headerSearchPath("../../../Firestore/Source/Public/FirebaseFirestore"),
  1249. ]
  1250. ),
  1251. .testTarget(
  1252. name: "FirestoreTestingSupportTests",
  1253. dependencies: ["FirebaseFirestoreTestingSupport"],
  1254. path: "FirebaseTestingSupport/Firestore/Tests",
  1255. cSettings: [
  1256. .headerSearchPath("../../.."),
  1257. ]
  1258. ),
  1259. ] + firestoreTargets(),
  1260. cLanguageStandard: .c99,
  1261. cxxLanguageStandard: CXXLanguageStandard.gnucxx14
  1262. )
  1263. // MARK: - Helper Functions
  1264. func googleAppMeasurementDependency() -> Package.Dependency {
  1265. let appMeasurementURL = "https://github.com/google/GoogleAppMeasurement.git"
  1266. // Point SPM CI to the tip of main of https://github.com/google/GoogleAppMeasurement so that the
  1267. // release process can defer publishing the GoogleAppMeasurement tag until after testing.
  1268. if ProcessInfo.processInfo.environment["FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT"] != nil {
  1269. return .package(url: appMeasurementURL, branch: "main")
  1270. }
  1271. return .package(url: appMeasurementURL, exact: "10.17.0")
  1272. }
  1273. func abseilDependency() -> Package.Dependency {
  1274. let packageInfo: (url: String, range: Range<Version>)
  1275. // If building Firestore from source, abseil will need to be built as source
  1276. // as the headers in the binary version of abseil are unusable.
  1277. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1278. packageInfo = (
  1279. "https://github.com/firebase/abseil-cpp-SwiftPM.git",
  1280. "0.20220623.0" ..< "0.20220624.0"
  1281. )
  1282. } else {
  1283. packageInfo = (
  1284. "https://github.com/google/abseil-cpp-binary.git",
  1285. "1.2022062300.0" ..< "1.2022062400.0"
  1286. )
  1287. }
  1288. return .package(url: packageInfo.url, packageInfo.range)
  1289. }
  1290. func grpcDependency() -> Package.Dependency {
  1291. let packageInfo: (url: String, range: Range<Version>)
  1292. // If building Firestore from source, abseil will need to be built as source
  1293. // as the headers in the binary version of abseil are unusable.
  1294. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1295. packageInfo = ("https://github.com/grpc/grpc-ios.git", "1.49.1" ..< "1.50.0")
  1296. } else {
  1297. packageInfo = ("https://github.com/google/grpc-binary.git", "1.49.1" ..< "1.50.0")
  1298. }
  1299. return .package(url: packageInfo.url, packageInfo.range)
  1300. }
  1301. func firestoreWrapperTarget() -> Target {
  1302. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1303. return .target(
  1304. name: "FirebaseFirestoreTarget",
  1305. dependencies: [.target(name: "FirebaseFirestore",
  1306. condition: .when(platforms: [.iOS, .tvOS, .macOS,
  1307. .firebaseVisionOS]))],
  1308. path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap"
  1309. )
  1310. }
  1311. return .target(
  1312. name: "FirebaseFirestoreTarget",
  1313. dependencies: [.target(name: "FirebaseFirestore",
  1314. condition: .when(platforms: [.iOS, .tvOS, .macOS, .macCatalyst]))],
  1315. path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap"
  1316. )
  1317. }
  1318. func firestoreTargets() -> [Target] {
  1319. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1320. return [
  1321. .target(
  1322. name: "FirebaseFirestoreInternalWrapper",
  1323. dependencies: [
  1324. "FirebaseAppCheckInterop",
  1325. "FirebaseCore",
  1326. "leveldb",
  1327. .product(name: "nanopb", package: "nanopb"),
  1328. .product(name: "abseil", package: "abseil-cpp-SwiftPM"),
  1329. .product(name: "gRPC-cpp", package: "grpc-ios"),
  1330. ],
  1331. path: "Firestore",
  1332. exclude: [
  1333. "CHANGELOG.md",
  1334. "CMakeLists.txt",
  1335. "Example/",
  1336. "LICENSE",
  1337. "Protos/CMakeLists.txt",
  1338. "Protos/Podfile",
  1339. "Protos/README.md",
  1340. "Protos/build_protos.py",
  1341. "Protos/cpp/",
  1342. "Protos/lib/",
  1343. "Protos/nanopb_cpp_generator.py",
  1344. "Protos/protos/",
  1345. "README.md",
  1346. "Source/CMakeLists.txt",
  1347. "Swift/",
  1348. "core/CMakeLists.txt",
  1349. "core/src/util/config_detected.h.in",
  1350. "core/test/",
  1351. "fuzzing/",
  1352. "test.sh",
  1353. // Swift PM doesn't recognize hpp files, so we're relying on search paths
  1354. // to find third_party/nlohmann_json/json.hpp.
  1355. "third_party/",
  1356. // Exclude alternate implementations for other platforms
  1357. "core/src/remote/connectivity_monitor_noop.cc",
  1358. "core/src/util/filesystem_win.cc",
  1359. "core/src/util/log_stdio.cc",
  1360. "core/src/util/secure_random_openssl.cc",
  1361. ],
  1362. sources: [
  1363. "Source/",
  1364. "Protos/nanopb/",
  1365. "core/include/",
  1366. "core/src",
  1367. ],
  1368. publicHeadersPath: "Source/Public",
  1369. cSettings: [
  1370. .headerSearchPath("../"),
  1371. .headerSearchPath("Source/Public/FirebaseFirestore"),
  1372. .headerSearchPath("Protos/nanopb"),
  1373. .define("PB_FIELD_32BIT", to: "1"),
  1374. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1375. .define("PB_ENABLE_MALLOC", to: "1"),
  1376. .define("FIRFirestore_VERSION", to: firebaseVersion),
  1377. ],
  1378. linkerSettings: [
  1379. .linkedFramework(
  1380. "SystemConfiguration",
  1381. .when(platforms: [.iOS, .macOS, .tvOS, .firebaseVisionOS])
  1382. ),
  1383. .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS, .firebaseVisionOS])),
  1384. .linkedLibrary("c++"),
  1385. ]
  1386. ),
  1387. .target(
  1388. name: "FirebaseFirestore",
  1389. dependencies: [
  1390. "FirebaseCore",
  1391. "FirebaseCoreExtension",
  1392. "FirebaseFirestoreInternalWrapper",
  1393. "FirebaseSharedSwift",
  1394. ],
  1395. path: "Firestore",
  1396. exclude: [
  1397. "CHANGELOG.md",
  1398. "CMakeLists.txt",
  1399. "Example/",
  1400. "LICENSE",
  1401. "Protos/",
  1402. "README.md",
  1403. "Source/",
  1404. "core/",
  1405. "fuzzing/",
  1406. "test.sh",
  1407. "Swift/CHANGELOG.md",
  1408. "Swift/Tests/",
  1409. "third_party/nlohmann_json",
  1410. ],
  1411. sources: [
  1412. "Swift/Source/",
  1413. ]
  1414. ),
  1415. ]
  1416. }
  1417. let firestoreInternalTarget: Target = {
  1418. if ProcessInfo.processInfo.environment["FIREBASECI_USE_LOCAL_FIRESTORE_ZIP"] != nil {
  1419. // This is set when running `scripts/check_firestore_symbols.sh`.
  1420. return .binaryTarget(
  1421. name: "FirebaseFirestoreInternal",
  1422. // The `xcframework` should be moved to the root of the repo.
  1423. path: "FirebaseFirestoreInternal.xcframework"
  1424. )
  1425. } else {
  1426. return .binaryTarget(
  1427. name: "FirebaseFirestoreInternal",
  1428. url: "https://dl.google.com/firebase/ios/bin/firestore/10.19.0/FirebaseFirestoreInternal.zip",
  1429. checksum: "1096ff78a24822bb0218120dfd11859b3b661eb81fc525c9b2cfc044b59804c9"
  1430. )
  1431. }
  1432. }()
  1433. return [
  1434. .target(
  1435. name: "FirebaseFirestore",
  1436. dependencies: [
  1437. .target(
  1438. name: "FirebaseFirestoreInternalWrapper",
  1439. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1440. ),
  1441. .product(name: "abseil", package: "abseil-cpp-binary"),
  1442. .product(name: "gRPC-C++", package: "grpc-binary"),
  1443. .product(name: "nanopb", package: "nanopb"),
  1444. "FirebaseAppCheckInterop",
  1445. "FirebaseCore",
  1446. "FirebaseCoreExtension",
  1447. "leveldb",
  1448. "FirebaseSharedSwift",
  1449. ],
  1450. path: "Firestore/Swift/Source",
  1451. linkerSettings: [
  1452. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  1453. .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS])),
  1454. .linkedLibrary("c++"),
  1455. ]
  1456. ),
  1457. .target(
  1458. name: "FirebaseFirestoreInternalWrapper",
  1459. dependencies: ["FirebaseFirestoreInternal"],
  1460. path: "FirebaseFirestoreInternal",
  1461. publicHeadersPath: "."
  1462. ),
  1463. firestoreInternalTarget,
  1464. ]
  1465. }
  1466. extension Platform {
  1467. // Xcode dependent value for the visionOS platform. Namespaced with
  1468. // "firebase" prefix to prevent any API collisions (such issues should not
  1469. // arise as the manifest APIs should be confined to the `Package.swift`).
  1470. static var firebaseVisionOS: Self {
  1471. #if swift(>=5.9)
  1472. // For Xcode 15, return the available `visionOS` platform.
  1473. return .visionOS
  1474. #else
  1475. // For Xcode 14, return `iOS` as visionOS is unavailable. Since all targets
  1476. // support iOS, this acts as a no-op.
  1477. return .iOS
  1478. #endif // swift(>=5.9)
  1479. }
  1480. }