Package.swift 51 KB

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