Package.swift 49 KB

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