Package.swift 50 KB

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