Package.swift 52 KB

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