Package.swift 49 KB

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