Package.swift 49 KB

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