Package.swift 47 KB

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