Package.swift 52 KB

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