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.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. "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.0.0/rc2/FirebaseAnalytics.zip",
  297. checksum: "3dffe84e22f11691c147c5f83ba83b66172bb5c11fe09a077f2dd5f8bbd8e2bc"
  298. ),
  299. .testTarget(
  300. name: "AnalyticsSwiftUnit",
  301. dependencies: ["FirebaseAnalytics"],
  302. path: "FirebaseAnalytics/Tests/SwiftUnit"
  303. ),
  304. .testTarget(
  305. name: "AnalyticsObjCAPI",
  306. dependencies: ["FirebaseAnalytics"],
  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. "ObjCAPITests.m", // Only builds via CocoaPods until mixed language or its own target.
  450. "ObjCGlobalTests.m", // Only builds via CocoaPods until mixed language or its own target.
  451. ]
  452. ),
  453. .target(
  454. name: "FirebaseAuthCombineSwift",
  455. dependencies: ["FirebaseAuth"],
  456. path: "FirebaseCombineSwift/Sources/Auth"
  457. ),
  458. .target(
  459. name: "FirebaseFirestoreCombineSwift",
  460. dependencies: [
  461. "FirebaseFirestoreTarget",
  462. ],
  463. path: "FirebaseCombineSwift/Sources/Firestore"
  464. ),
  465. .target(
  466. name: "FirebaseStorageCombineSwift",
  467. dependencies: [
  468. "FirebaseStorage",
  469. ],
  470. path: "FirebaseCombineSwift/Sources/Storage"
  471. ),
  472. .target(
  473. name: "FirebaseCrashlytics",
  474. dependencies: [
  475. "FirebaseCore",
  476. "FirebaseInstallations",
  477. "FirebaseSessions",
  478. "FirebaseRemoteConfigInterop",
  479. "FirebaseCrashlyticsSwift",
  480. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  481. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  482. .product(name: "FBLPromises", package: "Promises"),
  483. .product(name: "nanopb", package: "nanopb"),
  484. ],
  485. path: "Crashlytics",
  486. exclude: [
  487. "run",
  488. "CHANGELOG.md",
  489. "LICENSE",
  490. "README.md",
  491. "ProtoSupport/",
  492. "UnitTests/",
  493. "generate_project.sh",
  494. "upload-symbols",
  495. "CrashlyticsInputFiles.xcfilelist",
  496. "third_party/libunwind/LICENSE",
  497. "Crashlytics/Rollouts/",
  498. ],
  499. sources: [
  500. "Crashlytics/",
  501. "Protogen/",
  502. "Shared/",
  503. "third_party/libunwind/dwarf.h",
  504. ],
  505. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  506. publicHeadersPath: "Crashlytics/Public",
  507. cSettings: [
  508. .headerSearchPath(".."),
  509. .define("DISPLAY_VERSION", to: firebaseVersion),
  510. .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])),
  511. .define(
  512. "CLS_SDK_NAME",
  513. to: "Crashlytics macOS SDK",
  514. .when(platforms: [.macOS, .macCatalyst])
  515. ),
  516. .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])),
  517. .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])),
  518. .define("PB_FIELD_32BIT", to: "1"),
  519. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  520. .define("PB_ENABLE_MALLOC", to: "1"),
  521. ],
  522. linkerSettings: [
  523. .linkedFramework("Security"),
  524. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  525. ]
  526. ),
  527. .target(
  528. name: "FirebaseCrashlyticsSwift",
  529. dependencies: ["FirebaseRemoteConfigInterop"],
  530. path: "Crashlytics",
  531. sources: [
  532. "Crashlytics/Rollouts/",
  533. ]
  534. ),
  535. .testTarget(
  536. name: "FirebaseCrashlyticsSwiftUnit",
  537. dependencies: ["FirebaseCrashlyticsSwift"],
  538. path: "Crashlytics/UnitTestsSwift/"
  539. ),
  540. .testTarget(
  541. name: "FirebaseCrashlyticsUnit",
  542. dependencies: ["FirebaseCrashlytics", .product(name: "OCMock", package: "ocmock")],
  543. path: "Crashlytics/UnitTests",
  544. resources: [
  545. .copy("FIRCLSMachO/machO_data"),
  546. .copy("Data"),
  547. ],
  548. cSettings: [
  549. .headerSearchPath("../.."),
  550. .define("DISPLAY_VERSION", to: firebaseVersion),
  551. .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])),
  552. .define(
  553. "CLS_SDK_NAME",
  554. to: "Crashlytics macOS SDK",
  555. .when(platforms: [.macOS, .macCatalyst])
  556. ),
  557. .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])),
  558. .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])),
  559. ]
  560. ),
  561. .target(
  562. name: "FirebaseDatabaseInternal",
  563. dependencies: [
  564. "FirebaseAppCheckInterop",
  565. "FirebaseCore",
  566. "leveldb",
  567. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  568. ],
  569. path: "FirebaseDatabase/Sources",
  570. exclude: [
  571. "third_party/Wrap-leveldb/LICENSE",
  572. "third_party/FImmutableSortedDictionary/LICENSE",
  573. ],
  574. publicHeadersPath: "Public",
  575. cSettings: [
  576. .headerSearchPath("../../"),
  577. ],
  578. linkerSettings: [
  579. .linkedFramework("CFNetwork"),
  580. .linkedFramework("Security"),
  581. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  582. .linkedFramework("WatchKit", .when(platforms: [.watchOS])),
  583. ]
  584. ),
  585. .testTarget(
  586. name: "DatabaseUnit",
  587. dependencies: [
  588. "FirebaseDatabase",
  589. "SharedTestUtilities",
  590. .product(name: "OCMock", package: "ocmock"),
  591. ],
  592. path: "FirebaseDatabase/Tests/",
  593. exclude: [
  594. // Disable Swift tests as mixed targets are not supported (Xcode 12.4).
  595. "Unit/Swift",
  596. "Integration/",
  597. ],
  598. resources: [.process("Resources")],
  599. cSettings: [
  600. .headerSearchPath("../.."),
  601. ]
  602. ),
  603. .testTarget(
  604. name: "DatabaseUnitSwift",
  605. dependencies: ["FirebaseDatabase"],
  606. path: "FirebaseDatabase/Tests/Unit/Swift",
  607. cSettings: [
  608. .headerSearchPath("../.."),
  609. ]
  610. ),
  611. .target(
  612. name: "FirebaseDatabase",
  613. dependencies: ["FirebaseDatabaseInternal", "FirebaseSharedSwift"],
  614. path: "FirebaseDatabase/Swift/Sources"
  615. ),
  616. .target(
  617. name: "FirebaseSharedSwift",
  618. path: "FirebaseSharedSwift/Sources",
  619. exclude: [
  620. "third_party/FirebaseDataEncoder/LICENSE",
  621. "third_party/FirebaseDataEncoder/METADATA",
  622. ]
  623. ),
  624. .testTarget(
  625. name: "FirebaseSharedSwiftTests",
  626. dependencies: ["FirebaseSharedSwift"],
  627. path: "FirebaseSharedSwift/Tests/"
  628. ),
  629. .target(
  630. name: "FirebaseDynamicLinksTarget",
  631. dependencies: [.target(name: "FirebaseDynamicLinks",
  632. condition: .when(platforms: [.iOS]))],
  633. path: "SwiftPM-PlatformExclude/FirebaseDynamicLinksWrap"
  634. ),
  635. .target(
  636. name: "FirebaseDynamicLinks",
  637. dependencies: ["FirebaseCore"],
  638. path: "FirebaseDynamicLinks/Sources",
  639. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  640. publicHeadersPath: "Public",
  641. cSettings: [
  642. .headerSearchPath("../../"),
  643. .define("FIRDynamicLinks3P", to: "1"),
  644. .define("GIN_SCION_LOGGING", to: "1"),
  645. ],
  646. linkerSettings: [
  647. .linkedFramework("QuartzCore"),
  648. ]
  649. ),
  650. firestoreWrapperTarget(),
  651. // MARK: - Firebase Functions
  652. .target(
  653. name: "FirebaseFunctions",
  654. dependencies: [
  655. "FirebaseAppCheckInterop",
  656. "FirebaseAuthInterop",
  657. "FirebaseCore",
  658. "FirebaseCoreExtension",
  659. "FirebaseMessagingInterop",
  660. "FirebaseSharedSwift",
  661. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  662. ],
  663. path: "FirebaseFunctions/Sources"
  664. ),
  665. .testTarget(
  666. name: "FirebaseFunctionsUnit",
  667. dependencies: ["FirebaseFunctions",
  668. "FirebaseAppCheckInterop",
  669. "FirebaseAuthInterop",
  670. "FirebaseMessagingInterop",
  671. "SharedTestUtilities"],
  672. path: "FirebaseFunctions/Tests/Unit",
  673. cSettings: [
  674. .headerSearchPath("../../../"),
  675. ]
  676. ),
  677. .testTarget(
  678. name: "FirebaseFunctionsIntegration",
  679. dependencies: ["FirebaseFunctions",
  680. "SharedTestUtilities"],
  681. path: "FirebaseFunctions/Tests/Integration"
  682. ),
  683. .testTarget(
  684. name: "FirebaseFunctionsObjCIntegration",
  685. dependencies: ["FirebaseFunctions",
  686. "SharedTestUtilities"],
  687. path: "FirebaseFunctions/Tests/ObjCIntegration",
  688. // See https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730
  689. exclude: [
  690. "ObjCPPAPITests.mm",
  691. ],
  692. cSettings: [
  693. .headerSearchPath("../../.."),
  694. ]
  695. ),
  696. .target(
  697. name: "FirebaseFunctionsCombineSwift",
  698. dependencies: ["FirebaseFunctions"],
  699. path: "FirebaseCombineSwift/Sources/Functions"
  700. ),
  701. .testTarget(
  702. name: "FunctionsCombineUnit",
  703. dependencies: ["FirebaseFunctionsCombineSwift",
  704. "SharedTestUtilities"],
  705. path: "FirebaseFunctions/Tests/CombineUnit"
  706. ),
  707. // MARK: - Firebase In App Messaging
  708. .target(
  709. name: "FirebaseInAppMessagingTarget",
  710. dependencies: [
  711. .target(name: "FirebaseInAppMessaging", condition: .when(platforms: [.iOS, .tvOS])),
  712. ],
  713. path: "SwiftPM-PlatformExclude/FirebaseInAppMessagingWrap"
  714. ),
  715. .target(
  716. name: "FirebaseInAppMessagingInternal",
  717. dependencies: [
  718. "FirebaseCore",
  719. "FirebaseInstallations",
  720. "FirebaseABTesting",
  721. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  722. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  723. .product(name: "nanopb", package: "nanopb"),
  724. .target(name: "FirebaseInAppMessaging_iOS", condition: .when(platforms: [.iOS])),
  725. ],
  726. path: "FirebaseInAppMessaging/Sources",
  727. exclude: [
  728. "DefaultUI/CHANGELOG.md",
  729. "DefaultUI/README.md",
  730. ],
  731. publicHeadersPath: "Public",
  732. cSettings: [
  733. .headerSearchPath("../../"),
  734. .define("PB_FIELD_32BIT", to: "1"),
  735. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  736. .define("PB_ENABLE_MALLOC", to: "1"),
  737. ]
  738. ),
  739. .target(
  740. name: "FirebaseInAppMessaging_iOS",
  741. path: "FirebaseInAppMessaging/iOS",
  742. resources: [.process("Resources")]
  743. ),
  744. .target(
  745. name: "FirebaseInAppMessaging",
  746. dependencies: ["FirebaseInAppMessagingInternal"],
  747. path: "FirebaseInAppMessaging/Swift/Source"
  748. ),
  749. .target(
  750. name: "FirebaseInstallations",
  751. dependencies: [
  752. "FirebaseCore",
  753. .product(name: "FBLPromises", package: "Promises"),
  754. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  755. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  756. ],
  757. path: "FirebaseInstallations/Source/Library",
  758. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  759. publicHeadersPath: "Public",
  760. cSettings: [
  761. .headerSearchPath("../../../"),
  762. ],
  763. linkerSettings: [
  764. .linkedFramework("Security"),
  765. ]
  766. ),
  767. .target(
  768. name: "FirebaseMLModelDownloader",
  769. dependencies: [
  770. "FirebaseCore",
  771. "FirebaseCoreExtension",
  772. "FirebaseInstallations",
  773. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  774. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  775. .product(name: "SwiftProtobuf", package: "swift-protobuf"),
  776. ],
  777. path: "FirebaseMLModelDownloader/Sources",
  778. exclude: [
  779. "proto/firebase_ml_log_sdk.proto",
  780. ],
  781. cSettings: [
  782. .define("FIRMLModelDownloader_VERSION", to: firebaseVersion),
  783. ]
  784. ),
  785. .testTarget(
  786. name: "FirebaseMLModelDownloaderUnit",
  787. dependencies: ["FirebaseMLModelDownloader"],
  788. path: "FirebaseMLModelDownloader/Tests/Unit"
  789. ),
  790. .target(
  791. name: "FirebaseMessaging",
  792. dependencies: [
  793. "FirebaseCore",
  794. "FirebaseInstallations",
  795. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  796. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  797. .product(name: "GULReachability", package: "GoogleUtilities"),
  798. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  799. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  800. .product(name: "nanopb", package: "nanopb"),
  801. ],
  802. path: "FirebaseMessaging/Sources",
  803. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  804. publicHeadersPath: "Public",
  805. cSettings: [
  806. .headerSearchPath("../../"),
  807. .define("PB_FIELD_32BIT", to: "1"),
  808. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  809. .define("PB_ENABLE_MALLOC", to: "1"),
  810. ],
  811. linkerSettings: [
  812. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  813. ]
  814. ),
  815. // Internal headers only for consuming from Swift.
  816. .target(
  817. name: "FirebaseMessagingInterop",
  818. path: "FirebaseMessaging/Interop",
  819. publicHeadersPath: ".",
  820. cSettings: [
  821. .headerSearchPath("../../"),
  822. ]
  823. ),
  824. .testTarget(
  825. name: "MessagingUnit",
  826. dependencies: [
  827. "FirebaseMessaging",
  828. "SharedTestUtilities",
  829. .product(name: "OCMock", package: "ocmock"),
  830. ],
  831. path: "FirebaseMessaging/Tests/UnitTests",
  832. exclude: [
  833. "FIRMessagingContextManagerServiceTest.m", // TODO: Adapt its NSBundle usage to SPM.
  834. ],
  835. cSettings: [
  836. .headerSearchPath("../../.."),
  837. ]
  838. ),
  839. .target(
  840. name: "FirebasePerformanceTarget",
  841. dependencies: [.target(name: "FirebasePerformance",
  842. condition: .when(platforms: [.iOS, .tvOS, .visionOS]))],
  843. path: "SwiftPM-PlatformExclude/FirebasePerformanceWrap"
  844. ),
  845. .target(
  846. name: "FirebasePerformance",
  847. dependencies: [
  848. "FirebaseCore",
  849. "FirebaseInstallations",
  850. // Performance depends on the Obj-C target of FirebaseRemoteConfig to
  851. // avoid including Swift code from the `FirebaseRemoteConfig` target
  852. // that is unneeded.
  853. "FirebaseRemoteConfigInternal",
  854. "FirebaseSessions",
  855. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  856. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  857. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  858. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  859. .product(name: "nanopb", package: "nanopb"),
  860. ],
  861. path: "FirebasePerformance/Sources",
  862. publicHeadersPath: "Public",
  863. cSettings: [
  864. .headerSearchPath("../../"),
  865. .define("PB_FIELD_32BIT", to: "1"),
  866. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  867. .define("PB_ENABLE_MALLOC", to: "1"),
  868. .define("FIRPerformance_LIB_VERSION", to: firebaseVersion),
  869. ],
  870. linkerSettings: [
  871. .linkedFramework("MobileCoreServices", .when(platforms: [.iOS, .tvOS])),
  872. .linkedFramework("QuartzCore", .when(platforms: [.iOS, .tvOS])),
  873. ]
  874. ),
  875. .testTarget(
  876. name: "PerformanceUnit",
  877. dependencies: [
  878. "FirebasePerformanceTarget",
  879. "SharedTestUtilities",
  880. "GCDWebServer",
  881. .product(name: "OCMock", package: "ocmock"),
  882. ],
  883. path: "FirebasePerformance/Tests/Unit",
  884. resources: [
  885. .process("FPRURLFilterTests-Info.plist"),
  886. .process("Server/smallDownloadFile"),
  887. .process("Server/bigDownloadFile"),
  888. ],
  889. cSettings: [
  890. .headerSearchPath("../../.."),
  891. .define("PB_FIELD_32BIT", to: "1"),
  892. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  893. .define("PB_ENABLE_MALLOC", to: "1"),
  894. ]
  895. ),
  896. .target(
  897. name: "SharedTestUtilities",
  898. dependencies: ["FirebaseCore",
  899. "FirebaseAppCheckInterop",
  900. "FirebaseAuthInterop",
  901. "FirebaseMessagingInterop",
  902. "GoogleDataTransport",
  903. .product(name: "OCMock", package: "ocmock")],
  904. path: "SharedTestUtilities",
  905. publicHeadersPath: "./",
  906. cSettings: [
  907. .headerSearchPath("../"),
  908. ]
  909. ),
  910. // MARK: - Firebase Remote Config
  911. .target(
  912. name: "FirebaseRemoteConfigInternal",
  913. dependencies: [
  914. "FirebaseCore",
  915. "FirebaseABTesting",
  916. "FirebaseInstallations",
  917. "FirebaseRemoteConfigInterop",
  918. .product(name: "GULNSData", package: "GoogleUtilities"),
  919. ],
  920. path: "FirebaseRemoteConfig/Sources",
  921. publicHeadersPath: "Public",
  922. cSettings: [
  923. .headerSearchPath("../../"),
  924. ]
  925. ),
  926. .testTarget(
  927. name: "RemoteConfigUnit",
  928. dependencies: ["FirebaseRemoteConfigInternal", .product(name: "OCMock", package: "ocmock")],
  929. path: "FirebaseRemoteConfig/Tests/Unit",
  930. exclude: [
  931. // Need to be evaluated/ported to RC V2.
  932. "RCNConfigAnalyticsTest.m",
  933. "RCNConfigSettingsTest.m",
  934. "RCNConfigTest.m",
  935. "RCNRemoteConfig+FIRAppTest.m",
  936. "RCNThrottlingTests.m",
  937. ],
  938. resources: [
  939. .process("SecondApp-GoogleService-Info.plist"),
  940. .process("Defaults-testInfo.plist"),
  941. .process("TestABTPayload.txt"),
  942. ],
  943. cSettings: [
  944. .headerSearchPath("../../.."),
  945. ]
  946. ),
  947. .testTarget(
  948. name: "RemoteConfigSwiftUnit",
  949. dependencies: ["FirebaseRemoteConfigInternal"],
  950. path: "FirebaseRemoteConfig/Tests/SwiftUnit",
  951. cSettings: [
  952. .headerSearchPath("../../.."),
  953. ]
  954. ),
  955. .target(
  956. name: "FirebaseRemoteConfig",
  957. dependencies: [
  958. "FirebaseRemoteConfigInternal",
  959. "FirebaseSharedSwift",
  960. ],
  961. path: "FirebaseRemoteConfig/Swift",
  962. resources: [.process("Resources/PrivacyInfo.xcprivacy")]
  963. ),
  964. .testTarget(
  965. name: "RemoteConfigFakeConsole",
  966. dependencies: ["FirebaseRemoteConfig",
  967. "RemoteConfigFakeConsoleObjC"],
  968. path: "FirebaseRemoteConfig/Tests/Swift",
  969. exclude: [
  970. "AccessToken.json",
  971. "README.md",
  972. "ObjC/",
  973. ],
  974. resources: [
  975. .process("Defaults-testInfo.plist"),
  976. ],
  977. cSettings: [
  978. .headerSearchPath("../../../"),
  979. ]
  980. ),
  981. .target(
  982. name: "RemoteConfigFakeConsoleObjC",
  983. dependencies: [.product(name: "OCMock", package: "ocmock")],
  984. path: "FirebaseRemoteConfig/Tests/Swift/ObjC",
  985. publicHeadersPath: ".",
  986. cSettings: [
  987. .headerSearchPath("../../../../"),
  988. ]
  989. ),
  990. // Internal headers only for consuming from other SDK.
  991. .target(
  992. name: "FirebaseRemoteConfigInterop",
  993. path: "FirebaseRemoteConfig/Interop",
  994. publicHeadersPath: ".",
  995. cSettings: [
  996. .headerSearchPath("../../"),
  997. ]
  998. ),
  999. // MARK: - Firebase Sessions
  1000. .target(
  1001. name: "FirebaseSessions",
  1002. dependencies: [
  1003. "FirebaseCore",
  1004. "FirebaseInstallations",
  1005. "FirebaseCoreExtension",
  1006. "FirebaseSessionsObjC",
  1007. .product(name: "Promises", package: "Promises"),
  1008. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  1009. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1010. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  1011. ],
  1012. path: "FirebaseSessions/Sources",
  1013. cSettings: [
  1014. .headerSearchPath(".."),
  1015. .define("DISPLAY_VERSION", to: firebaseVersion),
  1016. .define("PB_FIELD_32BIT", to: "1"),
  1017. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1018. .define("PB_ENABLE_MALLOC", to: "1"),
  1019. ],
  1020. linkerSettings: [
  1021. .linkedFramework("Security"),
  1022. .linkedFramework(
  1023. "SystemConfiguration",
  1024. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1025. ),
  1026. ]
  1027. ),
  1028. // The Sessions SDK is Swift-first with Objective-C code to support
  1029. // nanopb. Because Swift Package Manager doesn't support mixed
  1030. // language targets, the ObjC code has been extracted out into
  1031. // a separate target.
  1032. .target(
  1033. name: "FirebaseSessionsObjC",
  1034. dependencies: [
  1035. "FirebaseCore",
  1036. "FirebaseCoreExtension",
  1037. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1038. .product(name: "nanopb", package: "nanopb"),
  1039. ],
  1040. path: "FirebaseSessions",
  1041. exclude: [
  1042. "README.md",
  1043. "Sources/",
  1044. "Tests/",
  1045. "ProtoSupport/",
  1046. "generate_project.sh",
  1047. "generate_protos.sh",
  1048. "generate_testapp.sh",
  1049. ],
  1050. publicHeadersPath: "SourcesObjC",
  1051. cSettings: [
  1052. .headerSearchPath(".."),
  1053. .define("DISPLAY_VERSION", to: firebaseVersion),
  1054. .define("PB_FIELD_32BIT", to: "1"),
  1055. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1056. .define("PB_ENABLE_MALLOC", to: "1"),
  1057. ],
  1058. linkerSettings: [
  1059. .linkedFramework("Security"),
  1060. .linkedFramework(
  1061. "SystemConfiguration",
  1062. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1063. ),
  1064. ]
  1065. ),
  1066. .testTarget(
  1067. name: "FirebaseSessionsUnit",
  1068. dependencies: ["FirebaseSessions"],
  1069. path: "FirebaseSessions/Tests/Unit"
  1070. ),
  1071. // MARK: - Firebase Storage
  1072. .target(
  1073. name: "FirebaseStorage",
  1074. dependencies: [
  1075. "FirebaseAppCheckInterop",
  1076. "FirebaseAuthInterop",
  1077. "FirebaseCore",
  1078. "FirebaseCoreExtension",
  1079. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  1080. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1081. ],
  1082. path: "FirebaseStorage/Sources"
  1083. ),
  1084. .testTarget(
  1085. name: "FirebaseStorageUnit",
  1086. dependencies: ["FirebaseStorage",
  1087. "SharedTestUtilities"],
  1088. path: "FirebaseStorage/Tests/Unit",
  1089. cSettings: [
  1090. .headerSearchPath("../../../"),
  1091. ]
  1092. ),
  1093. .testTarget(
  1094. name: "StorageObjCIntegration",
  1095. dependencies: ["FirebaseStorage"],
  1096. path: "FirebaseStorage/Tests/ObjCIntegration",
  1097. exclude: [
  1098. // See https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730
  1099. "FIRStorageIntegrationTests.m",
  1100. "ObjCPPAPITests.mm",
  1101. "Credentials.h",
  1102. ],
  1103. cSettings: [
  1104. .headerSearchPath("../../.."),
  1105. ]
  1106. ),
  1107. .testTarget(
  1108. name: "swift-test",
  1109. dependencies: [
  1110. "Firebase",
  1111. "FirebaseAuth",
  1112. "FirebaseAppCheck",
  1113. "FirebaseABTesting",
  1114. "FirebaseAnalytics",
  1115. .target(name: "FirebaseAppDistribution",
  1116. condition: .when(platforms: [.iOS])),
  1117. "FirebaseAuthCombineSwift",
  1118. "FirebaseFirestoreCombineSwift",
  1119. "FirebaseFunctionsCombineSwift",
  1120. "FirebaseStorageCombineSwift",
  1121. "FirebaseCrashlytics",
  1122. "FirebaseCore",
  1123. "FirebaseDatabase",
  1124. "FirebaseDynamicLinks",
  1125. "FirebaseFirestoreTarget",
  1126. "FirebaseFunctions",
  1127. .target(name: "FirebaseInAppMessaging",
  1128. condition: .when(platforms: [.iOS, .tvOS])),
  1129. "FirebaseInstallations",
  1130. "FirebaseMessaging",
  1131. .target(name: "FirebasePerformance",
  1132. condition: .when(platforms: [.iOS, .tvOS])),
  1133. "FirebaseRemoteConfig",
  1134. "FirebaseSessions",
  1135. "FirebaseStorage",
  1136. .product(name: "nanopb", package: "nanopb"),
  1137. ],
  1138. path: "SwiftPMTests/swift-test"
  1139. ),
  1140. .testTarget(
  1141. name: "analytics-import-test",
  1142. dependencies: [
  1143. "FirebaseAnalyticsWrapper",
  1144. "Firebase",
  1145. ],
  1146. path: "SwiftPMTests/analytics-import-test"
  1147. ),
  1148. .testTarget(
  1149. name: "objc-import-test",
  1150. dependencies: [
  1151. "Firebase",
  1152. "FirebaseAuth",
  1153. "FirebaseABTesting",
  1154. "FirebaseAppCheck",
  1155. .target(name: "FirebaseAppDistribution",
  1156. condition: .when(platforms: [.iOS])),
  1157. "FirebaseCrashlytics",
  1158. "FirebaseCore",
  1159. "FirebaseDatabase",
  1160. "FirebaseDynamicLinks",
  1161. "FirebaseFirestoreTarget",
  1162. "FirebaseFunctions",
  1163. .target(name: "FirebaseInAppMessaging",
  1164. condition: .when(platforms: [.iOS, .tvOS])),
  1165. "FirebaseInstallations",
  1166. "FirebaseMessaging",
  1167. .target(name: "FirebasePerformance",
  1168. condition: .when(platforms: [.iOS, .tvOS])),
  1169. "FirebaseRemoteConfig",
  1170. "FirebaseStorage",
  1171. ],
  1172. path: "SwiftPMTests/objc-import-test"
  1173. ),
  1174. .testTarget(
  1175. name: "version-test",
  1176. dependencies: [
  1177. "FirebaseCore",
  1178. ],
  1179. path: "SwiftPMTests/version-test",
  1180. cSettings: [
  1181. .define("FIR_VERSION", to: firebaseVersion),
  1182. ]
  1183. ),
  1184. // MARK: - Firebase App Check
  1185. .target(name: "FirebaseAppCheck",
  1186. dependencies: [
  1187. "FirebaseAppCheckInterop",
  1188. "FirebaseCore",
  1189. .product(name: "AppCheckCore", package: "app-check"),
  1190. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1191. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  1192. ],
  1193. path: "FirebaseAppCheck/Sources",
  1194. publicHeadersPath: "Public",
  1195. cSettings: [
  1196. .headerSearchPath("../.."),
  1197. ],
  1198. linkerSettings: [
  1199. .linkedFramework(
  1200. "DeviceCheck",
  1201. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1202. ),
  1203. ]),
  1204. // Internal headers only for consuming from Swift.
  1205. .target(
  1206. name: "FirebaseAppCheckInterop",
  1207. path: "FirebaseAppCheck/Interop",
  1208. exclude: [
  1209. "CMakeLists.txt",
  1210. ],
  1211. publicHeadersPath: "Public",
  1212. cSettings: [
  1213. .headerSearchPath("../../"),
  1214. ]
  1215. ),
  1216. .testTarget(
  1217. name: "FirebaseAppCheckUnit",
  1218. dependencies: [
  1219. "FirebaseAppCheck",
  1220. "SharedTestUtilities",
  1221. .product(name: "OCMock", package: "ocmock"),
  1222. ],
  1223. path: "FirebaseAppCheck/Tests/Unit",
  1224. exclude: [
  1225. // Swift tests are in the target `FirebaseAppCheckUnitSwift` since mixed language targets
  1226. // are not supported (as of Xcode 15.0).
  1227. "Swift",
  1228. ],
  1229. cSettings: [
  1230. .headerSearchPath("../../.."),
  1231. ]
  1232. ),
  1233. .testTarget(
  1234. name: "FirebaseAppCheckUnitSwift",
  1235. dependencies: ["FirebaseAppCheck"],
  1236. path: "FirebaseAppCheck/Tests/Unit/Swift"
  1237. ),
  1238. // MARK: Testing support
  1239. .target(
  1240. name: "FirebaseFirestoreTestingSupport",
  1241. dependencies: ["FirebaseFirestoreTarget"],
  1242. path: "FirebaseTestingSupport/Firestore/Sources",
  1243. publicHeadersPath: "./",
  1244. cSettings: [
  1245. .headerSearchPath("../../.."),
  1246. .headerSearchPath("../../../Firestore/Source/Public/FirebaseFirestore"),
  1247. ]
  1248. ),
  1249. .testTarget(
  1250. name: "FirestoreTestingSupportTests",
  1251. dependencies: ["FirebaseFirestoreTestingSupport"],
  1252. path: "FirebaseTestingSupport/Firestore/Tests",
  1253. cSettings: [
  1254. .headerSearchPath("../../.."),
  1255. ]
  1256. ),
  1257. // MARK: - Firebase Vertex AI
  1258. .target(
  1259. name: "FirebaseVertexAI",
  1260. dependencies: [
  1261. "FirebaseAppCheckInterop",
  1262. "FirebaseAuthInterop",
  1263. "FirebaseCore",
  1264. "FirebaseCoreExtension",
  1265. ],
  1266. path: "FirebaseVertexAI/Sources"
  1267. ),
  1268. .testTarget(
  1269. name: "FirebaseVertexAIUnit",
  1270. dependencies: ["FirebaseVertexAI", "SharedTestUtilities"],
  1271. path: "FirebaseVertexAI/Tests/Unit",
  1272. resources: [
  1273. .process("vertexai-sdk-test-data/mock-responses"),
  1274. ],
  1275. cSettings: [
  1276. .headerSearchPath("../../../"),
  1277. ]
  1278. ),
  1279. .testTarget(
  1280. name: "FirebaseVertexAIIntegration",
  1281. dependencies: ["FirebaseVertexAI"],
  1282. path: "FirebaseVertexAI/Tests/Integration",
  1283. resources: [
  1284. .process("Resources"),
  1285. ]
  1286. ),
  1287. ] + firestoreTargets(),
  1288. cLanguageStandard: .c99,
  1289. cxxLanguageStandard: CXXLanguageStandard.gnucxx14
  1290. )
  1291. // MARK: - Helper Functions
  1292. func googleAppMeasurementDependency() -> Package.Dependency {
  1293. let appMeasurementURL = "https://github.com/google/GoogleAppMeasurement.git"
  1294. // Point SPM CI to the tip of main of https://github.com/google/GoogleAppMeasurement so that the
  1295. // release process can defer publishing the GoogleAppMeasurement tag until after testing.
  1296. if ProcessInfo.processInfo.environment["FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT"] != nil {
  1297. return .package(url: appMeasurementURL, branch: "main")
  1298. }
  1299. return .package(url: appMeasurementURL, exact: "11.0.0")
  1300. }
  1301. func abseilDependency() -> Package.Dependency {
  1302. let packageInfo: (url: String, range: Range<Version>)
  1303. // If building Firestore from source, abseil will need to be built as source
  1304. // as the headers in the binary version of abseil are unusable.
  1305. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1306. packageInfo = (
  1307. "https://github.com/firebase/abseil-cpp-SwiftPM.git",
  1308. "0.20240116.1" ..< "0.20240117.0"
  1309. )
  1310. } else {
  1311. packageInfo = (
  1312. "https://github.com/google/abseil-cpp-binary.git",
  1313. "1.2024011601.1" ..< "1.2024011700.0"
  1314. )
  1315. return .package(url: packageInfo.url, branch: "nc/firestore-pre_rc1")
  1316. }
  1317. return .package(url: packageInfo.url, packageInfo.range)
  1318. }
  1319. func grpcDependency() -> Package.Dependency {
  1320. let packageInfo: (url: String, range: Range<Version>)
  1321. // If building Firestore from source, abseil will need to be built as source
  1322. // as the headers in the binary version of abseil are unusable.
  1323. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1324. packageInfo = ("https://github.com/grpc/grpc-ios.git", "1.65.0" ..< "1.66.0")
  1325. } else {
  1326. packageInfo = ("https://github.com/google/grpc-binary.git", "1.62.2" ..< "1.63.0")
  1327. return .package(url: packageInfo.url, branch: "ncooke3-patch-1")
  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/10.27.0/rc0/FirebaseFirestoreInternal.zip",
  1460. checksum: "38f6d1bb13fabca97f53c0ef5bf283b2fbbbf460eac8fa875cd3faab597097b8"
  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. }