Package.swift 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358
  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 PackageDescription
  18. import class Foundation.ProcessInfo
  19. let firebaseVersion = "10.11.0"
  20. let package = Package(
  21. name: "Firebase",
  22. platforms: [.iOS(.v11), .macCatalyst(.v13), .macOS(.v10_13), .tvOS(.v12), .watchOS(.v7)],
  23. products: [
  24. .library(
  25. name: "FirebaseAnalytics",
  26. targets: ["FirebaseAnalyticsTarget"]
  27. ),
  28. // This library is not designed to be imported into client source code.
  29. .library(
  30. name: "FirebaseAnalyticsWithoutAdIdSupport",
  31. targets: ["FirebaseAnalyticsWithoutAdIdSupportTarget"]
  32. ),
  33. // This library is not designed to be imported into client source code.
  34. .library(
  35. name: "FirebaseAnalyticsOnDeviceConversion",
  36. targets: ["FirebaseAnalyticsOnDeviceConversionTarget"]
  37. ),
  38. .library(
  39. name: "FirebaseAnalyticsSwift",
  40. targets: ["FirebaseAnalyticsSwiftTarget"]
  41. ),
  42. .library(
  43. name: "FirebaseAuth",
  44. targets: ["FirebaseAuth"]
  45. ),
  46. .library(
  47. name: "FirebaseAppCheck",
  48. targets: ["FirebaseAppCheck"]
  49. ),
  50. .library(
  51. name: "FirebaseAppDistribution-Beta",
  52. targets: ["FirebaseAppDistributionTarget"]
  53. ),
  54. .library(
  55. name: "FirebaseAuthCombine-Community",
  56. targets: ["FirebaseAuthCombineSwift"]
  57. ),
  58. .library(
  59. name: "FirebaseFirestoreCombine-Community",
  60. targets: ["FirebaseFirestoreCombineSwift"]
  61. ),
  62. .library(
  63. name: "FirebaseFunctionsCombine-Community",
  64. targets: ["FirebaseFunctionsCombineSwift"]
  65. ),
  66. .library(
  67. name: "FirebaseStorageCombine-Community",
  68. targets: ["FirebaseStorageCombineSwift"]
  69. ),
  70. .library(
  71. name: "FirebaseCrashlytics",
  72. targets: ["FirebaseCrashlytics"]
  73. ),
  74. .library(
  75. name: "FirebaseDatabase",
  76. targets: ["FirebaseDatabase"]
  77. ),
  78. .library(
  79. name: "FirebaseDatabaseSwift",
  80. targets: ["FirebaseDatabaseSwift"]
  81. ),
  82. .library(
  83. name: "FirebaseDynamicLinks",
  84. targets: ["FirebaseDynamicLinksTarget"]
  85. ),
  86. .library(
  87. name: "FirebaseFirestore",
  88. targets: ["FirebaseFirestoreTarget"]
  89. ),
  90. .library(
  91. name: "FirebaseFirestoreSwift",
  92. targets: ["FirebaseFirestoreSwiftTarget"]
  93. ),
  94. .library(
  95. name: "FirebaseFunctions",
  96. targets: ["FirebaseFunctions"]
  97. ),
  98. .library(
  99. name: "FirebaseInAppMessaging-Beta",
  100. targets: ["FirebaseInAppMessagingTarget"]
  101. ),
  102. .library(
  103. name: "FirebaseInAppMessagingSwift-Beta",
  104. targets: ["FirebaseInAppMessagingSwift"]
  105. ),
  106. .library(
  107. name: "FirebaseInstallations",
  108. targets: ["FirebaseInstallations"]
  109. ),
  110. .library(
  111. name: "FirebaseMessaging",
  112. targets: ["FirebaseMessaging"]
  113. ),
  114. .library(
  115. name: "FirebaseMLModelDownloader",
  116. targets: ["FirebaseMLModelDownloader"]
  117. ),
  118. .library(
  119. name: "FirebasePerformance",
  120. targets: ["FirebasePerformanceTarget"]
  121. ),
  122. .library(
  123. name: "FirebaseRemoteConfig",
  124. targets: ["FirebaseRemoteConfig"]
  125. ),
  126. .library(
  127. name: "FirebaseRemoteConfigSwift",
  128. targets: ["FirebaseRemoteConfigSwift"]
  129. ),
  130. .library(
  131. name: "FirebaseStorage",
  132. targets: ["FirebaseStorage"]
  133. ),
  134. ],
  135. dependencies: [
  136. .package(
  137. url: "https://github.com/google/promises.git",
  138. "2.1.0" ..< "3.0.0"
  139. ),
  140. .package(
  141. url: "https://github.com/apple/swift-protobuf.git",
  142. "1.19.0" ..< "2.0.0"
  143. ),
  144. googleAppMeasurementDependency(),
  145. .package(
  146. url: "https://github.com/google/GoogleDataTransport.git",
  147. "9.2.0" ..< "10.0.0"
  148. ),
  149. .package(
  150. url: "https://github.com/google/GoogleUtilities.git",
  151. "7.11.0" ..< "8.0.0"
  152. ),
  153. .package(
  154. url: "https://github.com/google/gtm-session-fetcher.git",
  155. "2.1.0" ..< "4.0.0"
  156. ),
  157. .package(
  158. url: "https://github.com/firebase/nanopb.git",
  159. "2.30909.0" ..< "2.30910.0"
  160. ),
  161. .package(
  162. url: "https://github.com/google/abseil-cpp-binary.git",
  163. "1.2022062300.0" ..< "1.2022062400.0"
  164. ),
  165. .package(
  166. url: "https://github.com/google/grpc-binary.git",
  167. "1.50.1" ..< "1.51.0"
  168. ),
  169. .package(
  170. url: "https://github.com/erikdoe/ocmock.git",
  171. revision: "c5eeaa6dde7c308a5ce48ae4d4530462dd3a1110"
  172. ),
  173. .package(
  174. url: "https://github.com/firebase/leveldb.git",
  175. "1.22.2" ..< "1.23.0"
  176. ),
  177. .package(
  178. url: "https://github.com/SlaunchaMan/GCDWebServer.git",
  179. revision: "935e2736044e71e5341663c3cc9a335ba6867a2b"
  180. ),
  181. ],
  182. targets: [
  183. .target(
  184. name: "Firebase",
  185. path: "CoreOnly/Sources",
  186. publicHeadersPath: "./"
  187. ),
  188. .target(
  189. name: "FirebaseCore",
  190. dependencies: [
  191. "Firebase",
  192. "FirebaseCoreInternal",
  193. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  194. .product(name: "GULLogger", package: "GoogleUtilities"),
  195. ],
  196. path: "FirebaseCore/Sources",
  197. publicHeadersPath: "Public",
  198. cSettings: [
  199. .headerSearchPath("../.."),
  200. .define("Firebase_VERSION", to: firebaseVersion),
  201. // TODO: - Add support for cflags cSetting so that we can set the -fno-autolink option
  202. ],
  203. linkerSettings: [
  204. .linkedFramework("UIKit", .when(platforms: [.iOS, .macCatalyst, .tvOS])),
  205. .linkedFramework("AppKit", .when(platforms: [.macOS])),
  206. ]
  207. ),
  208. .testTarget(
  209. name: "CoreUnit",
  210. dependencies: [
  211. "FirebaseCore",
  212. "SharedTestUtilities",
  213. "HeartbeatLoggingTestUtils",
  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. .target(
  244. name: "HeartbeatLoggingTestUtils",
  245. dependencies: ["FirebaseCoreInternal"],
  246. path: "HeartbeatLoggingTestUtils/Sources"
  247. ),
  248. .testTarget(
  249. name: "FirebaseCoreInternalTests",
  250. dependencies: [
  251. "FirebaseCoreInternal",
  252. "HeartbeatLoggingTestUtils",
  253. ],
  254. path: "FirebaseCore/Internal/Tests"
  255. ),
  256. .target(
  257. name: "FirebaseABTesting",
  258. dependencies: ["FirebaseCore"],
  259. path: "FirebaseABTesting/Sources",
  260. publicHeadersPath: "Public",
  261. cSettings: [
  262. .headerSearchPath("../../"),
  263. ]
  264. ),
  265. .testTarget(
  266. name: "ABTestingUnit",
  267. dependencies: ["FirebaseABTesting", .product(name: "OCMock", package: "ocmock")],
  268. path: "FirebaseABTesting/Tests/Unit",
  269. resources: [.process("Resources")],
  270. cSettings: [
  271. .headerSearchPath("../../.."),
  272. ]
  273. ),
  274. .target(
  275. name: "FirebaseAnalyticsTarget",
  276. dependencies: [.target(name: "FirebaseAnalyticsWrapper",
  277. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS]))],
  278. path: "SwiftPM-PlatformExclude/FirebaseAnalyticsWrap"
  279. ),
  280. .target(
  281. name: "FirebaseAnalyticsWrapper",
  282. dependencies: [
  283. .target(
  284. name: "FirebaseAnalytics",
  285. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  286. ),
  287. .product(name: "GoogleAppMeasurement",
  288. package: "GoogleAppMeasurement",
  289. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])),
  290. "FirebaseCore",
  291. "FirebaseInstallations",
  292. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  293. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  294. .product(name: "GULNSData", package: "GoogleUtilities"),
  295. .product(name: "GULNetwork", package: "GoogleUtilities"),
  296. .product(name: "nanopb", package: "nanopb"),
  297. ],
  298. path: "FirebaseAnalyticsWrapper",
  299. linkerSettings: [
  300. .linkedLibrary("sqlite3"),
  301. .linkedLibrary("c++"),
  302. .linkedLibrary("z"),
  303. .linkedFramework("StoreKit"),
  304. ]
  305. ),
  306. .binaryTarget(
  307. name: "FirebaseAnalytics",
  308. url: "https://dl.google.com/firebase/ios/swiftpm/10.10.0/FirebaseAnalytics.zip",
  309. checksum: "335d26f7cc88f2bb9196826344ff772f762ce0cc8a1918dfaa79282424bbab5c"
  310. ),
  311. .target(
  312. name: "FirebaseAnalyticsSwiftTarget",
  313. dependencies: [.target(name: "FirebaseAnalyticsSwift",
  314. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS]))],
  315. path: "SwiftPM-PlatformExclude/FirebaseAnalyticsSwiftWrap"
  316. ),
  317. .target(
  318. name: "FirebaseAnalyticsSwift",
  319. dependencies: ["FirebaseAnalyticsWrapper"],
  320. path: "FirebaseAnalyticsSwift/Sources"
  321. ),
  322. .testTarget(
  323. name: "AnalyticsSwiftUnit",
  324. dependencies: ["FirebaseAnalyticsSwift"],
  325. path: "FirebaseAnalyticsSwift/Tests/SwiftUnit"
  326. ),
  327. .testTarget(
  328. name: "AnalyticsObjCAPI",
  329. dependencies: ["FirebaseAnalyticsSwift"],
  330. path: "FirebaseAnalyticsSwift/Tests/ObjCAPI"
  331. ),
  332. .target(
  333. name: "FirebaseAnalyticsWithoutAdIdSupportTarget",
  334. dependencies: [.target(name: "FirebaseAnalyticsWithoutAdIdSupportWrapper",
  335. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS]))],
  336. path: "SwiftPM-PlatformExclude/FirebaseAnalyticsWithoutAdIdSupportWrap"
  337. ),
  338. .target(
  339. name: "FirebaseAnalyticsWithoutAdIdSupportWrapper",
  340. dependencies: [
  341. .target(
  342. name: "FirebaseAnalytics",
  343. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  344. ),
  345. .product(name: "GoogleAppMeasurementWithoutAdIdSupport",
  346. package: "GoogleAppMeasurement",
  347. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])),
  348. "FirebaseCore",
  349. "FirebaseInstallations",
  350. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  351. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  352. .product(name: "GULNSData", package: "GoogleUtilities"),
  353. .product(name: "GULNetwork", package: "GoogleUtilities"),
  354. .product(name: "nanopb", package: "nanopb"),
  355. ],
  356. path: "FirebaseAnalyticsWithoutAdIdSupportWrapper",
  357. linkerSettings: [
  358. .linkedLibrary("sqlite3"),
  359. .linkedLibrary("c++"),
  360. .linkedLibrary("z"),
  361. .linkedFramework("StoreKit"),
  362. ]
  363. ),
  364. .target(
  365. name: "FirebaseAnalyticsOnDeviceConversionTarget",
  366. dependencies: [
  367. .product(name: "GoogleAppMeasurementOnDeviceConversion",
  368. package: "GoogleAppMeasurement",
  369. condition: .when(platforms: [.iOS])),
  370. ],
  371. path: "FirebaseAnalyticsOnDeviceConversionWrapper",
  372. linkerSettings: [
  373. .linkedLibrary("c++"),
  374. ]
  375. ),
  376. .target(
  377. name: "FirebaseAppDistributionTarget",
  378. dependencies: [.target(name: "FirebaseAppDistribution",
  379. condition: .when(platforms: [.iOS]))],
  380. path: "SwiftPM-PlatformExclude/FirebaseAppDistributionWrap"
  381. ),
  382. .target(
  383. name: "FirebaseAppDistribution",
  384. dependencies: [
  385. "FirebaseCore",
  386. "FirebaseInstallations",
  387. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  388. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  389. ],
  390. path: "FirebaseAppDistribution/Sources",
  391. publicHeadersPath: "Public",
  392. cSettings: [
  393. .headerSearchPath("../../"),
  394. ]
  395. ),
  396. .testTarget(
  397. name: "AppDistributionUnit",
  398. dependencies: ["FirebaseAppDistribution", .product(name: "OCMock", package: "ocmock")],
  399. path: "FirebaseAppDistribution/Tests/Unit",
  400. exclude: ["Swift/"],
  401. resources: [.process("Resources")],
  402. cSettings: [
  403. .headerSearchPath("../../.."),
  404. ]
  405. ),
  406. .testTarget(
  407. name: "AppDistributionUnitSwift",
  408. dependencies: ["FirebaseAppDistribution"],
  409. path: "FirebaseAppDistribution/Tests/Unit/Swift",
  410. cSettings: [
  411. .headerSearchPath("../../../.."),
  412. ]
  413. ),
  414. .target(
  415. name: "FirebaseAuth",
  416. dependencies: [
  417. "FirebaseCore",
  418. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  419. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  420. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  421. ],
  422. path: "FirebaseAuth/Sources",
  423. publicHeadersPath: "Public",
  424. cSettings: [
  425. .headerSearchPath("../../"),
  426. ],
  427. linkerSettings: [
  428. .linkedFramework("Security"),
  429. .linkedFramework("SafariServices", .when(platforms: [.iOS])),
  430. ]
  431. ),
  432. // Internal headers only for consuming from Swift.
  433. .target(
  434. name: "FirebaseAuthInterop",
  435. path: "FirebaseAuth/Interop",
  436. exclude: [
  437. "CMakeLists.txt",
  438. ],
  439. publicHeadersPath: ".",
  440. cSettings: [
  441. .headerSearchPath("../../"),
  442. ]
  443. ),
  444. .testTarget(
  445. name: "AuthUnit",
  446. dependencies: [
  447. "FirebaseAuth",
  448. "HeartbeatLoggingTestUtils",
  449. .product(name: "OCMock", package: "ocmock"),
  450. ],
  451. path: "FirebaseAuth/Tests/Unit",
  452. exclude: [
  453. "FIRAuthKeychainServicesTests.m", // TODO: figure out SPM keychain testing
  454. "FIRAuthTests.m",
  455. "FIRUserTests.m",
  456. ],
  457. cSettings: [
  458. .headerSearchPath("../../.."),
  459. ]
  460. ),
  461. .target(
  462. name: "FirebaseAuthCombineSwift",
  463. dependencies: ["FirebaseAuth"],
  464. path: "FirebaseCombineSwift/Sources/Auth"
  465. ),
  466. .target(
  467. name: "FirebaseFirestoreCombineSwift",
  468. dependencies: [
  469. "FirebaseFirestoreTarget",
  470. "FirebaseFirestoreSwift",
  471. ],
  472. path: "FirebaseCombineSwift/Sources/Firestore"
  473. ),
  474. .target(
  475. name: "FirebaseStorageCombineSwift",
  476. dependencies: [
  477. "FirebaseStorage",
  478. ],
  479. path: "FirebaseCombineSwift/Sources/Storage"
  480. ),
  481. .target(
  482. name: "FirebaseCrashlytics",
  483. dependencies: ["FirebaseCore", "FirebaseInstallations", "FirebaseSessions",
  484. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  485. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  486. .product(name: "FBLPromises", package: "Promises"),
  487. .product(name: "nanopb", package: "nanopb")],
  488. path: "Crashlytics",
  489. exclude: [
  490. "run",
  491. "CHANGELOG.md",
  492. "LICENSE",
  493. "README.md",
  494. "ProtoSupport/",
  495. "UnitTests/",
  496. "generate_project.sh",
  497. "upload-symbols",
  498. "third_party/libunwind/LICENSE",
  499. ],
  500. sources: [
  501. "Crashlytics/",
  502. "Protogen/",
  503. "Shared/",
  504. "third_party/libunwind/dwarf.h",
  505. ],
  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. .testTarget(
  528. name: "FirebaseCrashlyticsUnit",
  529. dependencies: ["FirebaseCrashlytics", .product(name: "OCMock", package: "ocmock")],
  530. path: "Crashlytics/UnitTests",
  531. resources: [
  532. .copy("FIRCLSMachO/machO_data"),
  533. .copy("Data"),
  534. ],
  535. cSettings: [
  536. .headerSearchPath("../.."),
  537. .define("DISPLAY_VERSION", to: firebaseVersion),
  538. .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])),
  539. .define(
  540. "CLS_SDK_NAME",
  541. to: "Crashlytics macOS SDK",
  542. .when(platforms: [.macOS, .macCatalyst])
  543. ),
  544. .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])),
  545. .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])),
  546. ]
  547. ),
  548. .target(
  549. name: "FirebaseDatabase",
  550. dependencies: [
  551. "FirebaseCore",
  552. "leveldb",
  553. ],
  554. path: "FirebaseDatabase/Sources",
  555. exclude: [
  556. "third_party/Wrap-leveldb/LICENSE",
  557. "third_party/SocketRocket/LICENSE",
  558. "third_party/FImmutableSortedDictionary/LICENSE",
  559. "third_party/SocketRocket/aa2297808c225710e267afece4439c256f6efdb3",
  560. ],
  561. publicHeadersPath: "Public",
  562. cSettings: [
  563. .headerSearchPath("../../"),
  564. ],
  565. linkerSettings: [
  566. .linkedFramework("CFNetwork"),
  567. .linkedFramework("Security"),
  568. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  569. .linkedFramework("WatchKit", .when(platforms: [.watchOS])),
  570. ]
  571. ),
  572. .testTarget(
  573. name: "DatabaseUnit",
  574. dependencies: [
  575. "FirebaseDatabase",
  576. "SharedTestUtilities",
  577. .product(name: "OCMock", package: "ocmock"),
  578. ],
  579. path: "FirebaseDatabase/Tests/",
  580. exclude: [
  581. // Disable Swift tests as mixed targets are not supported (Xcode 12.4).
  582. "Unit/Swift",
  583. "Integration/",
  584. ],
  585. resources: [.process("Resources")],
  586. cSettings: [
  587. .headerSearchPath("../.."),
  588. ]
  589. ),
  590. .testTarget(
  591. name: "DatabaseUnitSwift",
  592. dependencies: ["FirebaseDatabase"],
  593. path: "FirebaseDatabase/Tests/Unit/Swift",
  594. cSettings: [
  595. .headerSearchPath("../.."),
  596. ]
  597. ),
  598. .target(
  599. name: "FirebaseDatabaseSwift",
  600. dependencies: ["FirebaseDatabase", "FirebaseSharedSwift"],
  601. path: "FirebaseDatabaseSwift/Sources"
  602. ),
  603. .testTarget(
  604. name: "FirebaseDatabaseSwiftTests",
  605. dependencies: ["FirebaseDatabase", "FirebaseDatabaseSwift"],
  606. path: "FirebaseDatabaseSwift/Tests/"
  607. ),
  608. .target(
  609. name: "FirebaseSharedSwift",
  610. path: "FirebaseSharedSwift/Sources",
  611. exclude: [
  612. "third_party/FirebaseDataEncoder/LICENSE",
  613. "third_party/FirebaseDataEncoder/METADATA",
  614. ]
  615. ),
  616. .testTarget(
  617. name: "FirebaseSharedSwiftTests",
  618. dependencies: ["FirebaseSharedSwift"],
  619. path: "FirebaseSharedSwift/Tests/"
  620. ),
  621. .target(
  622. name: "FirebaseDynamicLinksTarget",
  623. dependencies: [.target(name: "FirebaseDynamicLinks",
  624. condition: .when(platforms: [.iOS]))],
  625. path: "SwiftPM-PlatformExclude/FirebaseDynamicLinksWrap"
  626. ),
  627. .target(
  628. name: "FirebaseDynamicLinks",
  629. dependencies: ["FirebaseCore"],
  630. path: "FirebaseDynamicLinks/Sources",
  631. publicHeadersPath: "Public",
  632. cSettings: [
  633. .headerSearchPath("../../"),
  634. .define("FIRDynamicLinks3P", to: "1"),
  635. .define("GIN_SCION_LOGGING", to: "1"),
  636. ],
  637. linkerSettings: [
  638. .linkedFramework("QuartzCore"),
  639. ]
  640. ),
  641. .target(
  642. name: "FirebaseFirestoreTarget",
  643. dependencies: [
  644. .target(
  645. name: "FirebaseFirestore",
  646. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  647. ),
  648. .product(name: "abseil", package: "abseil-cpp-binary"),
  649. .product(name: "gRPC-C++", package: "grpc-binary"),
  650. .product(name: "nanopb", package: "nanopb"),
  651. "FirebaseCore",
  652. "leveldb",
  653. ],
  654. path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap",
  655. linkerSettings: [
  656. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  657. .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS])),
  658. .linkedLibrary("c++"),
  659. ]
  660. ),
  661. .binaryTarget(
  662. name: "FirebaseFirestore",
  663. url: "https://dl.google.com/firebase/ios/bin/firestore/10.10.0/FirebaseFirestore.zip",
  664. checksum: "4a0070c4bf7e5ab59359dd8a0e68f402f3ec6c1e189fc39cc44ca88418f26ac4"
  665. ),
  666. .target(
  667. name: "FirebaseFirestoreSwiftTarget",
  668. dependencies: [.target(name: "FirebaseFirestoreSwift",
  669. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS]))],
  670. path: "SwiftPM-PlatformExclude/FirebaseFirestoreSwiftWrap"
  671. ),
  672. .target(
  673. name: "FirebaseFirestoreSwift",
  674. dependencies: [
  675. "FirebaseCore",
  676. "FirebaseCoreExtension",
  677. "FirebaseFirestoreTarget",
  678. "FirebaseSharedSwift",
  679. ],
  680. path: "Firestore",
  681. exclude: [
  682. "CHANGELOG.md",
  683. "CMakeLists.txt",
  684. "Example/",
  685. "LICENSE",
  686. "Protos/",
  687. "README.md",
  688. "Source/",
  689. "core/",
  690. "fuzzing/",
  691. "test.sh",
  692. "Swift/CHANGELOG.md",
  693. "Swift/README.md",
  694. "Swift/Tests/",
  695. "third_party/nlohmann_json",
  696. ],
  697. sources: [
  698. "Swift/Source/",
  699. ]
  700. ),
  701. // MARK: - Firebase Functions
  702. .target(
  703. name: "FirebaseFunctions",
  704. dependencies: [
  705. "FirebaseAppCheckInterop",
  706. "FirebaseAuthInterop",
  707. "FirebaseCore",
  708. "FirebaseCoreExtension",
  709. "FirebaseMessagingInterop",
  710. "FirebaseSharedSwift",
  711. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  712. ],
  713. path: "FirebaseFunctions/Sources"
  714. ),
  715. .testTarget(
  716. name: "FirebaseFunctionsUnit",
  717. dependencies: ["FirebaseFunctions",
  718. "FirebaseAppCheckInterop",
  719. "FirebaseAuthInterop",
  720. "FirebaseMessagingInterop",
  721. "SharedTestUtilities"],
  722. path: "FirebaseFunctions/Tests/Unit",
  723. cSettings: [
  724. .headerSearchPath("../../../"),
  725. ]
  726. ),
  727. .testTarget(
  728. name: "FirebaseFunctionsIntegration",
  729. dependencies: ["FirebaseFunctions",
  730. "SharedTestUtilities"],
  731. path: "FirebaseFunctions/Tests/Integration"
  732. ),
  733. .testTarget(
  734. name: "FirebaseFunctionsObjCIntegration",
  735. dependencies: ["FirebaseFunctions",
  736. "SharedTestUtilities"],
  737. path: "FirebaseFunctions/Tests/ObjCIntegration",
  738. // See https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730
  739. exclude: [
  740. "ObjCPPAPITests.mm",
  741. ],
  742. cSettings: [
  743. .headerSearchPath("../../.."),
  744. ]
  745. ),
  746. .target(
  747. name: "FirebaseFunctionsCombineSwift",
  748. dependencies: ["FirebaseFunctions"],
  749. path: "FirebaseCombineSwift/Sources/Functions"
  750. ),
  751. .testTarget(
  752. name: "FunctionsCombineUnit",
  753. dependencies: ["FirebaseFunctionsCombineSwift",
  754. "SharedTestUtilities"],
  755. path: "FirebaseFunctions/Tests/CombineUnit"
  756. ),
  757. // MARK: - Firebase In App Messaging
  758. .target(
  759. name: "FirebaseInAppMessagingTarget",
  760. dependencies: [
  761. .target(name: "FirebaseInAppMessaging", condition: .when(platforms: [.iOS, .tvOS])),
  762. ],
  763. path: "SwiftPM-PlatformExclude/FirebaseInAppMessagingWrap"
  764. ),
  765. .target(
  766. name: "FirebaseInAppMessaging",
  767. dependencies: [
  768. "FirebaseCore",
  769. "FirebaseInstallations",
  770. "FirebaseABTesting",
  771. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  772. .product(name: "nanopb", package: "nanopb"),
  773. .target(name: "FirebaseInAppMessaging_iOS", condition: .when(platforms: [.iOS])),
  774. ],
  775. path: "FirebaseInAppMessaging/Sources",
  776. exclude: [
  777. "DefaultUI/CHANGELOG.md",
  778. "DefaultUI/README.md",
  779. ],
  780. publicHeadersPath: "Public",
  781. cSettings: [
  782. .headerSearchPath("../../"),
  783. .define("PB_FIELD_32BIT", to: "1"),
  784. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  785. .define("PB_ENABLE_MALLOC", to: "1"),
  786. ]
  787. ),
  788. .target(
  789. name: "FirebaseInAppMessaging_iOS",
  790. path: "FirebaseInAppMessaging/iOS",
  791. resources: [.process("Resources")]
  792. ),
  793. .target(
  794. name: "FirebaseInAppMessagingSwift",
  795. dependencies: ["FirebaseInAppMessaging"],
  796. path: "FirebaseInAppMessaging/Swift/Source"
  797. ),
  798. .target(
  799. name: "FirebaseInstallations",
  800. dependencies: [
  801. "FirebaseCore",
  802. .product(name: "FBLPromises", package: "Promises"),
  803. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  804. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  805. ],
  806. path: "FirebaseInstallations/Source/Library",
  807. publicHeadersPath: "Public",
  808. cSettings: [
  809. .headerSearchPath("../../../"),
  810. ],
  811. linkerSettings: [
  812. .linkedFramework("Security"),
  813. ]
  814. ),
  815. .target(
  816. name: "FirebaseMLModelDownloader",
  817. dependencies: [
  818. "FirebaseCore",
  819. "FirebaseInstallations",
  820. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  821. .product(name: "GULLogger", package: "GoogleUtilities"),
  822. .product(name: "SwiftProtobuf", package: "swift-protobuf"),
  823. ],
  824. path: "FirebaseMLModelDownloader/Sources",
  825. exclude: [
  826. "proto/firebase_ml_log_sdk.proto",
  827. ],
  828. cSettings: [
  829. .define("FIRMLModelDownloader_VERSION", to: firebaseVersion),
  830. ]
  831. ),
  832. .testTarget(
  833. name: "FirebaseMLModelDownloaderUnit",
  834. dependencies: ["FirebaseMLModelDownloader"],
  835. path: "FirebaseMLModelDownloader/Tests/Unit"
  836. ),
  837. .target(
  838. name: "FirebaseMessaging",
  839. dependencies: [
  840. "FirebaseCore",
  841. "FirebaseInstallations",
  842. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  843. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  844. .product(name: "GULReachability", package: "GoogleUtilities"),
  845. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  846. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  847. .product(name: "nanopb", package: "nanopb"),
  848. ],
  849. path: "FirebaseMessaging/Sources",
  850. publicHeadersPath: "Public",
  851. cSettings: [
  852. .headerSearchPath("../../"),
  853. .define("PB_FIELD_32BIT", to: "1"),
  854. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  855. .define("PB_ENABLE_MALLOC", to: "1"),
  856. ],
  857. linkerSettings: [
  858. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  859. ]
  860. ),
  861. // Internal headers only for consuming from Swift.
  862. .target(
  863. name: "FirebaseMessagingInterop",
  864. path: "FirebaseMessaging/Interop",
  865. publicHeadersPath: ".",
  866. cSettings: [
  867. .headerSearchPath("../../"),
  868. ]
  869. ),
  870. .testTarget(
  871. name: "MessagingUnit",
  872. dependencies: [
  873. "FirebaseMessaging",
  874. "SharedTestUtilities",
  875. .product(name: "OCMock", package: "ocmock"),
  876. ],
  877. path: "FirebaseMessaging/Tests/UnitTests",
  878. exclude: [
  879. "FIRMessagingContextManagerServiceTest.m", // TODO: Adapt its NSBundle usage to SPM.
  880. ],
  881. cSettings: [
  882. .headerSearchPath("../../.."),
  883. ]
  884. ),
  885. .target(
  886. name: "FirebasePerformanceTarget",
  887. dependencies: [.target(name: "FirebasePerformance",
  888. condition: .when(platforms: [.iOS, .tvOS]))],
  889. path: "SwiftPM-PlatformExclude/FirebasePerformanceWrap"
  890. ),
  891. .target(
  892. name: "FirebasePerformance",
  893. dependencies: [
  894. "FirebaseCore",
  895. "FirebaseInstallations",
  896. "FirebaseRemoteConfig",
  897. "FirebaseSessions",
  898. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  899. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  900. .product(name: "GULISASwizzler", package: "GoogleUtilities"),
  901. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  902. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  903. .product(name: "nanopb", package: "nanopb"),
  904. ],
  905. path: "FirebasePerformance/Sources",
  906. publicHeadersPath: "Public",
  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. .define("FIRPerformance_LIB_VERSION", to: firebaseVersion),
  913. ],
  914. linkerSettings: [
  915. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .tvOS])),
  916. .linkedFramework("MobileCoreServices", .when(platforms: [.iOS, .tvOS])),
  917. .linkedFramework("QuartzCore", .when(platforms: [.iOS, .tvOS])),
  918. ]
  919. ),
  920. .testTarget(
  921. name: "PerformanceUnit",
  922. dependencies: [
  923. "FirebasePerformanceTarget",
  924. "SharedTestUtilities",
  925. "GCDWebServer",
  926. .product(name: "OCMock", package: "ocmock"),
  927. ],
  928. path: "FirebasePerformance/Tests/Unit",
  929. resources: [
  930. .process("FPRURLFilterTests-Info.plist"),
  931. .process("Server/smallDownloadFile"),
  932. .process("Server/bigDownloadFile"),
  933. ],
  934. cSettings: [
  935. .headerSearchPath("../../.."),
  936. .define("PB_FIELD_32BIT", to: "1"),
  937. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  938. .define("PB_ENABLE_MALLOC", to: "1"),
  939. ]
  940. ),
  941. .target(
  942. name: "SharedTestUtilities",
  943. dependencies: ["FirebaseCore",
  944. "FirebaseAppCheckInterop",
  945. "FirebaseAuthInterop",
  946. "FirebaseMessagingInterop",
  947. "GoogleDataTransport",
  948. .product(name: "OCMock", package: "ocmock")],
  949. path: "SharedTestUtilities",
  950. publicHeadersPath: "./",
  951. cSettings: [
  952. .headerSearchPath("../"),
  953. ]
  954. ),
  955. // MARK: - Firebase Remote Config
  956. .target(
  957. name: "FirebaseRemoteConfig",
  958. dependencies: [
  959. "FirebaseCore",
  960. "FirebaseABTesting",
  961. "FirebaseInstallations",
  962. .product(name: "GULNSData", package: "GoogleUtilities"),
  963. ],
  964. path: "FirebaseRemoteConfig/Sources",
  965. publicHeadersPath: "Public",
  966. cSettings: [
  967. .headerSearchPath("../../"),
  968. ]
  969. ),
  970. .testTarget(
  971. name: "RemoteConfigUnit",
  972. dependencies: ["FirebaseRemoteConfig", .product(name: "OCMock", package: "ocmock")],
  973. path: "FirebaseRemoteConfig/Tests/Unit",
  974. exclude: [
  975. // Need to be evaluated/ported to RC V2.
  976. "RCNConfigAnalyticsTest.m",
  977. "RCNConfigSettingsTest.m",
  978. "RCNConfigTest.m",
  979. "RCNRemoteConfig+FIRAppTest.m",
  980. "RCNThrottlingTests.m",
  981. ],
  982. resources: [
  983. .process("SecondApp-GoogleService-Info.plist"),
  984. .process("Defaults-testInfo.plist"),
  985. .process("TestABTPayload.txt"),
  986. ],
  987. cSettings: [
  988. .headerSearchPath("../../.."),
  989. ]
  990. ),
  991. .target(
  992. name: "FirebaseRemoteConfigSwift",
  993. dependencies: [
  994. "FirebaseRemoteConfig",
  995. "FirebaseSharedSwift",
  996. ],
  997. path: "FirebaseRemoteConfigSwift/Sources"
  998. ),
  999. .testTarget(
  1000. name: "RemoteConfigFakeConsole",
  1001. dependencies: ["FirebaseRemoteConfigSwift",
  1002. "RemoteConfigFakeConsoleObjC"],
  1003. path: "FirebaseRemoteConfigSwift/Tests",
  1004. exclude: [
  1005. "AccessToken.json",
  1006. "README.md",
  1007. "ObjC/",
  1008. ],
  1009. resources: [
  1010. .process("Defaults-testInfo.plist"),
  1011. ],
  1012. cSettings: [
  1013. .headerSearchPath("../../"),
  1014. ]
  1015. ),
  1016. .target(
  1017. name: "RemoteConfigFakeConsoleObjC",
  1018. dependencies: [.product(name: "OCMock", package: "ocmock")],
  1019. path: "FirebaseRemoteConfigSwift/Tests/ObjC",
  1020. publicHeadersPath: ".",
  1021. cSettings: [
  1022. .headerSearchPath("../../../"),
  1023. ]
  1024. ),
  1025. // MARK: - Firebase Sessions
  1026. .target(
  1027. name: "FirebaseSessions",
  1028. dependencies: [
  1029. "FirebaseCore",
  1030. "FirebaseInstallations",
  1031. "FirebaseCoreExtension",
  1032. "FirebaseSessionsObjC",
  1033. .product(name: "Promises", package: "Promises"),
  1034. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  1035. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1036. ],
  1037. path: "FirebaseSessions/Sources",
  1038. cSettings: [
  1039. .headerSearchPath(".."),
  1040. .define("DISPLAY_VERSION", to: firebaseVersion),
  1041. .define("PB_FIELD_32BIT", to: "1"),
  1042. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1043. .define("PB_ENABLE_MALLOC", to: "1"),
  1044. ],
  1045. linkerSettings: [
  1046. .linkedFramework("Security"),
  1047. .linkedFramework(
  1048. "SystemConfiguration",
  1049. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1050. ),
  1051. ]
  1052. ),
  1053. // The Sessions SDK is Swift-first with Objective-C code to support
  1054. // nanopb. Because Swift Package Manager doesn't support mixed
  1055. // language targets, the ObjC code has been extracted out into
  1056. // a separate target.
  1057. .target(
  1058. name: "FirebaseSessionsObjC",
  1059. dependencies: [
  1060. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1061. .product(name: "nanopb", package: "nanopb"),
  1062. ],
  1063. path: "FirebaseSessions",
  1064. exclude: [
  1065. "README.md",
  1066. "Sources/",
  1067. "Tests/",
  1068. "ProtoSupport/",
  1069. "generate_project.sh",
  1070. "generate_protos.sh",
  1071. "generate_testapp.sh",
  1072. ],
  1073. publicHeadersPath: "SourcesObjC",
  1074. cSettings: [
  1075. .headerSearchPath(".."),
  1076. .define("DISPLAY_VERSION", to: firebaseVersion),
  1077. .define("PB_FIELD_32BIT", to: "1"),
  1078. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1079. .define("PB_ENABLE_MALLOC", to: "1"),
  1080. ],
  1081. linkerSettings: [
  1082. .linkedFramework("Security"),
  1083. .linkedFramework(
  1084. "SystemConfiguration",
  1085. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1086. ),
  1087. ]
  1088. ),
  1089. .testTarget(
  1090. name: "FirebaseSessionsUnit",
  1091. dependencies: ["FirebaseSessions"],
  1092. path: "FirebaseSessions/Tests/Unit"
  1093. ),
  1094. // MARK: - Firebase Storage
  1095. .target(
  1096. name: "FirebaseStorage",
  1097. dependencies: [
  1098. "FirebaseAppCheckInterop",
  1099. "FirebaseAuthInterop",
  1100. "FirebaseCore",
  1101. "FirebaseCoreExtension",
  1102. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  1103. ],
  1104. path: "FirebaseStorage/Sources"
  1105. ),
  1106. .testTarget(
  1107. name: "FirebaseStorageUnit",
  1108. dependencies: ["FirebaseStorage",
  1109. "SharedTestUtilities"],
  1110. path: "FirebaseStorage/Tests/Unit",
  1111. cSettings: [
  1112. .headerSearchPath("../../../"),
  1113. ]
  1114. ),
  1115. .testTarget(
  1116. name: "StorageObjCIntegration",
  1117. dependencies: ["FirebaseStorage"],
  1118. path: "FirebaseStorage/Tests/ObjCIntegration",
  1119. exclude: [
  1120. // See https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730
  1121. "FIRStorageIntegrationTests.m",
  1122. "ObjCPPAPITests.mm",
  1123. "Credentials.h",
  1124. ],
  1125. cSettings: [
  1126. .headerSearchPath("../../.."),
  1127. ]
  1128. ),
  1129. .testTarget(
  1130. name: "swift-test",
  1131. dependencies: [
  1132. "Firebase",
  1133. "FirebaseAuth",
  1134. "FirebaseAppCheck",
  1135. "FirebaseABTesting",
  1136. "FirebaseAnalytics",
  1137. "FirebaseAnalyticsSwift",
  1138. .target(name: "FirebaseAppDistribution",
  1139. condition: .when(platforms: [.iOS])),
  1140. "FirebaseAuthCombineSwift",
  1141. "FirebaseFirestoreCombineSwift",
  1142. "FirebaseFunctionsCombineSwift",
  1143. "FirebaseStorageCombineSwift",
  1144. "FirebaseCrashlytics",
  1145. "FirebaseCore",
  1146. "FirebaseDatabase",
  1147. "FirebaseDynamicLinks",
  1148. "FirebaseFirestoreTarget",
  1149. "FirebaseFirestoreSwift",
  1150. "FirebaseFunctions",
  1151. "FirebaseInAppMessaging",
  1152. .target(name: "FirebaseInAppMessagingSwift",
  1153. condition: .when(platforms: [.iOS, .tvOS])),
  1154. "FirebaseInstallations",
  1155. "FirebaseMessaging",
  1156. .target(name: "FirebasePerformance",
  1157. condition: .when(platforms: [.iOS, .tvOS])),
  1158. "FirebaseRemoteConfig",
  1159. "FirebaseSessions",
  1160. "FirebaseStorage",
  1161. .product(name: "nanopb", package: "nanopb"),
  1162. ],
  1163. path: "SwiftPMTests/swift-test"
  1164. ),
  1165. .testTarget(
  1166. name: "analytics-import-test",
  1167. dependencies: [
  1168. "FirebaseAnalyticsSwiftTarget",
  1169. "FirebaseAnalyticsWrapper",
  1170. "Firebase",
  1171. ],
  1172. path: "SwiftPMTests/analytics-import-test"
  1173. ),
  1174. .testTarget(
  1175. name: "objc-import-test",
  1176. dependencies: [
  1177. "Firebase",
  1178. "FirebaseAuth",
  1179. "FirebaseABTesting",
  1180. "FirebaseAppCheck",
  1181. .target(name: "FirebaseAppDistribution",
  1182. condition: .when(platforms: [.iOS])),
  1183. "FirebaseCrashlytics",
  1184. "FirebaseCore",
  1185. "FirebaseDatabase",
  1186. "FirebaseDynamicLinks",
  1187. "FirebaseFirestoreTarget",
  1188. "FirebaseFunctions",
  1189. "FirebaseInAppMessaging",
  1190. "FirebaseInstallations",
  1191. "FirebaseMessaging",
  1192. .target(name: "FirebasePerformance",
  1193. condition: .when(platforms: [.iOS, .tvOS])),
  1194. "FirebaseRemoteConfig",
  1195. "FirebaseStorage",
  1196. ],
  1197. path: "SwiftPMTests/objc-import-test"
  1198. ),
  1199. .testTarget(
  1200. name: "version-test",
  1201. dependencies: [
  1202. "FirebaseCore",
  1203. ],
  1204. path: "SwiftPMTests/version-test",
  1205. cSettings: [
  1206. .define("FIR_VERSION", to: firebaseVersion),
  1207. ]
  1208. ),
  1209. // MARK: - Firebase App Check
  1210. .target(name: "FirebaseAppCheck",
  1211. dependencies: [
  1212. "FirebaseCore",
  1213. .product(name: "FBLPromises", package: "Promises"),
  1214. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1215. ],
  1216. path: "FirebaseAppCheck/Sources",
  1217. publicHeadersPath: "Public",
  1218. cSettings: [
  1219. .headerSearchPath("../.."),
  1220. ],
  1221. linkerSettings: [
  1222. .linkedFramework(
  1223. "DeviceCheck",
  1224. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1225. ),
  1226. ]),
  1227. // Internal headers only for consuming from Swift.
  1228. .target(
  1229. name: "FirebaseAppCheckInterop",
  1230. path: "FirebaseAppCheck/Interop",
  1231. exclude: [
  1232. "CMakeLists.txt",
  1233. ],
  1234. publicHeadersPath: ".",
  1235. cSettings: [
  1236. .headerSearchPath("../../"),
  1237. ]
  1238. ),
  1239. .testTarget(
  1240. name: "AppCheckUnit",
  1241. dependencies: [
  1242. "FirebaseAppCheck",
  1243. "SharedTestUtilities",
  1244. "HeartbeatLoggingTestUtils",
  1245. .product(name: "OCMock", package: "ocmock"),
  1246. ],
  1247. path: "FirebaseAppCheck/Tests",
  1248. exclude: [
  1249. // Disable Swift tests as mixed targets are not supported (Xcode 12.3).
  1250. "Unit/Swift",
  1251. ],
  1252. resources: [
  1253. .process("Fixture"),
  1254. ],
  1255. cSettings: [
  1256. .headerSearchPath("../.."),
  1257. ]
  1258. ),
  1259. .testTarget(
  1260. name: "AppCheckUnitSwift",
  1261. dependencies: ["FirebaseAppCheck"],
  1262. path: "FirebaseAppCheck/Tests/Unit/Swift",
  1263. cSettings: [
  1264. .headerSearchPath("../.."),
  1265. ]
  1266. ),
  1267. // MARK: Testing support
  1268. .target(
  1269. name: "FirebaseFirestoreTestingSupport",
  1270. dependencies: ["FirebaseFirestoreTarget"],
  1271. path: "FirebaseTestingSupport/Firestore/Sources",
  1272. publicHeadersPath: "./",
  1273. cSettings: [
  1274. .headerSearchPath("../../.."),
  1275. .headerSearchPath("../../../Firestore/Source/Public/FirebaseFirestore"),
  1276. ]
  1277. ),
  1278. .testTarget(
  1279. name: "FirestoreTestingSupportTests",
  1280. dependencies: ["FirebaseFirestoreTestingSupport"],
  1281. path: "FirebaseTestingSupport/Firestore/Tests",
  1282. cSettings: [
  1283. .headerSearchPath("../../.."),
  1284. ]
  1285. ),
  1286. ],
  1287. cLanguageStandard: .c99,
  1288. cxxLanguageStandard: CXXLanguageStandard.gnucxx14
  1289. )
  1290. // This is set when running `scripts/check_firestore_symbols.sh`.
  1291. if ProcessInfo.processInfo.environment["FIREBASECI_USE_LOCAL_FIRESTORE_ZIP"] != nil {
  1292. if let firestoreIndex = package.targets
  1293. .firstIndex(where: { $0.name == "FirebaseFirestore" }) {
  1294. package.targets[firestoreIndex] = .binaryTarget(
  1295. name: "FirebaseFirestore",
  1296. // The `xcframework` should be moved to the root of the repo.
  1297. path: "FirebaseFirestore.xcframework"
  1298. )
  1299. }
  1300. }
  1301. // MARK: - Helper Functions
  1302. func googleAppMeasurementDependency() -> Package.Dependency {
  1303. let appMeasurementURL = "https://github.com/google/GoogleAppMeasurement.git"
  1304. // Point SPM CI to the tip of main of https://github.com/google/GoogleAppMeasurement so that the
  1305. // release process can defer publishing the GoogleAppMeasurement tag until after testing.
  1306. if ProcessInfo.processInfo.environment["FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT"] != nil {
  1307. return .package(url: appMeasurementURL, branch: "main")
  1308. }
  1309. return .package(url: appMeasurementURL, exact: "10.10.0")
  1310. }