Package.swift 51 KB

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