Package.swift 43 KB

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