Package.swift 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568
  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.28.0/FirebaseAnalytics.zip",
  303. checksum: "50af00e4f2b62e60f8c1686538285aaa10989df35a170c1761f9626edee4a79d"
  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. "FirebaseCoreExtension",
  776. "FirebaseInstallations",
  777. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  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("MobileCoreServices", .when(platforms: [.iOS, .tvOS])),
  876. .linkedFramework("QuartzCore", .when(platforms: [.iOS, .tvOS])),
  877. ]
  878. ),
  879. .testTarget(
  880. name: "PerformanceUnit",
  881. dependencies: [
  882. "FirebasePerformanceTarget",
  883. "SharedTestUtilities",
  884. "GCDWebServer",
  885. .product(name: "OCMock", package: "ocmock"),
  886. ],
  887. path: "FirebasePerformance/Tests/Unit",
  888. resources: [
  889. .process("FPRURLFilterTests-Info.plist"),
  890. .process("Server/smallDownloadFile"),
  891. .process("Server/bigDownloadFile"),
  892. ],
  893. cSettings: [
  894. .headerSearchPath("../../.."),
  895. .define("PB_FIELD_32BIT", to: "1"),
  896. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  897. .define("PB_ENABLE_MALLOC", to: "1"),
  898. ]
  899. ),
  900. .target(
  901. name: "SharedTestUtilities",
  902. dependencies: ["FirebaseCore",
  903. "FirebaseAppCheckInterop",
  904. "FirebaseAuthInterop",
  905. "FirebaseMessagingInterop",
  906. "GoogleDataTransport",
  907. .product(name: "OCMock", package: "ocmock")],
  908. path: "SharedTestUtilities",
  909. publicHeadersPath: "./",
  910. cSettings: [
  911. .headerSearchPath("../"),
  912. ]
  913. ),
  914. // MARK: - Firebase Remote Config
  915. .target(
  916. name: "FirebaseRemoteConfigInternal",
  917. dependencies: [
  918. "FirebaseCore",
  919. "FirebaseABTesting",
  920. "FirebaseInstallations",
  921. "FirebaseRemoteConfigInterop",
  922. .product(name: "GULNSData", package: "GoogleUtilities"),
  923. ],
  924. path: "FirebaseRemoteConfig/Sources",
  925. publicHeadersPath: "Public",
  926. cSettings: [
  927. .headerSearchPath("../../"),
  928. ]
  929. ),
  930. .testTarget(
  931. name: "RemoteConfigUnit",
  932. dependencies: ["FirebaseRemoteConfigInternal", .product(name: "OCMock", package: "ocmock")],
  933. path: "FirebaseRemoteConfig/Tests/Unit",
  934. exclude: [
  935. // Need to be evaluated/ported to RC V2.
  936. "RCNConfigAnalyticsTest.m",
  937. "RCNConfigSettingsTest.m",
  938. "RCNConfigTest.m",
  939. "RCNRemoteConfig+FIRAppTest.m",
  940. "RCNThrottlingTests.m",
  941. ],
  942. resources: [
  943. .process("SecondApp-GoogleService-Info.plist"),
  944. .process("Defaults-testInfo.plist"),
  945. .process("TestABTPayload.txt"),
  946. ],
  947. cSettings: [
  948. .headerSearchPath("../../.."),
  949. ]
  950. ),
  951. .testTarget(
  952. name: "RemoteConfigSwiftUnit",
  953. dependencies: ["FirebaseRemoteConfigInternal"],
  954. path: "FirebaseRemoteConfig/Tests/SwiftUnit",
  955. cSettings: [
  956. .headerSearchPath("../../.."),
  957. ]
  958. ),
  959. .target(
  960. name: "FirebaseRemoteConfig",
  961. dependencies: [
  962. "FirebaseRemoteConfigInternal",
  963. "FirebaseSharedSwift",
  964. ],
  965. path: "FirebaseRemoteConfig/Swift",
  966. resources: [.process("Resources/PrivacyInfo.xcprivacy")]
  967. ),
  968. .testTarget(
  969. name: "RemoteConfigFakeConsole",
  970. dependencies: ["FirebaseRemoteConfig",
  971. "RemoteConfigFakeConsoleObjC"],
  972. path: "FirebaseRemoteConfig/Tests/Swift",
  973. exclude: [
  974. "AccessToken.json",
  975. "README.md",
  976. "ObjC/",
  977. ],
  978. resources: [
  979. .process("Defaults-testInfo.plist"),
  980. ],
  981. cSettings: [
  982. .headerSearchPath("../../../"),
  983. ]
  984. ),
  985. .target(
  986. name: "RemoteConfigFakeConsoleObjC",
  987. dependencies: [.product(name: "OCMock", package: "ocmock")],
  988. path: "FirebaseRemoteConfig/Tests/Swift/ObjC",
  989. publicHeadersPath: ".",
  990. cSettings: [
  991. .headerSearchPath("../../../../"),
  992. ]
  993. ),
  994. // Internal headers only for consuming from other SDK.
  995. .target(
  996. name: "FirebaseRemoteConfigInterop",
  997. path: "FirebaseRemoteConfig/Interop",
  998. publicHeadersPath: ".",
  999. cSettings: [
  1000. .headerSearchPath("../../"),
  1001. ]
  1002. ),
  1003. // MARK: - Firebase Sessions
  1004. .target(
  1005. name: "FirebaseSessions",
  1006. dependencies: [
  1007. "FirebaseCore",
  1008. "FirebaseInstallations",
  1009. "FirebaseCoreExtension",
  1010. "FirebaseSessionsObjC",
  1011. .product(name: "Promises", package: "Promises"),
  1012. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  1013. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1014. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  1015. ],
  1016. path: "FirebaseSessions/Sources",
  1017. cSettings: [
  1018. .headerSearchPath(".."),
  1019. .define("DISPLAY_VERSION", to: firebaseVersion),
  1020. .define("PB_FIELD_32BIT", to: "1"),
  1021. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1022. .define("PB_ENABLE_MALLOC", to: "1"),
  1023. ],
  1024. linkerSettings: [
  1025. .linkedFramework("Security"),
  1026. .linkedFramework(
  1027. "SystemConfiguration",
  1028. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1029. ),
  1030. ]
  1031. ),
  1032. // The Sessions SDK is Swift-first with Objective-C code to support
  1033. // nanopb. Because Swift Package Manager doesn't support mixed
  1034. // language targets, the ObjC code has been extracted out into
  1035. // a separate target.
  1036. .target(
  1037. name: "FirebaseSessionsObjC",
  1038. dependencies: [
  1039. "FirebaseCore",
  1040. "FirebaseCoreExtension",
  1041. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1042. .product(name: "nanopb", package: "nanopb"),
  1043. ],
  1044. path: "FirebaseSessions",
  1045. exclude: [
  1046. "README.md",
  1047. "Sources/",
  1048. "Tests/",
  1049. "ProtoSupport/",
  1050. "generate_project.sh",
  1051. "generate_protos.sh",
  1052. "generate_testapp.sh",
  1053. ],
  1054. publicHeadersPath: "SourcesObjC",
  1055. cSettings: [
  1056. .headerSearchPath(".."),
  1057. .define("DISPLAY_VERSION", to: firebaseVersion),
  1058. .define("PB_FIELD_32BIT", to: "1"),
  1059. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1060. .define("PB_ENABLE_MALLOC", to: "1"),
  1061. ],
  1062. linkerSettings: [
  1063. .linkedFramework("Security"),
  1064. .linkedFramework(
  1065. "SystemConfiguration",
  1066. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1067. ),
  1068. ]
  1069. ),
  1070. .testTarget(
  1071. name: "FirebaseSessionsUnit",
  1072. dependencies: ["FirebaseSessions"],
  1073. path: "FirebaseSessions/Tests/Unit"
  1074. ),
  1075. // MARK: - Firebase Storage
  1076. .target(
  1077. name: "FirebaseStorage",
  1078. dependencies: [
  1079. "FirebaseAppCheckInterop",
  1080. "FirebaseAuthInterop",
  1081. "FirebaseCore",
  1082. "FirebaseCoreExtension",
  1083. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  1084. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1085. ],
  1086. path: "FirebaseStorage/Sources"
  1087. ),
  1088. .testTarget(
  1089. name: "FirebaseStorageUnit",
  1090. dependencies: ["FirebaseStorage",
  1091. "SharedTestUtilities"],
  1092. path: "FirebaseStorage/Tests/Unit",
  1093. cSettings: [
  1094. .headerSearchPath("../../../"),
  1095. ]
  1096. ),
  1097. .testTarget(
  1098. name: "StorageObjCIntegration",
  1099. dependencies: ["FirebaseStorage"],
  1100. path: "FirebaseStorage/Tests/ObjCIntegration",
  1101. exclude: [
  1102. // See https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730
  1103. "FIRStorageIntegrationTests.m",
  1104. "ObjCPPAPITests.mm",
  1105. "Credentials.h",
  1106. ],
  1107. cSettings: [
  1108. .headerSearchPath("../../.."),
  1109. ]
  1110. ),
  1111. .testTarget(
  1112. name: "swift-test",
  1113. dependencies: [
  1114. "Firebase",
  1115. "FirebaseAuth",
  1116. "FirebaseAppCheck",
  1117. "FirebaseABTesting",
  1118. "FirebaseAnalytics",
  1119. .target(name: "FirebaseAppDistribution",
  1120. condition: .when(platforms: [.iOS])),
  1121. "FirebaseAuthCombineSwift",
  1122. "FirebaseFirestoreCombineSwift",
  1123. "FirebaseFunctionsCombineSwift",
  1124. "FirebaseStorageCombineSwift",
  1125. "FirebaseCrashlytics",
  1126. "FirebaseCore",
  1127. "FirebaseDatabase",
  1128. "FirebaseDynamicLinks",
  1129. "FirebaseFirestoreTarget",
  1130. "FirebaseFunctions",
  1131. .target(name: "FirebaseInAppMessaging",
  1132. condition: .when(platforms: [.iOS, .tvOS])),
  1133. "FirebaseInstallations",
  1134. "FirebaseMessaging",
  1135. .target(name: "FirebasePerformance",
  1136. condition: .when(platforms: [.iOS, .tvOS])),
  1137. "FirebaseRemoteConfig",
  1138. "FirebaseSessions",
  1139. "FirebaseStorage",
  1140. .product(name: "nanopb", package: "nanopb"),
  1141. ],
  1142. path: "SwiftPMTests/swift-test"
  1143. ),
  1144. .testTarget(
  1145. name: "analytics-import-test",
  1146. dependencies: [
  1147. "FirebaseAnalyticsWrapper",
  1148. "Firebase",
  1149. ],
  1150. path: "SwiftPMTests/analytics-import-test"
  1151. ),
  1152. .testTarget(
  1153. name: "objc-import-test",
  1154. dependencies: [
  1155. "Firebase",
  1156. "FirebaseAuth",
  1157. "FirebaseABTesting",
  1158. "FirebaseAppCheck",
  1159. .target(name: "FirebaseAppDistribution",
  1160. condition: .when(platforms: [.iOS])),
  1161. "FirebaseCrashlytics",
  1162. "FirebaseCore",
  1163. "FirebaseDatabase",
  1164. "FirebaseDynamicLinks",
  1165. "FirebaseFirestoreTarget",
  1166. "FirebaseFunctions",
  1167. .target(name: "FirebaseInAppMessaging",
  1168. condition: .when(platforms: [.iOS, .tvOS])),
  1169. "FirebaseInstallations",
  1170. "FirebaseMessaging",
  1171. .target(name: "FirebasePerformance",
  1172. condition: .when(platforms: [.iOS, .tvOS])),
  1173. "FirebaseRemoteConfig",
  1174. "FirebaseStorage",
  1175. ],
  1176. path: "SwiftPMTests/objc-import-test"
  1177. ),
  1178. .testTarget(
  1179. name: "version-test",
  1180. dependencies: [
  1181. "FirebaseCore",
  1182. ],
  1183. path: "SwiftPMTests/version-test",
  1184. cSettings: [
  1185. .define("FIR_VERSION", to: firebaseVersion),
  1186. ]
  1187. ),
  1188. // MARK: - Firebase App Check
  1189. .target(name: "FirebaseAppCheck",
  1190. dependencies: [
  1191. "FirebaseAppCheckInterop",
  1192. "FirebaseCore",
  1193. .product(name: "AppCheckCore", package: "app-check"),
  1194. .product(name: "FBLPromises", package: "Promises"),
  1195. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1196. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  1197. ],
  1198. path: "FirebaseAppCheck/Sources",
  1199. publicHeadersPath: "Public",
  1200. cSettings: [
  1201. .headerSearchPath("../.."),
  1202. ],
  1203. linkerSettings: [
  1204. .linkedFramework(
  1205. "DeviceCheck",
  1206. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1207. ),
  1208. ]),
  1209. // Internal headers only for consuming from Swift.
  1210. .target(
  1211. name: "FirebaseAppCheckInterop",
  1212. path: "FirebaseAppCheck/Interop",
  1213. exclude: [
  1214. "CMakeLists.txt",
  1215. ],
  1216. publicHeadersPath: "Public",
  1217. cSettings: [
  1218. .headerSearchPath("../../"),
  1219. ]
  1220. ),
  1221. .testTarget(
  1222. name: "FirebaseAppCheckUnit",
  1223. dependencies: [
  1224. "FirebaseAppCheck",
  1225. "SharedTestUtilities",
  1226. .product(name: "OCMock", package: "ocmock"),
  1227. ],
  1228. path: "FirebaseAppCheck/Tests/Unit",
  1229. exclude: [
  1230. // Swift tests are in the target `FirebaseAppCheckUnitSwift` since mixed language targets
  1231. // are not supported (as of Xcode 15.0).
  1232. "Swift",
  1233. ],
  1234. cSettings: [
  1235. .headerSearchPath("../../.."),
  1236. ]
  1237. ),
  1238. .testTarget(
  1239. name: "FirebaseAppCheckUnitSwift",
  1240. dependencies: ["FirebaseAppCheck"],
  1241. path: "FirebaseAppCheck/Tests/Unit/Swift"
  1242. ),
  1243. // MARK: Testing support
  1244. .target(
  1245. name: "FirebaseFirestoreTestingSupport",
  1246. dependencies: ["FirebaseFirestoreTarget"],
  1247. path: "FirebaseTestingSupport/Firestore/Sources",
  1248. publicHeadersPath: "./",
  1249. cSettings: [
  1250. .headerSearchPath("../../.."),
  1251. .headerSearchPath("../../../Firestore/Source/Public/FirebaseFirestore"),
  1252. ]
  1253. ),
  1254. .testTarget(
  1255. name: "FirestoreTestingSupportTests",
  1256. dependencies: ["FirebaseFirestoreTestingSupport"],
  1257. path: "FirebaseTestingSupport/Firestore/Tests",
  1258. cSettings: [
  1259. .headerSearchPath("../../.."),
  1260. ]
  1261. ),
  1262. // MARK: - Firebase Vertex AI
  1263. .target(
  1264. name: "FirebaseVertexAI",
  1265. dependencies: [
  1266. "FirebaseAppCheckInterop",
  1267. "FirebaseAuthInterop",
  1268. "FirebaseCore",
  1269. "FirebaseCoreExtension",
  1270. ],
  1271. path: "FirebaseVertexAI/Sources"
  1272. ),
  1273. .testTarget(
  1274. name: "FirebaseVertexAIUnit",
  1275. dependencies: ["FirebaseVertexAI", "SharedTestUtilities"],
  1276. path: "FirebaseVertexAI/Tests/Unit",
  1277. resources: [
  1278. .process("Responses"),
  1279. ],
  1280. cSettings: [
  1281. .headerSearchPath("../../../"),
  1282. ]
  1283. ),
  1284. .testTarget(
  1285. name: "FirebaseVertexAIIntegration",
  1286. dependencies: ["FirebaseVertexAI"],
  1287. path: "FirebaseVertexAI/Tests/Integration",
  1288. resources: [
  1289. .process("Resources"),
  1290. ]
  1291. ),
  1292. ] + firestoreTargets(),
  1293. cLanguageStandard: .c99,
  1294. cxxLanguageStandard: CXXLanguageStandard.gnucxx14
  1295. )
  1296. // MARK: - Helper Functions
  1297. func googleAppMeasurementDependency() -> Package.Dependency {
  1298. let appMeasurementURL = "https://github.com/google/GoogleAppMeasurement.git"
  1299. // Point SPM CI to the tip of main of https://github.com/google/GoogleAppMeasurement so that the
  1300. // release process can defer publishing the GoogleAppMeasurement tag until after testing.
  1301. if ProcessInfo.processInfo.environment["FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT"] != nil {
  1302. return .package(url: appMeasurementURL, branch: "main")
  1303. }
  1304. return .package(url: appMeasurementURL, exact: "10.28.0")
  1305. }
  1306. func abseilDependency() -> Package.Dependency {
  1307. let packageInfo: (url: String, range: Range<Version>)
  1308. // If building Firestore from source, abseil will need to be built as source
  1309. // as the headers in the binary version of abseil are unusable.
  1310. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1311. packageInfo = (
  1312. "https://github.com/firebase/abseil-cpp-SwiftPM.git",
  1313. "0.20240116.1" ..< "0.20240117.0"
  1314. )
  1315. } else {
  1316. packageInfo = (
  1317. "https://github.com/google/abseil-cpp-binary.git",
  1318. "1.2024011601.1" ..< "1.2024011700.0"
  1319. )
  1320. }
  1321. return .package(url: packageInfo.url, packageInfo.range)
  1322. }
  1323. func grpcDependency() -> Package.Dependency {
  1324. let packageInfo: (url: String, range: Range<Version>)
  1325. // If building Firestore from source, abseil will need to be built as source
  1326. // as the headers in the binary version of abseil are unusable.
  1327. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1328. packageInfo = ("https://github.com/grpc/grpc-ios.git", "1.62.3" ..< "1.63.0")
  1329. } else {
  1330. packageInfo = ("https://github.com/google/grpc-binary.git", "1.62.2" ..< "1.63.0")
  1331. }
  1332. return .package(url: packageInfo.url, packageInfo.range)
  1333. }
  1334. func firestoreWrapperTarget() -> Target {
  1335. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1336. return .target(
  1337. name: "FirebaseFirestoreTarget",
  1338. dependencies: [.target(name: "FirebaseFirestore",
  1339. condition: .when(platforms: [.iOS, .tvOS, .macOS, .visionOS]))],
  1340. path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap"
  1341. )
  1342. }
  1343. return .target(
  1344. name: "FirebaseFirestoreTarget",
  1345. dependencies: [.target(name: "FirebaseFirestore",
  1346. condition: .when(platforms: [.iOS, .tvOS, .macOS, .macCatalyst]))],
  1347. path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap",
  1348. cSettings: [.define("FIREBASE_BINARY_FIRESTORE", to: "1")]
  1349. )
  1350. }
  1351. func firestoreTargets() -> [Target] {
  1352. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1353. return [
  1354. .target(
  1355. name: "FirebaseFirestoreInternalWrapper",
  1356. dependencies: [
  1357. "FirebaseAppCheckInterop",
  1358. "FirebaseCore",
  1359. "leveldb",
  1360. .product(name: "nanopb", package: "nanopb"),
  1361. .product(name: "abseil", package: "abseil-cpp-SwiftPM"),
  1362. .product(name: "gRPC-cpp", package: "grpc-ios"),
  1363. ],
  1364. path: "Firestore",
  1365. exclude: [
  1366. "CHANGELOG.md",
  1367. "CMakeLists.txt",
  1368. "Example/",
  1369. "LICENSE",
  1370. "Protos/CMakeLists.txt",
  1371. "Protos/Podfile",
  1372. "Protos/README.md",
  1373. "Protos/build_protos.py",
  1374. "Protos/cpp/",
  1375. "Protos/lib/",
  1376. "Protos/nanopb_cpp_generator.py",
  1377. "Protos/protos/",
  1378. "README.md",
  1379. "Source/CMakeLists.txt",
  1380. "Swift/",
  1381. "core/CMakeLists.txt",
  1382. "core/src/util/config_detected.h.in",
  1383. "core/test/",
  1384. "fuzzing/",
  1385. "test.sh",
  1386. // Swift PM doesn't recognize hpp files, so we're relying on search paths
  1387. // to find third_party/nlohmann_json/json.hpp.
  1388. "third_party/",
  1389. // Exclude alternate implementations for other platforms
  1390. "core/src/remote/connectivity_monitor_noop.cc",
  1391. "core/src/util/filesystem_win.cc",
  1392. "core/src/util/log_stdio.cc",
  1393. "core/src/util/secure_random_openssl.cc",
  1394. ],
  1395. sources: [
  1396. "Source/",
  1397. "Protos/nanopb/",
  1398. "core/include/",
  1399. "core/src",
  1400. ],
  1401. publicHeadersPath: "Source/Public",
  1402. cSettings: [
  1403. .headerSearchPath("../"),
  1404. .headerSearchPath("Source/Public/FirebaseFirestore"),
  1405. .headerSearchPath("Protos/nanopb"),
  1406. .define("PB_FIELD_32BIT", to: "1"),
  1407. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1408. .define("PB_ENABLE_MALLOC", to: "1"),
  1409. .define("FIRFirestore_VERSION", to: firebaseVersion),
  1410. ],
  1411. linkerSettings: [
  1412. .linkedFramework(
  1413. "SystemConfiguration",
  1414. .when(platforms: [.iOS, .macOS, .tvOS, .visionOS])
  1415. ),
  1416. .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS, .visionOS])),
  1417. .linkedLibrary("c++"),
  1418. ]
  1419. ),
  1420. .target(
  1421. name: "FirebaseFirestore",
  1422. dependencies: [
  1423. "FirebaseCore",
  1424. "FirebaseCoreExtension",
  1425. "FirebaseFirestoreInternalWrapper",
  1426. "FirebaseSharedSwift",
  1427. ],
  1428. path: "Firestore",
  1429. exclude: [
  1430. "CHANGELOG.md",
  1431. "CMakeLists.txt",
  1432. "Example/",
  1433. "LICENSE",
  1434. "Protos/",
  1435. "README.md",
  1436. "Source/",
  1437. "core/",
  1438. "fuzzing/",
  1439. "test.sh",
  1440. "Swift/CHANGELOG.md",
  1441. "Swift/Tests/",
  1442. "third_party/nlohmann_json",
  1443. ],
  1444. sources: [
  1445. "Swift/Source/",
  1446. ],
  1447. resources: [.process("Source/Resources/PrivacyInfo.xcprivacy")]
  1448. ),
  1449. ]
  1450. }
  1451. let firestoreInternalTarget: Target = {
  1452. if ProcessInfo.processInfo.environment["FIREBASECI_USE_LOCAL_FIRESTORE_ZIP"] != nil {
  1453. // This is set when running `scripts/check_firestore_symbols.sh`.
  1454. return .binaryTarget(
  1455. name: "FirebaseFirestoreInternal",
  1456. // The `xcframework` should be moved to the root of the repo.
  1457. path: "FirebaseFirestoreInternal.xcframework"
  1458. )
  1459. } else {
  1460. return .binaryTarget(
  1461. name: "FirebaseFirestoreInternal",
  1462. url: "https://dl.google.com/firebase/ios/bin/firestore/10.27.0/rc0/FirebaseFirestoreInternal.zip",
  1463. checksum: "38f6d1bb13fabca97f53c0ef5bf283b2fbbbf460eac8fa875cd3faab597097b8"
  1464. )
  1465. }
  1466. }()
  1467. return [
  1468. .target(
  1469. name: "FirebaseFirestore",
  1470. dependencies: [
  1471. .target(
  1472. name: "FirebaseFirestoreInternalWrapper",
  1473. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1474. ),
  1475. .product(
  1476. name: "abseil",
  1477. package: "abseil-cpp-binary",
  1478. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1479. ),
  1480. .product(
  1481. name: "gRPC-C++",
  1482. package: "grpc-binary",
  1483. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1484. ),
  1485. .product(name: "nanopb", package: "nanopb"),
  1486. "FirebaseAppCheckInterop",
  1487. "FirebaseCore",
  1488. "FirebaseCoreExtension",
  1489. "leveldb",
  1490. "FirebaseSharedSwift",
  1491. ],
  1492. path: "Firestore/Swift/Source",
  1493. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  1494. linkerSettings: [
  1495. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  1496. .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS])),
  1497. .linkedLibrary("c++"),
  1498. ]
  1499. ),
  1500. .target(
  1501. name: "FirebaseFirestoreInternalWrapper",
  1502. dependencies: [.target(
  1503. name: "FirebaseFirestoreInternal",
  1504. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1505. )],
  1506. path: "FirebaseFirestoreInternal",
  1507. publicHeadersPath: "."
  1508. ),
  1509. firestoreInternalTarget,
  1510. ]
  1511. }