Package.swift 48 KB

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