Package.swift 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568
  1. // swift-tools-version:5.9
  2. // The swift-tools-version declares the minimum version of Swift required to
  3. // build this package.
  4. // Copyright 2020 Google LLC
  5. //
  6. // Licensed under the Apache License, Version 2.0 (the "License");
  7. // you may not use this file except in compliance with the License.
  8. // You may obtain a copy of the License at
  9. //
  10. // http://www.apache.org/licenses/LICENSE-2.0
  11. //
  12. // Unless required by applicable law or agreed to in writing, software
  13. // distributed under the License is distributed on an "AS IS" BASIS,
  14. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. // See the License for the specific language governing permissions and
  16. // limitations under the License.
  17. import class Foundation.ProcessInfo
  18. import PackageDescription
  19. let firebaseVersion = "11.1.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: ["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. "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. dependencies: [
  619. "FirebaseCore",
  620. "FirebaseCoreExtension",
  621. ],
  622. path: "FirebaseSharedSwift/Sources",
  623. exclude: [
  624. "third_party/FirebaseDataEncoder/LICENSE",
  625. "third_party/FirebaseDataEncoder/METADATA",
  626. ]
  627. ),
  628. .testTarget(
  629. name: "FirebaseSharedSwiftTests",
  630. dependencies: ["FirebaseSharedSwift"],
  631. path: "FirebaseSharedSwift/Tests/"
  632. ),
  633. .target(
  634. name: "FirebaseDynamicLinksTarget",
  635. dependencies: [.target(name: "FirebaseDynamicLinks",
  636. condition: .when(platforms: [.iOS]))],
  637. path: "SwiftPM-PlatformExclude/FirebaseDynamicLinksWrap"
  638. ),
  639. .target(
  640. name: "FirebaseDynamicLinks",
  641. dependencies: ["FirebaseCore"],
  642. path: "FirebaseDynamicLinks/Sources",
  643. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  644. publicHeadersPath: "Public",
  645. cSettings: [
  646. .headerSearchPath("../../"),
  647. .define("FIRDynamicLinks3P", to: "1"),
  648. .define("GIN_SCION_LOGGING", to: "1"),
  649. ],
  650. linkerSettings: [
  651. .linkedFramework("QuartzCore"),
  652. ]
  653. ),
  654. firestoreWrapperTarget(),
  655. // MARK: - Firebase Functions
  656. .target(
  657. name: "FirebaseFunctions",
  658. dependencies: [
  659. "FirebaseAppCheckInterop",
  660. "FirebaseAuthInterop",
  661. "FirebaseCore",
  662. "FirebaseCoreExtension",
  663. "FirebaseMessagingInterop",
  664. "FirebaseSharedSwift",
  665. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  666. ],
  667. path: "FirebaseFunctions/Sources"
  668. ),
  669. .testTarget(
  670. name: "FirebaseFunctionsUnit",
  671. dependencies: ["FirebaseFunctions",
  672. "FirebaseAppCheckInterop",
  673. "FirebaseAuthInterop",
  674. "FirebaseMessagingInterop",
  675. "SharedTestUtilities"],
  676. path: "FirebaseFunctions/Tests/Unit",
  677. cSettings: [
  678. .headerSearchPath("../../../"),
  679. ]
  680. ),
  681. .testTarget(
  682. name: "FirebaseFunctionsIntegration",
  683. dependencies: ["FirebaseFunctions",
  684. "SharedTestUtilities"],
  685. path: "FirebaseFunctions/Tests/Integration"
  686. ),
  687. .testTarget(
  688. name: "FirebaseFunctionsObjCIntegration",
  689. dependencies: ["FirebaseFunctions",
  690. "SharedTestUtilities"],
  691. path: "FirebaseFunctions/Tests/ObjCIntegration",
  692. // See https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730
  693. exclude: [
  694. "ObjCPPAPITests.mm",
  695. ],
  696. cSettings: [
  697. .headerSearchPath("../../.."),
  698. ]
  699. ),
  700. .target(
  701. name: "FirebaseFunctionsCombineSwift",
  702. dependencies: ["FirebaseFunctions"],
  703. path: "FirebaseCombineSwift/Sources/Functions"
  704. ),
  705. .testTarget(
  706. name: "FunctionsCombineUnit",
  707. dependencies: ["FirebaseFunctionsCombineSwift",
  708. "SharedTestUtilities"],
  709. path: "FirebaseFunctions/Tests/CombineUnit"
  710. ),
  711. // MARK: - Firebase In App Messaging
  712. .target(
  713. name: "FirebaseInAppMessagingTarget",
  714. dependencies: [
  715. .target(name: "FirebaseInAppMessaging", condition: .when(platforms: [.iOS, .tvOS])),
  716. ],
  717. path: "SwiftPM-PlatformExclude/FirebaseInAppMessagingWrap"
  718. ),
  719. .target(
  720. name: "FirebaseInAppMessagingInternal",
  721. dependencies: [
  722. "FirebaseCore",
  723. "FirebaseInstallations",
  724. "FirebaseABTesting",
  725. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  726. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  727. .product(name: "nanopb", package: "nanopb"),
  728. .target(name: "FirebaseInAppMessaging_iOS", condition: .when(platforms: [.iOS])),
  729. ],
  730. path: "FirebaseInAppMessaging/Sources",
  731. exclude: [
  732. "DefaultUI/CHANGELOG.md",
  733. "DefaultUI/README.md",
  734. ],
  735. publicHeadersPath: "Public",
  736. cSettings: [
  737. .headerSearchPath("../../"),
  738. .define("PB_FIELD_32BIT", to: "1"),
  739. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  740. .define("PB_ENABLE_MALLOC", to: "1"),
  741. ]
  742. ),
  743. .target(
  744. name: "FirebaseInAppMessaging_iOS",
  745. path: "FirebaseInAppMessaging/iOS",
  746. resources: [.process("Resources")]
  747. ),
  748. .target(
  749. name: "FirebaseInAppMessaging",
  750. dependencies: ["FirebaseInAppMessagingInternal"],
  751. path: "FirebaseInAppMessaging/Swift/Source"
  752. ),
  753. .target(
  754. name: "FirebaseInstallations",
  755. dependencies: [
  756. "FirebaseCore",
  757. .product(name: "FBLPromises", package: "Promises"),
  758. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  759. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  760. ],
  761. path: "FirebaseInstallations/Source/Library",
  762. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  763. publicHeadersPath: "Public",
  764. cSettings: [
  765. .headerSearchPath("../../../"),
  766. ],
  767. linkerSettings: [
  768. .linkedFramework("Security"),
  769. ]
  770. ),
  771. .target(
  772. name: "FirebaseMLModelDownloader",
  773. dependencies: [
  774. "FirebaseCore",
  775. "FirebaseCoreExtension",
  776. "FirebaseInstallations",
  777. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  778. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  779. .product(name: "SwiftProtobuf", package: "swift-protobuf"),
  780. ],
  781. path: "FirebaseMLModelDownloader/Sources",
  782. exclude: [
  783. "proto/firebase_ml_log_sdk.proto",
  784. ],
  785. cSettings: [
  786. .define("FIRMLModelDownloader_VERSION", to: firebaseVersion),
  787. ]
  788. ),
  789. .testTarget(
  790. name: "FirebaseMLModelDownloaderUnit",
  791. dependencies: ["FirebaseMLModelDownloader"],
  792. path: "FirebaseMLModelDownloader/Tests/Unit"
  793. ),
  794. .target(
  795. name: "FirebaseMessaging",
  796. dependencies: [
  797. "FirebaseCore",
  798. "FirebaseInstallations",
  799. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  800. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  801. .product(name: "GULReachability", package: "GoogleUtilities"),
  802. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  803. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  804. .product(name: "nanopb", package: "nanopb"),
  805. ],
  806. path: "FirebaseMessaging/Sources",
  807. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  808. publicHeadersPath: "Public",
  809. cSettings: [
  810. .headerSearchPath("../../"),
  811. .define("PB_FIELD_32BIT", to: "1"),
  812. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  813. .define("PB_ENABLE_MALLOC", to: "1"),
  814. ],
  815. linkerSettings: [
  816. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  817. ]
  818. ),
  819. // Internal headers only for consuming from Swift.
  820. .target(
  821. name: "FirebaseMessagingInterop",
  822. path: "FirebaseMessaging/Interop",
  823. publicHeadersPath: ".",
  824. cSettings: [
  825. .headerSearchPath("../../"),
  826. ]
  827. ),
  828. .testTarget(
  829. name: "MessagingUnit",
  830. dependencies: [
  831. "FirebaseMessaging",
  832. "SharedTestUtilities",
  833. .product(name: "OCMock", package: "ocmock"),
  834. ],
  835. path: "FirebaseMessaging/Tests/UnitTests",
  836. exclude: [
  837. "FIRMessagingContextManagerServiceTest.m", // TODO: Adapt its NSBundle usage to SPM.
  838. ],
  839. cSettings: [
  840. .headerSearchPath("../../.."),
  841. ]
  842. ),
  843. .target(
  844. name: "FirebasePerformanceTarget",
  845. dependencies: [.target(name: "FirebasePerformance",
  846. condition: .when(platforms: [.iOS, .tvOS, .visionOS]))],
  847. path: "SwiftPM-PlatformExclude/FirebasePerformanceWrap"
  848. ),
  849. .target(
  850. name: "FirebasePerformance",
  851. dependencies: [
  852. "FirebaseCore",
  853. "FirebaseInstallations",
  854. // Performance depends on the Obj-C target of FirebaseRemoteConfig to
  855. // avoid including Swift code from the `FirebaseRemoteConfig` target
  856. // that is unneeded.
  857. "FirebaseRemoteConfigInternal",
  858. "FirebaseSessions",
  859. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  860. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  861. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  862. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  863. .product(name: "nanopb", package: "nanopb"),
  864. ],
  865. path: "FirebasePerformance/Sources",
  866. publicHeadersPath: "Public",
  867. cSettings: [
  868. .headerSearchPath("../../"),
  869. .define("PB_FIELD_32BIT", to: "1"),
  870. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  871. .define("PB_ENABLE_MALLOC", to: "1"),
  872. .define("FIRPerformance_LIB_VERSION", to: firebaseVersion),
  873. ],
  874. linkerSettings: [
  875. .linkedFramework("MobileCoreServices", .when(platforms: [.iOS, .tvOS])),
  876. .linkedFramework("QuartzCore", .when(platforms: [.iOS, .tvOS])),
  877. ]
  878. ),
  879. .testTarget(
  880. name: "PerformanceUnit",
  881. dependencies: [
  882. "FirebasePerformanceTarget",
  883. "SharedTestUtilities",
  884. "GCDWebServer",
  885. .product(name: "OCMock", package: "ocmock"),
  886. ],
  887. path: "FirebasePerformance/Tests/Unit",
  888. resources: [
  889. .process("FPRURLFilterTests-Info.plist"),
  890. .process("Server/smallDownloadFile"),
  891. .process("Server/bigDownloadFile"),
  892. ],
  893. cSettings: [
  894. .headerSearchPath("../../.."),
  895. .define("PB_FIELD_32BIT", to: "1"),
  896. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  897. .define("PB_ENABLE_MALLOC", to: "1"),
  898. ]
  899. ),
  900. .target(
  901. name: "SharedTestUtilities",
  902. dependencies: ["FirebaseCore",
  903. "FirebaseAppCheckInterop",
  904. "FirebaseAuthInterop",
  905. "FirebaseMessagingInterop",
  906. "GoogleDataTransport",
  907. .product(name: "OCMock", package: "ocmock")],
  908. path: "SharedTestUtilities",
  909. publicHeadersPath: "./",
  910. cSettings: [
  911. .headerSearchPath("../"),
  912. ]
  913. ),
  914. // MARK: - Firebase Remote Config
  915. .target(
  916. name: "FirebaseRemoteConfigInternal",
  917. dependencies: [
  918. "FirebaseCore",
  919. "FirebaseABTesting",
  920. "FirebaseInstallations",
  921. "FirebaseRemoteConfigInterop",
  922. .product(name: "GULNSData", package: "GoogleUtilities"),
  923. ],
  924. path: "FirebaseRemoteConfig/Sources",
  925. publicHeadersPath: "Public",
  926. cSettings: [
  927. .headerSearchPath("../../"),
  928. ]
  929. ),
  930. .testTarget(
  931. name: "RemoteConfigUnit",
  932. dependencies: ["FirebaseRemoteConfigInternal", .product(name: "OCMock", package: "ocmock")],
  933. path: "FirebaseRemoteConfig/Tests/Unit",
  934. exclude: [
  935. // Need to be evaluated/ported to RC V2.
  936. "RCNConfigAnalyticsTest.m",
  937. "RCNConfigSettingsTest.m",
  938. "RCNConfigTest.m",
  939. "RCNRemoteConfig+FIRAppTest.m",
  940. "RCNThrottlingTests.m",
  941. ],
  942. resources: [
  943. .process("SecondApp-GoogleService-Info.plist"),
  944. .process("Defaults-testInfo.plist"),
  945. .process("TestABTPayload.txt"),
  946. ],
  947. cSettings: [
  948. .headerSearchPath("../../.."),
  949. ]
  950. ),
  951. .testTarget(
  952. name: "RemoteConfigSwiftUnit",
  953. dependencies: ["FirebaseRemoteConfigInternal"],
  954. path: "FirebaseRemoteConfig/Tests/SwiftUnit",
  955. cSettings: [
  956. .headerSearchPath("../../.."),
  957. ]
  958. ),
  959. .target(
  960. name: "FirebaseRemoteConfig",
  961. dependencies: [
  962. "FirebaseRemoteConfigInternal",
  963. "FirebaseSharedSwift",
  964. ],
  965. path: "FirebaseRemoteConfig/Swift",
  966. resources: [.process("Resources/PrivacyInfo.xcprivacy")]
  967. ),
  968. .testTarget(
  969. name: "RemoteConfigFakeConsole",
  970. dependencies: ["FirebaseRemoteConfig",
  971. "RemoteConfigFakeConsoleObjC"],
  972. path: "FirebaseRemoteConfig/Tests/Swift",
  973. exclude: [
  974. "AccessToken.json",
  975. "README.md",
  976. "ObjC/",
  977. ],
  978. resources: [
  979. .process("Defaults-testInfo.plist"),
  980. ],
  981. cSettings: [
  982. .headerSearchPath("../../../"),
  983. ]
  984. ),
  985. .target(
  986. name: "RemoteConfigFakeConsoleObjC",
  987. dependencies: [.product(name: "OCMock", package: "ocmock")],
  988. path: "FirebaseRemoteConfig/Tests/Swift/ObjC",
  989. publicHeadersPath: ".",
  990. cSettings: [
  991. .headerSearchPath("../../../../"),
  992. ]
  993. ),
  994. // Internal headers only for consuming from other SDK.
  995. .target(
  996. name: "FirebaseRemoteConfigInterop",
  997. path: "FirebaseRemoteConfig/Interop",
  998. publicHeadersPath: ".",
  999. cSettings: [
  1000. .headerSearchPath("../../"),
  1001. ]
  1002. ),
  1003. // MARK: - Firebase Sessions
  1004. .target(
  1005. name: "FirebaseSessions",
  1006. dependencies: [
  1007. "FirebaseCore",
  1008. "FirebaseInstallations",
  1009. "FirebaseCoreExtension",
  1010. "FirebaseSessionsObjC",
  1011. .product(name: "Promises", package: "Promises"),
  1012. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  1013. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1014. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  1015. ],
  1016. path: "FirebaseSessions/Sources",
  1017. cSettings: [
  1018. .headerSearchPath(".."),
  1019. .define("DISPLAY_VERSION", to: firebaseVersion),
  1020. .define("PB_FIELD_32BIT", to: "1"),
  1021. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1022. .define("PB_ENABLE_MALLOC", to: "1"),
  1023. ],
  1024. linkerSettings: [
  1025. .linkedFramework("Security"),
  1026. .linkedFramework(
  1027. "SystemConfiguration",
  1028. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1029. ),
  1030. ]
  1031. ),
  1032. // The Sessions SDK is Swift-first with Objective-C code to support
  1033. // nanopb. Because Swift Package Manager doesn't support mixed
  1034. // language targets, the ObjC code has been extracted out into
  1035. // a separate target.
  1036. .target(
  1037. name: "FirebaseSessionsObjC",
  1038. dependencies: [
  1039. "FirebaseCore",
  1040. "FirebaseCoreExtension",
  1041. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1042. .product(name: "nanopb", package: "nanopb"),
  1043. ],
  1044. path: "FirebaseSessions",
  1045. exclude: [
  1046. "README.md",
  1047. "Sources/",
  1048. "Tests/",
  1049. "ProtoSupport/",
  1050. "generate_project.sh",
  1051. "generate_protos.sh",
  1052. "generate_testapp.sh",
  1053. ],
  1054. publicHeadersPath: "SourcesObjC",
  1055. cSettings: [
  1056. .headerSearchPath(".."),
  1057. .define("DISPLAY_VERSION", to: firebaseVersion),
  1058. .define("PB_FIELD_32BIT", to: "1"),
  1059. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1060. .define("PB_ENABLE_MALLOC", to: "1"),
  1061. ],
  1062. linkerSettings: [
  1063. .linkedFramework("Security"),
  1064. .linkedFramework(
  1065. "SystemConfiguration",
  1066. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1067. ),
  1068. ]
  1069. ),
  1070. .testTarget(
  1071. name: "FirebaseSessionsUnit",
  1072. dependencies: ["FirebaseSessions"],
  1073. path: "FirebaseSessions/Tests/Unit"
  1074. ),
  1075. // MARK: - Firebase Storage
  1076. .target(
  1077. name: "FirebaseStorage",
  1078. dependencies: [
  1079. "FirebaseAppCheckInterop",
  1080. "FirebaseAuthInterop",
  1081. "FirebaseCore",
  1082. "FirebaseCoreExtension",
  1083. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  1084. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1085. ],
  1086. path: "FirebaseStorage/Sources"
  1087. ),
  1088. .testTarget(
  1089. name: "FirebaseStorageUnit",
  1090. dependencies: ["FirebaseStorage",
  1091. "SharedTestUtilities"],
  1092. path: "FirebaseStorage/Tests/Unit",
  1093. cSettings: [
  1094. .headerSearchPath("../../../"),
  1095. ]
  1096. ),
  1097. .testTarget(
  1098. name: "StorageObjCIntegration",
  1099. dependencies: ["FirebaseStorage"],
  1100. path: "FirebaseStorage/Tests/ObjCIntegration",
  1101. exclude: [
  1102. // See https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730
  1103. "FIRStorageIntegrationTests.m",
  1104. "ObjCPPAPITests.mm",
  1105. "Credentials.h",
  1106. ],
  1107. cSettings: [
  1108. .headerSearchPath("../../.."),
  1109. ]
  1110. ),
  1111. .testTarget(
  1112. name: "swift-test",
  1113. dependencies: [
  1114. "Firebase",
  1115. "FirebaseAuth",
  1116. "FirebaseAppCheck",
  1117. "FirebaseABTesting",
  1118. "FirebaseAnalytics",
  1119. .target(name: "FirebaseAppDistribution",
  1120. condition: .when(platforms: [.iOS])),
  1121. "FirebaseAuthCombineSwift",
  1122. "FirebaseFirestoreCombineSwift",
  1123. "FirebaseFunctionsCombineSwift",
  1124. "FirebaseStorageCombineSwift",
  1125. "FirebaseCrashlytics",
  1126. "FirebaseCore",
  1127. "FirebaseDatabase",
  1128. "FirebaseDynamicLinks",
  1129. "FirebaseFirestoreTarget",
  1130. "FirebaseFunctions",
  1131. .target(name: "FirebaseInAppMessaging",
  1132. condition: .when(platforms: [.iOS, .tvOS])),
  1133. "FirebaseInstallations",
  1134. "FirebaseMessaging",
  1135. .target(name: "FirebasePerformance",
  1136. condition: .when(platforms: [.iOS, .tvOS])),
  1137. "FirebaseRemoteConfig",
  1138. "FirebaseSessions",
  1139. "FirebaseStorage",
  1140. .product(name: "nanopb", package: "nanopb"),
  1141. ],
  1142. path: "SwiftPMTests/swift-test"
  1143. ),
  1144. .testTarget(
  1145. name: "analytics-import-test",
  1146. dependencies: [
  1147. "FirebaseAnalyticsWrapper",
  1148. "Firebase",
  1149. ],
  1150. path: "SwiftPMTests/analytics-import-test"
  1151. ),
  1152. .testTarget(
  1153. name: "objc-import-test",
  1154. dependencies: [
  1155. "Firebase",
  1156. "FirebaseAuth",
  1157. "FirebaseABTesting",
  1158. "FirebaseAppCheck",
  1159. .target(name: "FirebaseAppDistribution",
  1160. condition: .when(platforms: [.iOS])),
  1161. "FirebaseCrashlytics",
  1162. "FirebaseCore",
  1163. "FirebaseDatabase",
  1164. "FirebaseDynamicLinks",
  1165. "FirebaseFirestoreTarget",
  1166. "FirebaseFunctions",
  1167. .target(name: "FirebaseInAppMessaging",
  1168. condition: .when(platforms: [.iOS, .tvOS])),
  1169. "FirebaseInstallations",
  1170. "FirebaseMessaging",
  1171. .target(name: "FirebasePerformance",
  1172. condition: .when(platforms: [.iOS, .tvOS])),
  1173. "FirebaseRemoteConfig",
  1174. "FirebaseStorage",
  1175. ],
  1176. path: "SwiftPMTests/objc-import-test"
  1177. ),
  1178. .testTarget(
  1179. name: "version-test",
  1180. dependencies: [
  1181. "FirebaseCore",
  1182. ],
  1183. path: "SwiftPMTests/version-test",
  1184. cSettings: [
  1185. .define("FIR_VERSION", to: firebaseVersion),
  1186. ]
  1187. ),
  1188. // MARK: - Firebase App Check
  1189. .target(name: "FirebaseAppCheck",
  1190. dependencies: [
  1191. "FirebaseAppCheckInterop",
  1192. "FirebaseCore",
  1193. .product(name: "AppCheckCore", package: "app-check"),
  1194. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1195. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  1196. ],
  1197. path: "FirebaseAppCheck/Sources",
  1198. publicHeadersPath: "Public",
  1199. cSettings: [
  1200. .headerSearchPath("../.."),
  1201. ],
  1202. linkerSettings: [
  1203. .linkedFramework(
  1204. "DeviceCheck",
  1205. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1206. ),
  1207. ]),
  1208. // Internal headers only for consuming from Swift.
  1209. .target(
  1210. name: "FirebaseAppCheckInterop",
  1211. path: "FirebaseAppCheck/Interop",
  1212. exclude: [
  1213. "CMakeLists.txt",
  1214. ],
  1215. publicHeadersPath: "Public",
  1216. cSettings: [
  1217. .headerSearchPath("../../"),
  1218. ]
  1219. ),
  1220. .testTarget(
  1221. name: "FirebaseAppCheckUnit",
  1222. dependencies: [
  1223. "FirebaseAppCheck",
  1224. "SharedTestUtilities",
  1225. .product(name: "OCMock", package: "ocmock"),
  1226. ],
  1227. path: "FirebaseAppCheck/Tests/Unit",
  1228. exclude: [
  1229. // Swift tests are in the target `FirebaseAppCheckUnitSwift` since mixed language targets
  1230. // are not supported (as of Xcode 15.0).
  1231. "Swift",
  1232. ],
  1233. cSettings: [
  1234. .headerSearchPath("../../.."),
  1235. ]
  1236. ),
  1237. .testTarget(
  1238. name: "FirebaseAppCheckUnitSwift",
  1239. dependencies: ["FirebaseAppCheck"],
  1240. path: "FirebaseAppCheck/Tests/Unit/Swift"
  1241. ),
  1242. // MARK: Testing support
  1243. .target(
  1244. name: "FirebaseFirestoreTestingSupport",
  1245. dependencies: ["FirebaseFirestoreTarget"],
  1246. path: "FirebaseTestingSupport/Firestore/Sources",
  1247. publicHeadersPath: "./",
  1248. cSettings: [
  1249. .headerSearchPath("../../.."),
  1250. .headerSearchPath("../../../Firestore/Source/Public/FirebaseFirestore"),
  1251. ]
  1252. ),
  1253. .testTarget(
  1254. name: "FirestoreTestingSupportTests",
  1255. dependencies: ["FirebaseFirestoreTestingSupport"],
  1256. path: "FirebaseTestingSupport/Firestore/Tests",
  1257. cSettings: [
  1258. .headerSearchPath("../../.."),
  1259. ]
  1260. ),
  1261. // MARK: - Firebase Vertex AI
  1262. .target(
  1263. name: "FirebaseVertexAI",
  1264. dependencies: [
  1265. "FirebaseAppCheckInterop",
  1266. "FirebaseAuthInterop",
  1267. "FirebaseCore",
  1268. "FirebaseCoreExtension",
  1269. "FirebaseSharedSwift",
  1270. ],
  1271. path: "FirebaseVertexAI/Sources"
  1272. ),
  1273. .testTarget(
  1274. name: "FirebaseVertexAIUnit",
  1275. dependencies: ["FirebaseVertexAI", "SharedTestUtilities"],
  1276. path: "FirebaseVertexAI/Tests/Unit",
  1277. resources: [
  1278. .process("vertexai-sdk-test-data/mock-responses"),
  1279. ],
  1280. cSettings: [
  1281. .headerSearchPath("../../../"),
  1282. ]
  1283. ),
  1284. .testTarget(
  1285. name: "FirebaseVertexAIIntegration",
  1286. dependencies: ["FirebaseVertexAI"],
  1287. path: "FirebaseVertexAI/Tests/Integration",
  1288. resources: [
  1289. .process("Resources"),
  1290. ]
  1291. ),
  1292. ] + firestoreTargets(),
  1293. cLanguageStandard: .c99,
  1294. cxxLanguageStandard: CXXLanguageStandard.gnucxx14
  1295. )
  1296. // MARK: - Helper Functions
  1297. func googleAppMeasurementDependency() -> Package.Dependency {
  1298. let appMeasurementURL = "https://github.com/google/GoogleAppMeasurement.git"
  1299. // Point SPM CI to the tip of main of https://github.com/google/GoogleAppMeasurement so that the
  1300. // release process can defer publishing the GoogleAppMeasurement tag until after testing.
  1301. if ProcessInfo.processInfo.environment["FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT"] != nil {
  1302. return .package(url: appMeasurementURL, branch: "main")
  1303. }
  1304. return .package(url: appMeasurementURL, exact: "11.0.0")
  1305. }
  1306. func abseilDependency() -> Package.Dependency {
  1307. let packageInfo: (url: String, range: Range<Version>)
  1308. // If building Firestore from source, abseil will need to be built as source
  1309. // as the headers in the binary version of abseil are unusable.
  1310. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1311. packageInfo = (
  1312. "https://github.com/firebase/abseil-cpp-SwiftPM.git",
  1313. "0.20240116.1" ..< "0.20240117.0"
  1314. )
  1315. } else {
  1316. packageInfo = (
  1317. "https://github.com/google/abseil-cpp-binary.git",
  1318. "1.2024011602.0" ..< "1.2024011700.0"
  1319. )
  1320. }
  1321. return .package(url: packageInfo.url, packageInfo.range)
  1322. }
  1323. func grpcDependency() -> Package.Dependency {
  1324. let packageInfo: (url: String, range: Range<Version>)
  1325. // If building Firestore from source, abseil will need to be built as source
  1326. // as the headers in the binary version of abseil are unusable.
  1327. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1328. packageInfo = ("https://github.com/grpc/grpc-ios.git", "1.65.0" ..< "1.66.0")
  1329. } else {
  1330. packageInfo = ("https://github.com/google/grpc-binary.git", "1.65.1" ..< "1.66.0")
  1331. }
  1332. return .package(url: packageInfo.url, packageInfo.range)
  1333. }
  1334. func firestoreWrapperTarget() -> Target {
  1335. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1336. return .target(
  1337. name: "FirebaseFirestoreTarget",
  1338. dependencies: [.target(name: "FirebaseFirestore",
  1339. condition: .when(platforms: [.iOS, .tvOS, .macOS, .visionOS]))],
  1340. path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap"
  1341. )
  1342. }
  1343. return .target(
  1344. name: "FirebaseFirestoreTarget",
  1345. dependencies: [.target(name: "FirebaseFirestore",
  1346. condition: .when(platforms: [.iOS, .tvOS, .macOS, .macCatalyst]))],
  1347. path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap",
  1348. cSettings: [.define("FIREBASE_BINARY_FIRESTORE", to: "1")]
  1349. )
  1350. }
  1351. func firestoreTargets() -> [Target] {
  1352. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1353. return [
  1354. .target(
  1355. name: "FirebaseFirestoreInternalWrapper",
  1356. dependencies: [
  1357. "FirebaseAppCheckInterop",
  1358. "FirebaseCore",
  1359. "leveldb",
  1360. .product(name: "nanopb", package: "nanopb"),
  1361. .product(name: "abseil", package: "abseil-cpp-SwiftPM"),
  1362. .product(name: "gRPC-cpp", package: "grpc-ios"),
  1363. ],
  1364. path: "Firestore",
  1365. exclude: [
  1366. "CHANGELOG.md",
  1367. "CMakeLists.txt",
  1368. "Example/",
  1369. "LICENSE",
  1370. "Protos/CMakeLists.txt",
  1371. "Protos/Podfile",
  1372. "Protos/README.md",
  1373. "Protos/build_protos.py",
  1374. "Protos/cpp/",
  1375. "Protos/lib/",
  1376. "Protos/nanopb_cpp_generator.py",
  1377. "Protos/protos/",
  1378. "README.md",
  1379. "Source/CMakeLists.txt",
  1380. "Swift/",
  1381. "core/CMakeLists.txt",
  1382. "core/src/util/config_detected.h.in",
  1383. "core/test/",
  1384. "fuzzing/",
  1385. "test.sh",
  1386. // Swift PM doesn't recognize hpp files, so we're relying on search paths
  1387. // to find third_party/nlohmann_json/json.hpp.
  1388. "third_party/",
  1389. // Exclude alternate implementations for other platforms
  1390. "core/src/remote/connectivity_monitor_noop.cc",
  1391. "core/src/util/filesystem_win.cc",
  1392. "core/src/util/log_stdio.cc",
  1393. "core/src/util/secure_random_openssl.cc",
  1394. ],
  1395. sources: [
  1396. "Source/",
  1397. "Protos/nanopb/",
  1398. "core/include/",
  1399. "core/src",
  1400. ],
  1401. publicHeadersPath: "Source/Public",
  1402. cSettings: [
  1403. .headerSearchPath("../"),
  1404. .headerSearchPath("Source/Public/FirebaseFirestore"),
  1405. .headerSearchPath("Protos/nanopb"),
  1406. .define("PB_FIELD_32BIT", to: "1"),
  1407. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1408. .define("PB_ENABLE_MALLOC", to: "1"),
  1409. .define("FIRFirestore_VERSION", to: firebaseVersion),
  1410. ],
  1411. linkerSettings: [
  1412. .linkedFramework(
  1413. "SystemConfiguration",
  1414. .when(platforms: [.iOS, .macOS, .tvOS, .visionOS])
  1415. ),
  1416. .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS, .visionOS])),
  1417. .linkedLibrary("c++"),
  1418. ]
  1419. ),
  1420. .target(
  1421. name: "FirebaseFirestore",
  1422. dependencies: [
  1423. "FirebaseCore",
  1424. "FirebaseCoreExtension",
  1425. "FirebaseFirestoreInternalWrapper",
  1426. "FirebaseSharedSwift",
  1427. ],
  1428. path: "Firestore",
  1429. exclude: [
  1430. "CHANGELOG.md",
  1431. "CMakeLists.txt",
  1432. "Example/",
  1433. "LICENSE",
  1434. "Protos/",
  1435. "README.md",
  1436. "Source/",
  1437. "core/",
  1438. "fuzzing/",
  1439. "test.sh",
  1440. "Swift/CHANGELOG.md",
  1441. "Swift/Tests/",
  1442. "third_party/nlohmann_json",
  1443. ],
  1444. sources: [
  1445. "Swift/Source/",
  1446. ],
  1447. resources: [.process("Source/Resources/PrivacyInfo.xcprivacy")]
  1448. ),
  1449. ]
  1450. }
  1451. let firestoreInternalTarget: Target = {
  1452. if ProcessInfo.processInfo.environment["FIREBASECI_USE_LOCAL_FIRESTORE_ZIP"] != nil {
  1453. // This is set when running `scripts/check_firestore_symbols.sh`.
  1454. return .binaryTarget(
  1455. name: "FirebaseFirestoreInternal",
  1456. // The `xcframework` should be moved to the root of the repo.
  1457. path: "FirebaseFirestoreInternal.xcframework"
  1458. )
  1459. } else {
  1460. return .binaryTarget(
  1461. name: "FirebaseFirestoreInternal",
  1462. url: "https://dl.google.com/firebase/ios/bin/firestore/11.0.0/rc2/FirebaseFirestoreInternal.zip",
  1463. checksum: "3787634efd3d4e0aec5fac929dcc77c54d9b3765103bfe3d861da3b2315243b7"
  1464. )
  1465. }
  1466. }()
  1467. return [
  1468. .target(
  1469. name: "FirebaseFirestore",
  1470. dependencies: [
  1471. .target(
  1472. name: "FirebaseFirestoreInternalWrapper",
  1473. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1474. ),
  1475. .product(
  1476. name: "abseil",
  1477. package: "abseil-cpp-binary",
  1478. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1479. ),
  1480. .product(
  1481. name: "gRPC-C++",
  1482. package: "grpc-binary",
  1483. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1484. ),
  1485. .product(name: "nanopb", package: "nanopb"),
  1486. "FirebaseAppCheckInterop",
  1487. "FirebaseCore",
  1488. "FirebaseCoreExtension",
  1489. "leveldb",
  1490. "FirebaseSharedSwift",
  1491. ],
  1492. path: "Firestore/Swift/Source",
  1493. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  1494. linkerSettings: [
  1495. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  1496. .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS])),
  1497. .linkedLibrary("c++"),
  1498. ]
  1499. ),
  1500. .target(
  1501. name: "FirebaseFirestoreInternalWrapper",
  1502. dependencies: [.target(
  1503. name: "FirebaseFirestoreInternal",
  1504. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1505. )],
  1506. path: "FirebaseFirestoreInternal",
  1507. publicHeadersPath: "."
  1508. ),
  1509. firestoreInternalTarget,
  1510. ]
  1511. }