Package.swift 51 KB

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