Package.swift 49 KB

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