Package.swift 50 KB

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