Package.swift 52 KB

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