Package.swift 51 KB

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