Package.swift 49 KB

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