Package.swift 50 KB

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