Package.swift 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353
  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.10.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. ),
  656. .binaryTarget(
  657. name: "FirebaseFirestore",
  658. url: "https://dl.google.com/firebase/ios/bin/firestore/10.10.0/FirebaseFirestore.zip",
  659. checksum: "4a0070c4bf7e5ab59359dd8a0e68f402f3ec6c1e189fc39cc44ca88418f26ac4"
  660. ),
  661. .target(
  662. name: "FirebaseFirestoreSwiftTarget",
  663. dependencies: [.target(name: "FirebaseFirestoreSwift",
  664. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS]))],
  665. path: "SwiftPM-PlatformExclude/FirebaseFirestoreSwiftWrap"
  666. ),
  667. .target(
  668. name: "FirebaseFirestoreSwift",
  669. dependencies: [
  670. "FirebaseCore",
  671. "FirebaseCoreExtension",
  672. "FirebaseFirestoreTarget",
  673. "FirebaseSharedSwift",
  674. ],
  675. path: "Firestore",
  676. exclude: [
  677. "CHANGELOG.md",
  678. "CMakeLists.txt",
  679. "Example/",
  680. "LICENSE",
  681. "Protos/",
  682. "README.md",
  683. "Source/",
  684. "core/",
  685. "fuzzing/",
  686. "test.sh",
  687. "Swift/CHANGELOG.md",
  688. "Swift/README.md",
  689. "Swift/Tests/",
  690. "third_party/nlohmann_json",
  691. ],
  692. sources: [
  693. "Swift/Source/",
  694. ]
  695. ),
  696. // MARK: - Firebase Functions
  697. .target(
  698. name: "FirebaseFunctions",
  699. dependencies: [
  700. "FirebaseAppCheckInterop",
  701. "FirebaseAuthInterop",
  702. "FirebaseCore",
  703. "FirebaseCoreExtension",
  704. "FirebaseMessagingInterop",
  705. "FirebaseSharedSwift",
  706. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  707. ],
  708. path: "FirebaseFunctions/Sources"
  709. ),
  710. .testTarget(
  711. name: "FirebaseFunctionsUnit",
  712. dependencies: ["FirebaseFunctions",
  713. "FirebaseAppCheckInterop",
  714. "FirebaseAuthInterop",
  715. "FirebaseMessagingInterop",
  716. "SharedTestUtilities"],
  717. path: "FirebaseFunctions/Tests/Unit",
  718. cSettings: [
  719. .headerSearchPath("../../../"),
  720. ]
  721. ),
  722. .testTarget(
  723. name: "FirebaseFunctionsIntegration",
  724. dependencies: ["FirebaseFunctions",
  725. "SharedTestUtilities"],
  726. path: "FirebaseFunctions/Tests/Integration"
  727. ),
  728. .testTarget(
  729. name: "FirebaseFunctionsObjCIntegration",
  730. dependencies: ["FirebaseFunctions",
  731. "SharedTestUtilities"],
  732. path: "FirebaseFunctions/Tests/ObjCIntegration",
  733. // See https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730
  734. exclude: [
  735. "ObjCPPAPITests.mm",
  736. ],
  737. cSettings: [
  738. .headerSearchPath("../../.."),
  739. ]
  740. ),
  741. .target(
  742. name: "FirebaseFunctionsCombineSwift",
  743. dependencies: ["FirebaseFunctions"],
  744. path: "FirebaseCombineSwift/Sources/Functions"
  745. ),
  746. .testTarget(
  747. name: "FunctionsCombineUnit",
  748. dependencies: ["FirebaseFunctionsCombineSwift",
  749. "SharedTestUtilities"],
  750. path: "FirebaseFunctions/Tests/CombineUnit"
  751. ),
  752. // MARK: - Firebase In App Messaging
  753. .target(
  754. name: "FirebaseInAppMessagingTarget",
  755. dependencies: [
  756. .target(name: "FirebaseInAppMessaging", condition: .when(platforms: [.iOS, .tvOS])),
  757. ],
  758. path: "SwiftPM-PlatformExclude/FirebaseInAppMessagingWrap"
  759. ),
  760. .target(
  761. name: "FirebaseInAppMessaging",
  762. dependencies: [
  763. "FirebaseCore",
  764. "FirebaseInstallations",
  765. "FirebaseABTesting",
  766. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  767. .product(name: "nanopb", package: "nanopb"),
  768. .target(name: "FirebaseInAppMessaging_iOS", condition: .when(platforms: [.iOS])),
  769. ],
  770. path: "FirebaseInAppMessaging/Sources",
  771. exclude: [
  772. "DefaultUI/CHANGELOG.md",
  773. "DefaultUI/README.md",
  774. ],
  775. publicHeadersPath: "Public",
  776. cSettings: [
  777. .headerSearchPath("../../"),
  778. .define("PB_FIELD_32BIT", to: "1"),
  779. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  780. .define("PB_ENABLE_MALLOC", to: "1"),
  781. ]
  782. ),
  783. .target(
  784. name: "FirebaseInAppMessaging_iOS",
  785. path: "FirebaseInAppMessaging/iOS",
  786. resources: [.process("Resources")]
  787. ),
  788. .target(
  789. name: "FirebaseInAppMessagingSwift",
  790. dependencies: ["FirebaseInAppMessaging"],
  791. path: "FirebaseInAppMessaging/Swift/Source"
  792. ),
  793. .target(
  794. name: "FirebaseInstallations",
  795. dependencies: [
  796. "FirebaseCore",
  797. .product(name: "FBLPromises", package: "Promises"),
  798. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  799. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  800. ],
  801. path: "FirebaseInstallations/Source/Library",
  802. publicHeadersPath: "Public",
  803. cSettings: [
  804. .headerSearchPath("../../../"),
  805. ],
  806. linkerSettings: [
  807. .linkedFramework("Security"),
  808. ]
  809. ),
  810. .target(
  811. name: "FirebaseMLModelDownloader",
  812. dependencies: [
  813. "FirebaseCore",
  814. "FirebaseInstallations",
  815. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  816. .product(name: "GULLogger", package: "GoogleUtilities"),
  817. .product(name: "SwiftProtobuf", package: "swift-protobuf"),
  818. ],
  819. path: "FirebaseMLModelDownloader/Sources",
  820. exclude: [
  821. "proto/firebase_ml_log_sdk.proto",
  822. ],
  823. cSettings: [
  824. .define("FIRMLModelDownloader_VERSION", to: firebaseVersion),
  825. ]
  826. ),
  827. .testTarget(
  828. name: "FirebaseMLModelDownloaderUnit",
  829. dependencies: ["FirebaseMLModelDownloader"],
  830. path: "FirebaseMLModelDownloader/Tests/Unit"
  831. ),
  832. .target(
  833. name: "FirebaseMessaging",
  834. dependencies: [
  835. "FirebaseCore",
  836. "FirebaseInstallations",
  837. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  838. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  839. .product(name: "GULReachability", package: "GoogleUtilities"),
  840. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  841. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  842. .product(name: "nanopb", package: "nanopb"),
  843. ],
  844. path: "FirebaseMessaging/Sources",
  845. publicHeadersPath: "Public",
  846. cSettings: [
  847. .headerSearchPath("../../"),
  848. .define("PB_FIELD_32BIT", to: "1"),
  849. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  850. .define("PB_ENABLE_MALLOC", to: "1"),
  851. ],
  852. linkerSettings: [
  853. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  854. ]
  855. ),
  856. // Internal headers only for consuming from Swift.
  857. .target(
  858. name: "FirebaseMessagingInterop",
  859. path: "FirebaseMessaging/Interop",
  860. publicHeadersPath: ".",
  861. cSettings: [
  862. .headerSearchPath("../../"),
  863. ]
  864. ),
  865. .testTarget(
  866. name: "MessagingUnit",
  867. dependencies: [
  868. "FirebaseMessaging",
  869. "SharedTestUtilities",
  870. .product(name: "OCMock", package: "ocmock"),
  871. ],
  872. path: "FirebaseMessaging/Tests/UnitTests",
  873. exclude: [
  874. "FIRMessagingContextManagerServiceTest.m", // TODO: Adapt its NSBundle usage to SPM.
  875. ],
  876. cSettings: [
  877. .headerSearchPath("../../.."),
  878. ]
  879. ),
  880. .target(
  881. name: "FirebasePerformanceTarget",
  882. dependencies: [.target(name: "FirebasePerformance",
  883. condition: .when(platforms: [.iOS, .tvOS]))],
  884. path: "SwiftPM-PlatformExclude/FirebasePerformanceWrap"
  885. ),
  886. .target(
  887. name: "FirebasePerformance",
  888. dependencies: [
  889. "FirebaseCore",
  890. "FirebaseInstallations",
  891. "FirebaseRemoteConfig",
  892. "FirebaseSessions",
  893. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  894. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  895. .product(name: "GULISASwizzler", package: "GoogleUtilities"),
  896. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  897. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  898. .product(name: "nanopb", package: "nanopb"),
  899. ],
  900. path: "FirebasePerformance/Sources",
  901. publicHeadersPath: "Public",
  902. cSettings: [
  903. .headerSearchPath("../../"),
  904. .define("PB_FIELD_32BIT", to: "1"),
  905. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  906. .define("PB_ENABLE_MALLOC", to: "1"),
  907. .define("FIRPerformance_LIB_VERSION", to: firebaseVersion),
  908. ],
  909. linkerSettings: [
  910. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .tvOS])),
  911. .linkedFramework("MobileCoreServices", .when(platforms: [.iOS, .tvOS])),
  912. .linkedFramework("QuartzCore", .when(platforms: [.iOS, .tvOS])),
  913. ]
  914. ),
  915. .testTarget(
  916. name: "PerformanceUnit",
  917. dependencies: [
  918. "FirebasePerformanceTarget",
  919. "SharedTestUtilities",
  920. "GCDWebServer",
  921. .product(name: "OCMock", package: "ocmock"),
  922. ],
  923. path: "FirebasePerformance/Tests/Unit",
  924. resources: [
  925. .process("FPRURLFilterTests-Info.plist"),
  926. .process("Server/smallDownloadFile"),
  927. .process("Server/bigDownloadFile"),
  928. ],
  929. cSettings: [
  930. .headerSearchPath("../../.."),
  931. .define("PB_FIELD_32BIT", to: "1"),
  932. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  933. .define("PB_ENABLE_MALLOC", to: "1"),
  934. ]
  935. ),
  936. .target(
  937. name: "SharedTestUtilities",
  938. dependencies: ["FirebaseCore",
  939. "FirebaseAppCheckInterop",
  940. "FirebaseAuthInterop",
  941. "FirebaseMessagingInterop",
  942. "GoogleDataTransport",
  943. .product(name: "OCMock", package: "ocmock")],
  944. path: "SharedTestUtilities",
  945. publicHeadersPath: "./",
  946. cSettings: [
  947. .headerSearchPath("../"),
  948. ]
  949. ),
  950. // MARK: - Firebase Remote Config
  951. .target(
  952. name: "FirebaseRemoteConfig",
  953. dependencies: [
  954. "FirebaseCore",
  955. "FirebaseABTesting",
  956. "FirebaseInstallations",
  957. .product(name: "GULNSData", package: "GoogleUtilities"),
  958. ],
  959. path: "FirebaseRemoteConfig/Sources",
  960. publicHeadersPath: "Public",
  961. cSettings: [
  962. .headerSearchPath("../../"),
  963. ]
  964. ),
  965. .testTarget(
  966. name: "RemoteConfigUnit",
  967. dependencies: ["FirebaseRemoteConfig", .product(name: "OCMock", package: "ocmock")],
  968. path: "FirebaseRemoteConfig/Tests/Unit",
  969. exclude: [
  970. // Need to be evaluated/ported to RC V2.
  971. "RCNConfigAnalyticsTest.m",
  972. "RCNConfigSettingsTest.m",
  973. "RCNConfigTest.m",
  974. "RCNRemoteConfig+FIRAppTest.m",
  975. "RCNThrottlingTests.m",
  976. ],
  977. resources: [
  978. .process("SecondApp-GoogleService-Info.plist"),
  979. .process("Defaults-testInfo.plist"),
  980. .process("TestABTPayload.txt"),
  981. ],
  982. cSettings: [
  983. .headerSearchPath("../../.."),
  984. ]
  985. ),
  986. .target(
  987. name: "FirebaseRemoteConfigSwift",
  988. dependencies: [
  989. "FirebaseRemoteConfig",
  990. "FirebaseSharedSwift",
  991. ],
  992. path: "FirebaseRemoteConfigSwift/Sources"
  993. ),
  994. .testTarget(
  995. name: "RemoteConfigFakeConsole",
  996. dependencies: ["FirebaseRemoteConfigSwift",
  997. "RemoteConfigFakeConsoleObjC"],
  998. path: "FirebaseRemoteConfigSwift/Tests",
  999. exclude: [
  1000. "AccessToken.json",
  1001. "README.md",
  1002. "ObjC/",
  1003. ],
  1004. resources: [
  1005. .process("Defaults-testInfo.plist"),
  1006. ],
  1007. cSettings: [
  1008. .headerSearchPath("../../"),
  1009. ]
  1010. ),
  1011. .target(
  1012. name: "RemoteConfigFakeConsoleObjC",
  1013. dependencies: [.product(name: "OCMock", package: "ocmock")],
  1014. path: "FirebaseRemoteConfigSwift/Tests/ObjC",
  1015. publicHeadersPath: ".",
  1016. cSettings: [
  1017. .headerSearchPath("../../../"),
  1018. ]
  1019. ),
  1020. // MARK: - Firebase Sessions
  1021. .target(
  1022. name: "FirebaseSessions",
  1023. dependencies: [
  1024. "FirebaseCore",
  1025. "FirebaseInstallations",
  1026. "FirebaseCoreExtension",
  1027. "FirebaseSessionsObjC",
  1028. .product(name: "Promises", package: "Promises"),
  1029. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  1030. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1031. ],
  1032. path: "FirebaseSessions/Sources",
  1033. cSettings: [
  1034. .headerSearchPath(".."),
  1035. .define("DISPLAY_VERSION", to: firebaseVersion),
  1036. .define("PB_FIELD_32BIT", to: "1"),
  1037. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1038. .define("PB_ENABLE_MALLOC", to: "1"),
  1039. ],
  1040. linkerSettings: [
  1041. .linkedFramework("Security"),
  1042. .linkedFramework(
  1043. "SystemConfiguration",
  1044. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1045. ),
  1046. ]
  1047. ),
  1048. // The Sessions SDK is Swift-first with Objective-C code to support
  1049. // nanopb. Because Swift Package Manager doesn't support mixed
  1050. // language targets, the ObjC code has been extracted out into
  1051. // a separate target.
  1052. .target(
  1053. name: "FirebaseSessionsObjC",
  1054. dependencies: [
  1055. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1056. .product(name: "nanopb", package: "nanopb"),
  1057. ],
  1058. path: "FirebaseSessions",
  1059. exclude: [
  1060. "README.md",
  1061. "Sources/",
  1062. "Tests/",
  1063. "ProtoSupport/",
  1064. "generate_project.sh",
  1065. "generate_protos.sh",
  1066. "generate_testapp.sh",
  1067. ],
  1068. publicHeadersPath: "SourcesObjC",
  1069. cSettings: [
  1070. .headerSearchPath(".."),
  1071. .define("DISPLAY_VERSION", to: firebaseVersion),
  1072. .define("PB_FIELD_32BIT", to: "1"),
  1073. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1074. .define("PB_ENABLE_MALLOC", to: "1"),
  1075. ],
  1076. linkerSettings: [
  1077. .linkedFramework("Security"),
  1078. .linkedFramework(
  1079. "SystemConfiguration",
  1080. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1081. ),
  1082. ]
  1083. ),
  1084. .testTarget(
  1085. name: "FirebaseSessionsUnit",
  1086. dependencies: ["FirebaseSessions"],
  1087. path: "FirebaseSessions/Tests/Unit"
  1088. ),
  1089. // MARK: - Firebase Storage
  1090. .target(
  1091. name: "FirebaseStorage",
  1092. dependencies: [
  1093. "FirebaseAppCheckInterop",
  1094. "FirebaseAuthInterop",
  1095. "FirebaseCore",
  1096. "FirebaseCoreExtension",
  1097. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  1098. ],
  1099. path: "FirebaseStorage/Sources"
  1100. ),
  1101. .testTarget(
  1102. name: "FirebaseStorageUnit",
  1103. dependencies: ["FirebaseStorage",
  1104. "SharedTestUtilities"],
  1105. path: "FirebaseStorage/Tests/Unit",
  1106. cSettings: [
  1107. .headerSearchPath("../../../"),
  1108. ]
  1109. ),
  1110. .testTarget(
  1111. name: "StorageObjCIntegration",
  1112. dependencies: ["FirebaseStorage"],
  1113. path: "FirebaseStorage/Tests/ObjCIntegration",
  1114. exclude: [
  1115. // See https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730
  1116. "FIRStorageIntegrationTests.m",
  1117. "ObjCPPAPITests.mm",
  1118. "Credentials.h",
  1119. ],
  1120. cSettings: [
  1121. .headerSearchPath("../../.."),
  1122. ]
  1123. ),
  1124. .testTarget(
  1125. name: "swift-test",
  1126. dependencies: [
  1127. "Firebase",
  1128. "FirebaseAuth",
  1129. "FirebaseAppCheck",
  1130. "FirebaseABTesting",
  1131. "FirebaseAnalytics",
  1132. "FirebaseAnalyticsSwift",
  1133. .target(name: "FirebaseAppDistribution",
  1134. condition: .when(platforms: [.iOS])),
  1135. "FirebaseAuthCombineSwift",
  1136. "FirebaseFirestoreCombineSwift",
  1137. "FirebaseFunctionsCombineSwift",
  1138. "FirebaseStorageCombineSwift",
  1139. "FirebaseCrashlytics",
  1140. "FirebaseCore",
  1141. "FirebaseDatabase",
  1142. "FirebaseDynamicLinks",
  1143. "FirebaseFirestoreTarget",
  1144. "FirebaseFirestoreSwift",
  1145. "FirebaseFunctions",
  1146. "FirebaseInAppMessaging",
  1147. .target(name: "FirebaseInAppMessagingSwift",
  1148. condition: .when(platforms: [.iOS, .tvOS])),
  1149. "FirebaseInstallations",
  1150. "FirebaseMessaging",
  1151. .target(name: "FirebasePerformance",
  1152. condition: .when(platforms: [.iOS, .tvOS])),
  1153. "FirebaseRemoteConfig",
  1154. "FirebaseSessions",
  1155. "FirebaseStorage",
  1156. .product(name: "nanopb", package: "nanopb"),
  1157. ],
  1158. path: "SwiftPMTests/swift-test"
  1159. ),
  1160. .testTarget(
  1161. name: "analytics-import-test",
  1162. dependencies: [
  1163. "FirebaseAnalyticsSwiftTarget",
  1164. "FirebaseAnalyticsWrapper",
  1165. "Firebase",
  1166. ],
  1167. path: "SwiftPMTests/analytics-import-test"
  1168. ),
  1169. .testTarget(
  1170. name: "objc-import-test",
  1171. dependencies: [
  1172. "Firebase",
  1173. "FirebaseAuth",
  1174. "FirebaseABTesting",
  1175. "FirebaseAppCheck",
  1176. .target(name: "FirebaseAppDistribution",
  1177. condition: .when(platforms: [.iOS])),
  1178. "FirebaseCrashlytics",
  1179. "FirebaseCore",
  1180. "FirebaseDatabase",
  1181. "FirebaseDynamicLinks",
  1182. "FirebaseFirestoreTarget",
  1183. "FirebaseFunctions",
  1184. "FirebaseInAppMessaging",
  1185. "FirebaseInstallations",
  1186. "FirebaseMessaging",
  1187. .target(name: "FirebasePerformance",
  1188. condition: .when(platforms: [.iOS, .tvOS])),
  1189. "FirebaseRemoteConfig",
  1190. "FirebaseStorage",
  1191. ],
  1192. path: "SwiftPMTests/objc-import-test"
  1193. ),
  1194. .testTarget(
  1195. name: "version-test",
  1196. dependencies: [
  1197. "FirebaseCore",
  1198. ],
  1199. path: "SwiftPMTests/version-test",
  1200. cSettings: [
  1201. .define("FIR_VERSION", to: firebaseVersion),
  1202. ]
  1203. ),
  1204. // MARK: - Firebase App Check
  1205. .target(name: "FirebaseAppCheck",
  1206. dependencies: [
  1207. "FirebaseCore",
  1208. .product(name: "FBLPromises", package: "Promises"),
  1209. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1210. ],
  1211. path: "FirebaseAppCheck/Sources",
  1212. publicHeadersPath: "Public",
  1213. cSettings: [
  1214. .headerSearchPath("../.."),
  1215. ],
  1216. linkerSettings: [
  1217. .linkedFramework(
  1218. "DeviceCheck",
  1219. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1220. ),
  1221. ]),
  1222. // Internal headers only for consuming from Swift.
  1223. .target(
  1224. name: "FirebaseAppCheckInterop",
  1225. path: "FirebaseAppCheck/Interop",
  1226. exclude: [
  1227. "CMakeLists.txt",
  1228. ],
  1229. publicHeadersPath: ".",
  1230. cSettings: [
  1231. .headerSearchPath("../../"),
  1232. ]
  1233. ),
  1234. .testTarget(
  1235. name: "AppCheckUnit",
  1236. dependencies: [
  1237. "FirebaseAppCheck",
  1238. "SharedTestUtilities",
  1239. "HeartbeatLoggingTestUtils",
  1240. .product(name: "OCMock", package: "ocmock"),
  1241. ],
  1242. path: "FirebaseAppCheck/Tests",
  1243. exclude: [
  1244. // Disable Swift tests as mixed targets are not supported (Xcode 12.3).
  1245. "Unit/Swift",
  1246. ],
  1247. resources: [
  1248. .process("Fixture"),
  1249. ],
  1250. cSettings: [
  1251. .headerSearchPath("../.."),
  1252. ]
  1253. ),
  1254. .testTarget(
  1255. name: "AppCheckUnitSwift",
  1256. dependencies: ["FirebaseAppCheck"],
  1257. path: "FirebaseAppCheck/Tests/Unit/Swift",
  1258. cSettings: [
  1259. .headerSearchPath("../.."),
  1260. ]
  1261. ),
  1262. // MARK: Testing support
  1263. .target(
  1264. name: "FirebaseFirestoreTestingSupport",
  1265. dependencies: ["FirebaseFirestoreTarget"],
  1266. path: "FirebaseTestingSupport/Firestore/Sources",
  1267. publicHeadersPath: "./",
  1268. cSettings: [
  1269. .headerSearchPath("../../.."),
  1270. .headerSearchPath("../../../Firestore/Source/Public/FirebaseFirestore"),
  1271. ]
  1272. ),
  1273. .testTarget(
  1274. name: "FirestoreTestingSupportTests",
  1275. dependencies: ["FirebaseFirestoreTestingSupport"],
  1276. path: "FirebaseTestingSupport/Firestore/Tests",
  1277. cSettings: [
  1278. .headerSearchPath("../../.."),
  1279. ]
  1280. ),
  1281. ],
  1282. cLanguageStandard: .c99,
  1283. cxxLanguageStandard: CXXLanguageStandard.gnucxx14
  1284. )
  1285. // This is set when running `scripts/check_firestore_symbols.sh`.
  1286. if ProcessInfo.processInfo.environment["FIREBASECI_USE_LOCAL_FIRESTORE_ZIP"] != nil {
  1287. if let firestoreIndex = package.targets
  1288. .firstIndex(where: { $0.name == "FirebaseFirestore" }) {
  1289. package.targets[firestoreIndex] = .binaryTarget(
  1290. name: "FirebaseFirestore",
  1291. // The `xcframework` should be moved to the root of the repo.
  1292. path: "FirebaseFirestore.xcframework"
  1293. )
  1294. }
  1295. }
  1296. // MARK: - Helper Functions
  1297. func googleAppMeasurementDependency() -> Package.Dependency {
  1298. let appMeasurementURL = "https://github.com/google/GoogleAppMeasurement.git"
  1299. // Point SPM CI to the tip of main of https://github.com/google/GoogleAppMeasurement so that the
  1300. // release process can defer publishing the GoogleAppMeasurement tag until after testing.
  1301. if ProcessInfo.processInfo.environment["FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT"] != nil {
  1302. return .package(url: appMeasurementURL, branch: "main")
  1303. }
  1304. return .package(url: appMeasurementURL, exact: "10.10.0")
  1305. }