Package.swift 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647
  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.29.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.28.0/FirebaseAnalytics.zip",
  316. checksum: "50af00e4f2b62e60f8c1686538285aaa10989df35a170c1761f9626edee4a79d"
  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. "FirebaseCoreExtension",
  823. "FirebaseInstallations",
  824. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  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("MobileCoreServices", .when(platforms: [.iOS, .tvOS])),
  924. .linkedFramework("QuartzCore", .when(platforms: [.iOS, .tvOS])),
  925. ]
  926. ),
  927. .testTarget(
  928. name: "PerformanceUnit",
  929. dependencies: [
  930. "FirebasePerformanceTarget",
  931. "SharedTestUtilities",
  932. "GCDWebServer",
  933. .product(name: "OCMock", package: "ocmock"),
  934. ],
  935. path: "FirebasePerformance/Tests/Unit",
  936. resources: [
  937. .process("FPRURLFilterTests-Info.plist"),
  938. .process("Server/smallDownloadFile"),
  939. .process("Server/bigDownloadFile"),
  940. ],
  941. cSettings: [
  942. .headerSearchPath("../../.."),
  943. .define("PB_FIELD_32BIT", to: "1"),
  944. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  945. .define("PB_ENABLE_MALLOC", to: "1"),
  946. ]
  947. ),
  948. .target(
  949. name: "SharedTestUtilities",
  950. dependencies: ["FirebaseCore",
  951. "FirebaseAppCheckInterop",
  952. "FirebaseAuthInterop",
  953. "FirebaseMessagingInterop",
  954. "GoogleDataTransport",
  955. .product(name: "OCMock", package: "ocmock")],
  956. path: "SharedTestUtilities",
  957. publicHeadersPath: "./",
  958. cSettings: [
  959. .headerSearchPath("../"),
  960. ]
  961. ),
  962. // MARK: - Firebase Remote Config
  963. .target(
  964. name: "FirebaseRemoteConfigInternal",
  965. dependencies: [
  966. "FirebaseCore",
  967. "FirebaseABTesting",
  968. "FirebaseInstallations",
  969. "FirebaseRemoteConfigInterop",
  970. .product(name: "GULNSData", package: "GoogleUtilities"),
  971. ],
  972. path: "FirebaseRemoteConfig/Sources",
  973. publicHeadersPath: "Public",
  974. cSettings: [
  975. .headerSearchPath("../../"),
  976. ]
  977. ),
  978. .testTarget(
  979. name: "RemoteConfigUnit",
  980. dependencies: ["FirebaseRemoteConfigInternal", .product(name: "OCMock", package: "ocmock")],
  981. path: "FirebaseRemoteConfig/Tests/Unit",
  982. exclude: [
  983. // Need to be evaluated/ported to RC V2.
  984. "RCNConfigAnalyticsTest.m",
  985. "RCNConfigSettingsTest.m",
  986. "RCNConfigTest.m",
  987. "RCNRemoteConfig+FIRAppTest.m",
  988. "RCNThrottlingTests.m",
  989. ],
  990. resources: [
  991. .process("SecondApp-GoogleService-Info.plist"),
  992. .process("Defaults-testInfo.plist"),
  993. .process("TestABTPayload.txt"),
  994. ],
  995. cSettings: [
  996. .headerSearchPath("../../.."),
  997. ]
  998. ),
  999. .testTarget(
  1000. name: "RemoteConfigSwiftUnit",
  1001. dependencies: ["FirebaseRemoteConfigInternal"],
  1002. path: "FirebaseRemoteConfig/Tests/SwiftUnit",
  1003. cSettings: [
  1004. .headerSearchPath("../../.."),
  1005. ]
  1006. ),
  1007. .target(
  1008. name: "FirebaseRemoteConfig",
  1009. dependencies: [
  1010. "FirebaseRemoteConfigInternal",
  1011. "FirebaseSharedSwift",
  1012. ],
  1013. path: "FirebaseRemoteConfig/Swift",
  1014. resources: [.process("Resources/PrivacyInfo.xcprivacy")]
  1015. ),
  1016. .target(
  1017. name: "FirebaseRemoteConfigSwift",
  1018. dependencies: [
  1019. "FirebaseRemoteConfig",
  1020. ],
  1021. path: "FirebaseRemoteConfigSwift/Sources"
  1022. ),
  1023. .testTarget(
  1024. name: "RemoteConfigFakeConsole",
  1025. dependencies: ["FirebaseRemoteConfig",
  1026. "FirebaseRemoteConfigSwift",
  1027. "RemoteConfigFakeConsoleObjC"],
  1028. path: "FirebaseRemoteConfigSwift/Tests",
  1029. exclude: [
  1030. "AccessToken.json",
  1031. "README.md",
  1032. "ObjC/",
  1033. ],
  1034. resources: [
  1035. .process("Defaults-testInfo.plist"),
  1036. ],
  1037. cSettings: [
  1038. .headerSearchPath("../../"),
  1039. ]
  1040. ),
  1041. .target(
  1042. name: "RemoteConfigFakeConsoleObjC",
  1043. dependencies: [.product(name: "OCMock", package: "ocmock")],
  1044. path: "FirebaseRemoteConfigSwift/Tests/ObjC",
  1045. publicHeadersPath: ".",
  1046. cSettings: [
  1047. .headerSearchPath("../../../"),
  1048. ]
  1049. ),
  1050. // Internal headers only for consuming from other SDK.
  1051. .target(
  1052. name: "FirebaseRemoteConfigInterop",
  1053. path: "FirebaseRemoteConfig/Interop",
  1054. publicHeadersPath: ".",
  1055. cSettings: [
  1056. .headerSearchPath("../../"),
  1057. ]
  1058. ),
  1059. // MARK: - Firebase Sessions
  1060. .target(
  1061. name: "FirebaseSessions",
  1062. dependencies: [
  1063. "FirebaseCore",
  1064. "FirebaseInstallations",
  1065. "FirebaseCoreExtension",
  1066. "FirebaseSessionsObjC",
  1067. .product(name: "Promises", package: "Promises"),
  1068. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  1069. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1070. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  1071. ],
  1072. path: "FirebaseSessions/Sources",
  1073. cSettings: [
  1074. .headerSearchPath(".."),
  1075. .define("DISPLAY_VERSION", to: firebaseVersion),
  1076. .define("PB_FIELD_32BIT", to: "1"),
  1077. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1078. .define("PB_ENABLE_MALLOC", to: "1"),
  1079. ],
  1080. linkerSettings: [
  1081. .linkedFramework("Security"),
  1082. .linkedFramework(
  1083. "SystemConfiguration",
  1084. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1085. ),
  1086. ]
  1087. ),
  1088. // The Sessions SDK is Swift-first with Objective-C code to support
  1089. // nanopb. Because Swift Package Manager doesn't support mixed
  1090. // language targets, the ObjC code has been extracted out into
  1091. // a separate target.
  1092. .target(
  1093. name: "FirebaseSessionsObjC",
  1094. dependencies: [
  1095. "FirebaseCore",
  1096. "FirebaseCoreExtension",
  1097. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1098. .product(name: "nanopb", package: "nanopb"),
  1099. ],
  1100. path: "FirebaseSessions",
  1101. exclude: [
  1102. "README.md",
  1103. "Sources/",
  1104. "Tests/",
  1105. "ProtoSupport/",
  1106. "generate_project.sh",
  1107. "generate_protos.sh",
  1108. "generate_testapp.sh",
  1109. ],
  1110. publicHeadersPath: "SourcesObjC",
  1111. cSettings: [
  1112. .headerSearchPath(".."),
  1113. .define("DISPLAY_VERSION", to: firebaseVersion),
  1114. .define("PB_FIELD_32BIT", to: "1"),
  1115. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1116. .define("PB_ENABLE_MALLOC", to: "1"),
  1117. ],
  1118. linkerSettings: [
  1119. .linkedFramework("Security"),
  1120. .linkedFramework(
  1121. "SystemConfiguration",
  1122. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1123. ),
  1124. ]
  1125. ),
  1126. .testTarget(
  1127. name: "FirebaseSessionsUnit",
  1128. dependencies: ["FirebaseSessions"],
  1129. path: "FirebaseSessions/Tests/Unit"
  1130. ),
  1131. // MARK: - Firebase Storage
  1132. .target(
  1133. name: "FirebaseStorage",
  1134. dependencies: [
  1135. "FirebaseAppCheckInterop",
  1136. "FirebaseAuthInterop",
  1137. "FirebaseCore",
  1138. "FirebaseCoreExtension",
  1139. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  1140. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1141. ],
  1142. path: "FirebaseStorage/Sources"
  1143. ),
  1144. .testTarget(
  1145. name: "FirebaseStorageUnit",
  1146. dependencies: ["FirebaseStorage",
  1147. "SharedTestUtilities"],
  1148. path: "FirebaseStorage/Tests/Unit",
  1149. cSettings: [
  1150. .headerSearchPath("../../../"),
  1151. ]
  1152. ),
  1153. .testTarget(
  1154. name: "StorageObjCIntegration",
  1155. dependencies: ["FirebaseStorage"],
  1156. path: "FirebaseStorage/Tests/ObjCIntegration",
  1157. exclude: [
  1158. // See https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730
  1159. "FIRStorageIntegrationTests.m",
  1160. "ObjCPPAPITests.mm",
  1161. "Credentials.h",
  1162. ],
  1163. cSettings: [
  1164. .headerSearchPath("../../.."),
  1165. ]
  1166. ),
  1167. .testTarget(
  1168. name: "swift-test",
  1169. dependencies: [
  1170. "Firebase",
  1171. "FirebaseAuth",
  1172. "FirebaseAppCheck",
  1173. "FirebaseABTesting",
  1174. "FirebaseAnalytics",
  1175. "FirebaseAnalyticsSwift",
  1176. .target(name: "FirebaseAppDistribution",
  1177. condition: .when(platforms: [.iOS])),
  1178. "FirebaseAuthCombineSwift",
  1179. "FirebaseFirestoreCombineSwift",
  1180. "FirebaseFunctionsCombineSwift",
  1181. "FirebaseStorageCombineSwift",
  1182. "FirebaseCrashlytics",
  1183. "FirebaseCore",
  1184. "FirebaseDatabase",
  1185. "FirebaseDynamicLinks",
  1186. "FirebaseFirestoreTarget",
  1187. "FirebaseFirestoreSwift",
  1188. "FirebaseFunctions",
  1189. .target(name: "FirebaseInAppMessaging",
  1190. condition: .when(platforms: [.iOS, .tvOS])),
  1191. .target(name: "FirebaseInAppMessagingSwift",
  1192. condition: .when(platforms: [.iOS, .tvOS])),
  1193. "FirebaseInstallations",
  1194. "FirebaseMessaging",
  1195. .target(name: "FirebasePerformance",
  1196. condition: .when(platforms: [.iOS, .tvOS])),
  1197. "FirebaseRemoteConfig",
  1198. "FirebaseSessions",
  1199. "FirebaseStorage",
  1200. .product(name: "nanopb", package: "nanopb"),
  1201. ],
  1202. path: "SwiftPMTests/swift-test"
  1203. ),
  1204. .testTarget(
  1205. name: "analytics-import-test",
  1206. dependencies: [
  1207. "FirebaseAnalyticsSwiftTarget",
  1208. "FirebaseAnalyticsWrapper",
  1209. "Firebase",
  1210. ],
  1211. path: "SwiftPMTests/analytics-import-test"
  1212. ),
  1213. .testTarget(
  1214. name: "objc-import-test",
  1215. dependencies: [
  1216. "Firebase",
  1217. "FirebaseAuth",
  1218. "FirebaseABTesting",
  1219. "FirebaseAppCheck",
  1220. .target(name: "FirebaseAppDistribution",
  1221. condition: .when(platforms: [.iOS])),
  1222. "FirebaseCrashlytics",
  1223. "FirebaseCore",
  1224. "FirebaseDatabase",
  1225. "FirebaseDynamicLinks",
  1226. "FirebaseFirestoreTarget",
  1227. "FirebaseFunctions",
  1228. .target(name: "FirebaseInAppMessaging",
  1229. condition: .when(platforms: [.iOS, .tvOS])),
  1230. "FirebaseInstallations",
  1231. "FirebaseMessaging",
  1232. .target(name: "FirebasePerformance",
  1233. condition: .when(platforms: [.iOS, .tvOS])),
  1234. "FirebaseRemoteConfig",
  1235. "FirebaseStorage",
  1236. ],
  1237. path: "SwiftPMTests/objc-import-test"
  1238. ),
  1239. .testTarget(
  1240. name: "version-test",
  1241. dependencies: [
  1242. "FirebaseCore",
  1243. ],
  1244. path: "SwiftPMTests/version-test",
  1245. cSettings: [
  1246. .define("FIR_VERSION", to: firebaseVersion),
  1247. ]
  1248. ),
  1249. // MARK: - Firebase App Check
  1250. .target(name: "FirebaseAppCheck",
  1251. dependencies: [
  1252. "FirebaseAppCheckInterop",
  1253. "FirebaseCore",
  1254. .product(name: "AppCheckCore", package: "app-check"),
  1255. .product(name: "FBLPromises", package: "Promises"),
  1256. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1257. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  1258. ],
  1259. path: "FirebaseAppCheck/Sources",
  1260. publicHeadersPath: "Public",
  1261. cSettings: [
  1262. .headerSearchPath("../.."),
  1263. ],
  1264. linkerSettings: [
  1265. .linkedFramework(
  1266. "DeviceCheck",
  1267. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1268. ),
  1269. ]),
  1270. // Internal headers only for consuming from Swift.
  1271. .target(
  1272. name: "FirebaseAppCheckInterop",
  1273. path: "FirebaseAppCheck/Interop",
  1274. exclude: [
  1275. "CMakeLists.txt",
  1276. ],
  1277. publicHeadersPath: "Public",
  1278. cSettings: [
  1279. .headerSearchPath("../../"),
  1280. ]
  1281. ),
  1282. .testTarget(
  1283. name: "FirebaseAppCheckUnit",
  1284. dependencies: [
  1285. "FirebaseAppCheck",
  1286. "SharedTestUtilities",
  1287. .product(name: "OCMock", package: "ocmock"),
  1288. ],
  1289. path: "FirebaseAppCheck/Tests/Unit",
  1290. exclude: [
  1291. // Swift tests are in the target `FirebaseAppCheckUnitSwift` since mixed language targets
  1292. // are not supported (as of Xcode 15.0).
  1293. "Swift",
  1294. ],
  1295. cSettings: [
  1296. .headerSearchPath("../../.."),
  1297. ]
  1298. ),
  1299. .testTarget(
  1300. name: "FirebaseAppCheckUnitSwift",
  1301. dependencies: ["FirebaseAppCheck"],
  1302. path: "FirebaseAppCheck/Tests/Unit/Swift"
  1303. ),
  1304. // MARK: Testing support
  1305. .target(
  1306. name: "FirebaseFirestoreTestingSupport",
  1307. dependencies: ["FirebaseFirestoreTarget"],
  1308. path: "FirebaseTestingSupport/Firestore/Sources",
  1309. publicHeadersPath: "./",
  1310. cSettings: [
  1311. .headerSearchPath("../../.."),
  1312. .headerSearchPath("../../../Firestore/Source/Public/FirebaseFirestore"),
  1313. ]
  1314. ),
  1315. .testTarget(
  1316. name: "FirestoreTestingSupportTests",
  1317. dependencies: ["FirebaseFirestoreTestingSupport"],
  1318. path: "FirebaseTestingSupport/Firestore/Tests",
  1319. cSettings: [
  1320. .headerSearchPath("../../.."),
  1321. ]
  1322. ),
  1323. // MARK: - Firebase Vertex AI
  1324. .target(
  1325. name: "FirebaseVertexAI",
  1326. dependencies: [
  1327. "FirebaseAppCheckInterop",
  1328. "FirebaseAuthInterop",
  1329. "FirebaseCore",
  1330. "FirebaseCoreExtension",
  1331. ],
  1332. path: "FirebaseVertexAI/Sources"
  1333. ),
  1334. .testTarget(
  1335. name: "FirebaseVertexAIUnit",
  1336. dependencies: ["FirebaseVertexAI", "SharedTestUtilities"],
  1337. path: "FirebaseVertexAI/Tests/Unit",
  1338. resources: [
  1339. .process("vertexai-sdk-test-data/mock-responses"),
  1340. ],
  1341. cSettings: [
  1342. .headerSearchPath("../../../"),
  1343. ]
  1344. ),
  1345. .testTarget(
  1346. name: "FirebaseVertexAIIntegration",
  1347. dependencies: ["FirebaseVertexAI"],
  1348. path: "FirebaseVertexAI/Tests/Integration",
  1349. resources: [
  1350. .process("Resources"),
  1351. ]
  1352. ),
  1353. ] + firestoreTargets(),
  1354. cLanguageStandard: .c99,
  1355. cxxLanguageStandard: CXXLanguageStandard.gnucxx14
  1356. )
  1357. // MARK: - Helper Functions
  1358. func googleAppMeasurementDependency() -> Package.Dependency {
  1359. let appMeasurementURL = "https://github.com/google/GoogleAppMeasurement.git"
  1360. // Point SPM CI to the tip of main of https://github.com/google/GoogleAppMeasurement so that the
  1361. // release process can defer publishing the GoogleAppMeasurement tag until after testing.
  1362. if ProcessInfo.processInfo.environment["FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT"] != nil {
  1363. return .package(url: appMeasurementURL, branch: "main")
  1364. }
  1365. return .package(url: appMeasurementURL, exact: "10.28.0")
  1366. }
  1367. func abseilDependency() -> Package.Dependency {
  1368. let packageInfo: (url: String, range: Range<Version>)
  1369. // If building Firestore from source, abseil will need to be built as source
  1370. // as the headers in the binary version of abseil are unusable.
  1371. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1372. packageInfo = (
  1373. "https://github.com/firebase/abseil-cpp-SwiftPM.git",
  1374. "0.20240116.1" ..< "0.20240117.0"
  1375. )
  1376. } else {
  1377. packageInfo = (
  1378. "https://github.com/google/abseil-cpp-binary.git",
  1379. "1.2024011601.1" ..< "1.2024011700.0"
  1380. )
  1381. }
  1382. return .package(url: packageInfo.url, packageInfo.range)
  1383. }
  1384. func grpcDependency() -> Package.Dependency {
  1385. let packageInfo: (url: String, range: Range<Version>)
  1386. // If building Firestore from source, abseil will need to be built as source
  1387. // as the headers in the binary version of abseil are unusable.
  1388. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1389. packageInfo = ("https://github.com/grpc/grpc-ios.git", "1.62.3" ..< "1.63.0")
  1390. } else {
  1391. packageInfo = ("https://github.com/google/grpc-binary.git", "1.62.2" ..< "1.63.0")
  1392. }
  1393. return .package(url: packageInfo.url, packageInfo.range)
  1394. }
  1395. func firestoreWrapperTarget() -> Target {
  1396. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1397. return .target(
  1398. name: "FirebaseFirestoreTarget",
  1399. dependencies: [.target(name: "FirebaseFirestore",
  1400. condition: .when(platforms: [.iOS, .tvOS, .macOS,
  1401. .firebaseVisionOS]))],
  1402. path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap"
  1403. )
  1404. }
  1405. return .target(
  1406. name: "FirebaseFirestoreTarget",
  1407. dependencies: [.target(name: "FirebaseFirestore",
  1408. condition: .when(platforms: [.iOS, .tvOS, .macOS, .macCatalyst]))],
  1409. path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap",
  1410. cSettings: [.define("FIREBASE_BINARY_FIRESTORE", to: "1")]
  1411. )
  1412. }
  1413. func firestoreTargets() -> [Target] {
  1414. if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
  1415. return [
  1416. .target(
  1417. name: "FirebaseFirestoreInternalWrapper",
  1418. dependencies: [
  1419. "FirebaseAppCheckInterop",
  1420. "FirebaseCore",
  1421. "leveldb",
  1422. .product(name: "nanopb", package: "nanopb"),
  1423. .product(name: "abseil", package: "abseil-cpp-SwiftPM"),
  1424. .product(name: "gRPC-cpp", package: "grpc-ios"),
  1425. ],
  1426. path: "Firestore",
  1427. exclude: [
  1428. "CHANGELOG.md",
  1429. "CMakeLists.txt",
  1430. "Example/",
  1431. "LICENSE",
  1432. "Protos/CMakeLists.txt",
  1433. "Protos/Podfile",
  1434. "Protos/README.md",
  1435. "Protos/build_protos.py",
  1436. "Protos/cpp/",
  1437. "Protos/lib/",
  1438. "Protos/nanopb_cpp_generator.py",
  1439. "Protos/protos/",
  1440. "README.md",
  1441. "Source/CMakeLists.txt",
  1442. "Swift/",
  1443. "core/CMakeLists.txt",
  1444. "core/src/util/config_detected.h.in",
  1445. "core/test/",
  1446. "fuzzing/",
  1447. "test.sh",
  1448. // Swift PM doesn't recognize hpp files, so we're relying on search paths
  1449. // to find third_party/nlohmann_json/json.hpp.
  1450. "third_party/",
  1451. // Exclude alternate implementations for other platforms
  1452. "core/src/remote/connectivity_monitor_noop.cc",
  1453. "core/src/util/filesystem_win.cc",
  1454. "core/src/util/log_stdio.cc",
  1455. "core/src/util/secure_random_openssl.cc",
  1456. ],
  1457. sources: [
  1458. "Source/",
  1459. "Protos/nanopb/",
  1460. "core/include/",
  1461. "core/src",
  1462. ],
  1463. publicHeadersPath: "Source/Public",
  1464. cSettings: [
  1465. .headerSearchPath("../"),
  1466. .headerSearchPath("Source/Public/FirebaseFirestore"),
  1467. .headerSearchPath("Protos/nanopb"),
  1468. .define("PB_FIELD_32BIT", to: "1"),
  1469. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1470. .define("PB_ENABLE_MALLOC", to: "1"),
  1471. .define("FIRFirestore_VERSION", to: firebaseVersion),
  1472. ],
  1473. linkerSettings: [
  1474. .linkedFramework(
  1475. "SystemConfiguration",
  1476. .when(platforms: [.iOS, .macOS, .tvOS, .firebaseVisionOS])
  1477. ),
  1478. .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS, .firebaseVisionOS])),
  1479. .linkedLibrary("c++"),
  1480. ]
  1481. ),
  1482. .target(
  1483. name: "FirebaseFirestore",
  1484. dependencies: [
  1485. "FirebaseCore",
  1486. "FirebaseCoreExtension",
  1487. "FirebaseFirestoreInternalWrapper",
  1488. "FirebaseSharedSwift",
  1489. ],
  1490. path: "Firestore",
  1491. exclude: [
  1492. "CHANGELOG.md",
  1493. "CMakeLists.txt",
  1494. "Example/",
  1495. "LICENSE",
  1496. "Protos/",
  1497. "README.md",
  1498. "Source/",
  1499. "core/",
  1500. "fuzzing/",
  1501. "test.sh",
  1502. "Swift/CHANGELOG.md",
  1503. "Swift/Tests/",
  1504. "third_party/nlohmann_json",
  1505. ],
  1506. sources: [
  1507. "Swift/Source/",
  1508. ],
  1509. resources: [.process("Source/Resources/PrivacyInfo.xcprivacy")]
  1510. ),
  1511. ]
  1512. }
  1513. let firestoreInternalTarget: Target = {
  1514. if ProcessInfo.processInfo.environment["FIREBASECI_USE_LOCAL_FIRESTORE_ZIP"] != nil {
  1515. // This is set when running `scripts/check_firestore_symbols.sh`.
  1516. return .binaryTarget(
  1517. name: "FirebaseFirestoreInternal",
  1518. // The `xcframework` should be moved to the root of the repo.
  1519. path: "FirebaseFirestoreInternal.xcframework"
  1520. )
  1521. } else {
  1522. return .binaryTarget(
  1523. name: "FirebaseFirestoreInternal",
  1524. url: "https://dl.google.com/firebase/ios/bin/firestore/10.27.0/rc0/FirebaseFirestoreInternal.zip",
  1525. checksum: "38f6d1bb13fabca97f53c0ef5bf283b2fbbbf460eac8fa875cd3faab597097b8"
  1526. )
  1527. }
  1528. }()
  1529. return [
  1530. .target(
  1531. name: "FirebaseFirestore",
  1532. dependencies: [
  1533. .target(
  1534. name: "FirebaseFirestoreInternalWrapper",
  1535. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1536. ),
  1537. .product(
  1538. name: "abseil",
  1539. package: "abseil-cpp-binary",
  1540. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1541. ),
  1542. .product(
  1543. name: "gRPC-C++",
  1544. package: "grpc-binary",
  1545. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1546. ),
  1547. .product(name: "nanopb", package: "nanopb"),
  1548. "FirebaseAppCheckInterop",
  1549. "FirebaseCore",
  1550. "FirebaseCoreExtension",
  1551. "leveldb",
  1552. "FirebaseSharedSwift",
  1553. ],
  1554. path: "Firestore/Swift/Source",
  1555. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  1556. linkerSettings: [
  1557. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  1558. .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS])),
  1559. .linkedLibrary("c++"),
  1560. ]
  1561. ),
  1562. .target(
  1563. name: "FirebaseFirestoreInternalWrapper",
  1564. dependencies: [.target(
  1565. name: "FirebaseFirestoreInternal",
  1566. condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
  1567. )],
  1568. path: "FirebaseFirestoreInternal",
  1569. publicHeadersPath: "."
  1570. ),
  1571. firestoreInternalTarget,
  1572. ]
  1573. }
  1574. extension Platform {
  1575. // Xcode dependent value for the visionOS platform. Namespaced with
  1576. // "firebase" prefix to prevent any API collisions (such issues should not
  1577. // arise as the manifest APIs should be confined to the `Package.swift`).
  1578. static var firebaseVisionOS: Self {
  1579. #if swift(>=5.9)
  1580. // For Xcode 15, return the available `visionOS` platform.
  1581. return .visionOS
  1582. #else
  1583. // For Xcode 14, return `iOS` as visionOS is unavailable. Since all targets
  1584. // support iOS, this acts as a no-op.
  1585. return .iOS
  1586. #endif // swift(>=5.9)
  1587. }
  1588. }