Package.swift 51 KB

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