Package.swift 49 KB

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