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.1.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. // TODO: restore OCMock when https://github.com/erikdoe/ocmock/pull/537
  150. // gets merged to fix Xcode 15.3 builds.
  151. .package(
  152. url: "https://github.com/paulb777/ocmock.git",
  153. revision: "173955e93e6ee6999a10729ab67e4b4efdd1db6d"
  154. ),
  155. // url: "https://github.com/erikdoe/ocmock.git",
  156. // revision: "c5eeaa6dde7c308a5ce48ae4d4530462dd3a1110"
  157. // ),
  158. .package(
  159. url: "https://github.com/firebase/leveldb.git",
  160. "1.22.2" ..< "1.23.0"
  161. ),
  162. .package(
  163. url: "https://github.com/SlaunchaMan/GCDWebServer.git",
  164. revision: "935e2736044e71e5341663c3cc9a335ba6867a2b"
  165. ),
  166. .package(
  167. url: "https://github.com/google/interop-ios-for-google-sdks.git",
  168. "100.0.0" ..< "101.0.0"
  169. ),
  170. .package(url: "https://github.com/google/app-check.git",
  171. "11.0.1" ..< "12.0.0"),
  172. ],
  173. targets: [
  174. .target(
  175. name: "Firebase",
  176. path: "CoreOnly/Sources",
  177. publicHeadersPath: "./"
  178. ),
  179. .target(
  180. name: "FirebaseCore",
  181. dependencies: [
  182. "Firebase",
  183. "FirebaseCoreInternal",
  184. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  185. .product(name: "GULLogger", package: "GoogleUtilities"),
  186. ],
  187. path: "FirebaseCore/Sources",
  188. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  189. publicHeadersPath: "Public",
  190. cSettings: [
  191. .headerSearchPath("../.."),
  192. .define("Firebase_VERSION", to: firebaseVersion),
  193. // TODO: - Add support for cflags cSetting so that we can set the -fno-autolink option
  194. ],
  195. linkerSettings: [
  196. .linkedFramework("UIKit", .when(platforms: [.iOS, .macCatalyst, .tvOS])),
  197. .linkedFramework("AppKit", .when(platforms: [.macOS])),
  198. ]
  199. ),
  200. .testTarget(
  201. name: "CoreUnit",
  202. dependencies: [
  203. "FirebaseCore",
  204. "SharedTestUtilities",
  205. .product(name: "OCMock", package: "ocmock"),
  206. ],
  207. path: "FirebaseCore/Tests/Unit",
  208. exclude: ["Resources/GoogleService-Info.plist"],
  209. cSettings: [
  210. .headerSearchPath("../../.."),
  211. ]
  212. ),
  213. // MARK: - Firebase Core Extension
  214. // Extension of FirebaseCore for consuming by Swift product SDKs.
  215. // When depending on `FirebaseCoreExtension`, also depend on `FirebaseCore`
  216. // to avoid potential linker issues.
  217. .target(
  218. name: "FirebaseCoreExtension",
  219. path: "FirebaseCore/Extension",
  220. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  221. publicHeadersPath: ".",
  222. cSettings: [
  223. .headerSearchPath("../../"),
  224. ]
  225. ),
  226. // MARK: - Firebase Core Internal
  227. // Shared collection of APIs for internal FirebaseCore usage.
  228. .target(
  229. name: "FirebaseCoreInternal",
  230. dependencies: [
  231. .product(name: "GULNSData", package: "GoogleUtilities"),
  232. ],
  233. path: "FirebaseCore/Internal/Sources",
  234. resources: [.process("Resources/PrivacyInfo.xcprivacy")]
  235. ),
  236. .testTarget(
  237. name: "FirebaseCoreInternalTests",
  238. dependencies: [
  239. "FirebaseCoreInternal",
  240. ],
  241. path: "FirebaseCore/Internal/Tests"
  242. ),
  243. .target(
  244. name: "FirebaseABTesting",
  245. dependencies: ["FirebaseCore"],
  246. path: "FirebaseABTesting/Sources",
  247. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  248. publicHeadersPath: "Public",
  249. cSettings: [
  250. .headerSearchPath("../../"),
  251. ]
  252. ),
  253. .testTarget(
  254. name: "ABTestingUnit",
  255. dependencies: ["FirebaseABTesting", .product(name: "OCMock", package: "ocmock")],
  256. path: "FirebaseABTesting/Tests/Unit",
  257. resources: [.process("Resources")],
  258. cSettings: [
  259. .headerSearchPath("../../.."),
  260. ]
  261. ),
  262. .target(
  263. name: "FirebaseAnalyticsTarget",
  264. dependencies: [.target(name: "FirebaseAnalyticsWrapper",
  265. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS]))],
  266. path: "SwiftPM-PlatformExclude/FirebaseAnalyticsWrap"
  267. ),
  268. .target(
  269. name: "FirebaseAnalyticsWrapper",
  270. dependencies: [
  271. .target(
  272. name: "FirebaseAnalytics",
  273. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  274. ),
  275. .product(name: "GoogleAppMeasurement",
  276. package: "GoogleAppMeasurement",
  277. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])),
  278. "FirebaseCore",
  279. "FirebaseInstallations",
  280. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  281. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  282. .product(name: "GULNSData", package: "GoogleUtilities"),
  283. .product(name: "GULNetwork", package: "GoogleUtilities"),
  284. .product(name: "nanopb", package: "nanopb"),
  285. ],
  286. path: "FirebaseAnalyticsWrapper",
  287. linkerSettings: [
  288. .linkedLibrary("sqlite3"),
  289. .linkedLibrary("c++"),
  290. .linkedLibrary("z"),
  291. .linkedFramework("StoreKit"),
  292. ]
  293. ),
  294. .binaryTarget(
  295. name: "FirebaseAnalytics",
  296. url: "https://dl.google.com/firebase/ios/swiftpm/11.0.0/rc2/FirebaseAnalytics.zip",
  297. checksum: "3dffe84e22f11691c147c5f83ba83b66172bb5c11fe09a077f2dd5f8bbd8e2bc"
  298. ),
  299. .testTarget(
  300. name: "AnalyticsSwiftUnit",
  301. dependencies: ["FirebaseAnalyticsTarget"],
  302. path: "FirebaseAnalytics/Tests/SwiftUnit"
  303. ),
  304. .testTarget(
  305. name: "AnalyticsObjCAPI",
  306. dependencies: ["FirebaseAnalyticsTarget"],
  307. path: "FirebaseAnalytics/Tests/ObjCAPI"
  308. ),
  309. .target(
  310. name: "FirebaseAnalyticsWithoutAdIdSupportTarget",
  311. dependencies: [.target(name: "FirebaseAnalyticsWithoutAdIdSupportWrapper",
  312. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS]))],
  313. path: "SwiftPM-PlatformExclude/FirebaseAnalyticsWithoutAdIdSupportWrap"
  314. ),
  315. .target(
  316. name: "FirebaseAnalyticsWithoutAdIdSupportWrapper",
  317. dependencies: [
  318. .target(
  319. name: "FirebaseAnalytics",
  320. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  321. ),
  322. .product(name: "GoogleAppMeasurementWithoutAdIdSupport",
  323. package: "GoogleAppMeasurement",
  324. condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])),
  325. "FirebaseCore",
  326. "FirebaseInstallations",
  327. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  328. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  329. .product(name: "GULNSData", package: "GoogleUtilities"),
  330. .product(name: "GULNetwork", package: "GoogleUtilities"),
  331. .product(name: "nanopb", package: "nanopb"),
  332. ],
  333. path: "FirebaseAnalyticsWithoutAdIdSupportWrapper",
  334. linkerSettings: [
  335. .linkedLibrary("sqlite3"),
  336. .linkedLibrary("c++"),
  337. .linkedLibrary("z"),
  338. .linkedFramework("StoreKit"),
  339. ]
  340. ),
  341. .target(
  342. name: "FirebaseAnalyticsOnDeviceConversionTarget",
  343. dependencies: [
  344. .product(name: "GoogleAppMeasurementOnDeviceConversion",
  345. package: "GoogleAppMeasurement",
  346. condition: .when(platforms: [.iOS])),
  347. ],
  348. path: "FirebaseAnalyticsOnDeviceConversionWrapper",
  349. linkerSettings: [
  350. .linkedLibrary("c++"),
  351. ]
  352. ),
  353. .target(
  354. name: "FirebaseAppDistributionTarget",
  355. dependencies: [.target(name: "FirebaseAppDistribution",
  356. condition: .when(platforms: [.iOS]))],
  357. path: "SwiftPM-PlatformExclude/FirebaseAppDistributionWrap"
  358. ),
  359. .target(
  360. name: "FirebaseAppDistribution",
  361. dependencies: [
  362. "FirebaseCore",
  363. "FirebaseInstallations",
  364. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  365. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  366. ],
  367. path: "FirebaseAppDistribution/Sources",
  368. publicHeadersPath: "Public",
  369. cSettings: [
  370. .headerSearchPath("../../"),
  371. ]
  372. ),
  373. .testTarget(
  374. name: "AppDistributionUnit",
  375. dependencies: ["FirebaseAppDistribution", .product(name: "OCMock", package: "ocmock")],
  376. path: "FirebaseAppDistribution/Tests/Unit",
  377. exclude: ["Swift/"],
  378. resources: [.process("Resources")],
  379. cSettings: [
  380. .headerSearchPath("../../.."),
  381. ]
  382. ),
  383. .testTarget(
  384. name: "AppDistributionUnitSwift",
  385. dependencies: ["FirebaseAppDistribution"],
  386. path: "FirebaseAppDistribution/Tests/Unit/Swift",
  387. cSettings: [
  388. .headerSearchPath("../../../.."),
  389. ]
  390. ),
  391. .target(
  392. name: "FirebaseAuth",
  393. dependencies: [
  394. "FirebaseAppCheckInterop",
  395. "FirebaseAuthInterop",
  396. "FirebaseAuthInternal",
  397. "FirebaseCore",
  398. "FirebaseCoreExtension",
  399. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  400. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  401. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  402. ],
  403. path: "FirebaseAuth/Sources",
  404. exclude: [
  405. "ObjC", "Public",
  406. ],
  407. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  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. "ObjCAPITests.m", // Only builds via CocoaPods until mixed language or its own target.
  450. "ObjCGlobalTests.m", // Only builds via CocoaPods until mixed language or its own target.
  451. ]
  452. ),
  453. .target(
  454. name: "FirebaseAuthCombineSwift",
  455. dependencies: ["FirebaseAuth"],
  456. path: "FirebaseCombineSwift/Sources/Auth"
  457. ),
  458. .target(
  459. name: "FirebaseFirestoreCombineSwift",
  460. dependencies: [
  461. "FirebaseFirestoreTarget",
  462. ],
  463. path: "FirebaseCombineSwift/Sources/Firestore"
  464. ),
  465. .target(
  466. name: "FirebaseStorageCombineSwift",
  467. dependencies: [
  468. "FirebaseStorage",
  469. ],
  470. path: "FirebaseCombineSwift/Sources/Storage"
  471. ),
  472. .target(
  473. name: "FirebaseCrashlytics",
  474. dependencies: [
  475. "FirebaseCore",
  476. "FirebaseInstallations",
  477. "FirebaseSessions",
  478. "FirebaseRemoteConfigInterop",
  479. "FirebaseCrashlyticsSwift",
  480. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  481. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  482. .product(name: "FBLPromises", package: "Promises"),
  483. .product(name: "nanopb", package: "nanopb"),
  484. ],
  485. path: "Crashlytics",
  486. exclude: [
  487. "run",
  488. "CHANGELOG.md",
  489. "LICENSE",
  490. "README.md",
  491. "ProtoSupport/",
  492. "UnitTests/",
  493. "generate_project.sh",
  494. "upload-symbols",
  495. "CrashlyticsInputFiles.xcfilelist",
  496. "third_party/libunwind/LICENSE",
  497. "Crashlytics/Rollouts/",
  498. ],
  499. sources: [
  500. "Crashlytics/",
  501. "Protogen/",
  502. "Shared/",
  503. "third_party/libunwind/dwarf.h",
  504. ],
  505. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  506. publicHeadersPath: "Crashlytics/Public",
  507. cSettings: [
  508. .headerSearchPath(".."),
  509. .define("DISPLAY_VERSION", to: firebaseVersion),
  510. .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])),
  511. .define(
  512. "CLS_SDK_NAME",
  513. to: "Crashlytics macOS SDK",
  514. .when(platforms: [.macOS, .macCatalyst])
  515. ),
  516. .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])),
  517. .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])),
  518. .define("PB_FIELD_32BIT", to: "1"),
  519. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  520. .define("PB_ENABLE_MALLOC", to: "1"),
  521. ],
  522. linkerSettings: [
  523. .linkedFramework("Security"),
  524. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  525. ]
  526. ),
  527. .target(
  528. name: "FirebaseCrashlyticsSwift",
  529. dependencies: ["FirebaseRemoteConfigInterop"],
  530. path: "Crashlytics",
  531. sources: [
  532. "Crashlytics/Rollouts/",
  533. ]
  534. ),
  535. .testTarget(
  536. name: "FirebaseCrashlyticsSwiftUnit",
  537. dependencies: ["FirebaseCrashlyticsSwift"],
  538. path: "Crashlytics/UnitTestsSwift/"
  539. ),
  540. .testTarget(
  541. name: "FirebaseCrashlyticsUnit",
  542. dependencies: ["FirebaseCrashlytics", .product(name: "OCMock", package: "ocmock")],
  543. path: "Crashlytics/UnitTests",
  544. resources: [
  545. .copy("FIRCLSMachO/machO_data"),
  546. .copy("Data"),
  547. ],
  548. cSettings: [
  549. .headerSearchPath("../.."),
  550. .define("DISPLAY_VERSION", to: firebaseVersion),
  551. .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])),
  552. .define(
  553. "CLS_SDK_NAME",
  554. to: "Crashlytics macOS SDK",
  555. .when(platforms: [.macOS, .macCatalyst])
  556. ),
  557. .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])),
  558. .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])),
  559. ]
  560. ),
  561. .target(
  562. name: "FirebaseDatabaseInternal",
  563. dependencies: [
  564. "FirebaseAppCheckInterop",
  565. "FirebaseCore",
  566. "leveldb",
  567. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  568. ],
  569. path: "FirebaseDatabase/Sources",
  570. exclude: [
  571. "third_party/Wrap-leveldb/LICENSE",
  572. "third_party/FImmutableSortedDictionary/LICENSE",
  573. ],
  574. publicHeadersPath: "Public",
  575. cSettings: [
  576. .headerSearchPath("../../"),
  577. ],
  578. linkerSettings: [
  579. .linkedFramework("CFNetwork"),
  580. .linkedFramework("Security"),
  581. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  582. .linkedFramework("WatchKit", .when(platforms: [.watchOS])),
  583. ]
  584. ),
  585. .testTarget(
  586. name: "DatabaseUnit",
  587. dependencies: [
  588. "FirebaseDatabase",
  589. "SharedTestUtilities",
  590. .product(name: "OCMock", package: "ocmock"),
  591. ],
  592. path: "FirebaseDatabase/Tests/",
  593. exclude: [
  594. // Disable Swift tests as mixed targets are not supported (Xcode 12.4).
  595. "Unit/Swift",
  596. "Integration/",
  597. ],
  598. resources: [.process("Resources")],
  599. cSettings: [
  600. .headerSearchPath("../.."),
  601. ]
  602. ),
  603. .testTarget(
  604. name: "DatabaseUnitSwift",
  605. dependencies: ["FirebaseDatabase"],
  606. path: "FirebaseDatabase/Tests/Unit/Swift",
  607. cSettings: [
  608. .headerSearchPath("../.."),
  609. ]
  610. ),
  611. .target(
  612. name: "FirebaseDatabase",
  613. dependencies: ["FirebaseDatabaseInternal", "FirebaseSharedSwift"],
  614. path: "FirebaseDatabase/Swift/Sources"
  615. ),
  616. .target(
  617. name: "FirebaseSharedSwift",
  618. path: "FirebaseSharedSwift/Sources",
  619. exclude: [
  620. "third_party/FirebaseDataEncoder/LICENSE",
  621. "third_party/FirebaseDataEncoder/METADATA",
  622. ]
  623. ),
  624. .testTarget(
  625. name: "FirebaseSharedSwiftTests",
  626. dependencies: ["FirebaseSharedSwift"],
  627. path: "FirebaseSharedSwift/Tests/"
  628. ),
  629. .target(
  630. name: "FirebaseDynamicLinksTarget",
  631. dependencies: [.target(name: "FirebaseDynamicLinks",
  632. condition: .when(platforms: [.iOS]))],
  633. path: "SwiftPM-PlatformExclude/FirebaseDynamicLinksWrap"
  634. ),
  635. .target(
  636. name: "FirebaseDynamicLinks",
  637. dependencies: ["FirebaseCore"],
  638. path: "FirebaseDynamicLinks/Sources",
  639. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  640. publicHeadersPath: "Public",
  641. cSettings: [
  642. .headerSearchPath("../../"),
  643. .define("FIRDynamicLinks3P", to: "1"),
  644. .define("GIN_SCION_LOGGING", to: "1"),
  645. ],
  646. linkerSettings: [
  647. .linkedFramework("QuartzCore"),
  648. ]
  649. ),
  650. firestoreWrapperTarget(),
  651. // MARK: - Firebase Functions
  652. .target(
  653. name: "FirebaseFunctions",
  654. dependencies: [
  655. "FirebaseAppCheckInterop",
  656. "FirebaseAuthInterop",
  657. "FirebaseCore",
  658. "FirebaseCoreExtension",
  659. "FirebaseMessagingInterop",
  660. "FirebaseSharedSwift",
  661. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  662. ],
  663. path: "FirebaseFunctions/Sources"
  664. ),
  665. .testTarget(
  666. name: "FirebaseFunctionsUnit",
  667. dependencies: ["FirebaseFunctions",
  668. "FirebaseAppCheckInterop",
  669. "FirebaseAuthInterop",
  670. "FirebaseMessagingInterop",
  671. "SharedTestUtilities"],
  672. path: "FirebaseFunctions/Tests/Unit",
  673. cSettings: [
  674. .headerSearchPath("../../../"),
  675. ]
  676. ),
  677. .testTarget(
  678. name: "FirebaseFunctionsIntegration",
  679. dependencies: ["FirebaseFunctions",
  680. "SharedTestUtilities"],
  681. path: "FirebaseFunctions/Tests/Integration"
  682. ),
  683. .testTarget(
  684. name: "FirebaseFunctionsObjCIntegration",
  685. dependencies: ["FirebaseFunctions",
  686. "SharedTestUtilities"],
  687. path: "FirebaseFunctions/Tests/ObjCIntegration",
  688. // See https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730
  689. exclude: [
  690. "ObjCPPAPITests.mm",
  691. ],
  692. cSettings: [
  693. .headerSearchPath("../../.."),
  694. ]
  695. ),
  696. .target(
  697. name: "FirebaseFunctionsCombineSwift",
  698. dependencies: ["FirebaseFunctions"],
  699. path: "FirebaseCombineSwift/Sources/Functions"
  700. ),
  701. .testTarget(
  702. name: "FunctionsCombineUnit",
  703. dependencies: ["FirebaseFunctionsCombineSwift",
  704. "SharedTestUtilities"],
  705. path: "FirebaseFunctions/Tests/CombineUnit"
  706. ),
  707. // MARK: - Firebase In App Messaging
  708. .target(
  709. name: "FirebaseInAppMessagingTarget",
  710. dependencies: [
  711. .target(name: "FirebaseInAppMessaging", condition: .when(platforms: [.iOS, .tvOS])),
  712. ],
  713. path: "SwiftPM-PlatformExclude/FirebaseInAppMessagingWrap"
  714. ),
  715. .target(
  716. name: "FirebaseInAppMessagingInternal",
  717. dependencies: [
  718. "FirebaseCore",
  719. "FirebaseInstallations",
  720. "FirebaseABTesting",
  721. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  722. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  723. .product(name: "nanopb", package: "nanopb"),
  724. .target(name: "FirebaseInAppMessaging_iOS", condition: .when(platforms: [.iOS])),
  725. ],
  726. path: "FirebaseInAppMessaging/Sources",
  727. exclude: [
  728. "DefaultUI/CHANGELOG.md",
  729. "DefaultUI/README.md",
  730. ],
  731. publicHeadersPath: "Public",
  732. cSettings: [
  733. .headerSearchPath("../../"),
  734. .define("PB_FIELD_32BIT", to: "1"),
  735. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  736. .define("PB_ENABLE_MALLOC", to: "1"),
  737. ]
  738. ),
  739. .target(
  740. name: "FirebaseInAppMessaging_iOS",
  741. path: "FirebaseInAppMessaging/iOS",
  742. resources: [.process("Resources")]
  743. ),
  744. .target(
  745. name: "FirebaseInAppMessaging",
  746. dependencies: ["FirebaseInAppMessagingInternal"],
  747. path: "FirebaseInAppMessaging/Swift/Source"
  748. ),
  749. .target(
  750. name: "FirebaseInstallations",
  751. dependencies: [
  752. "FirebaseCore",
  753. .product(name: "FBLPromises", package: "Promises"),
  754. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  755. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  756. ],
  757. path: "FirebaseInstallations/Source/Library",
  758. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  759. publicHeadersPath: "Public",
  760. cSettings: [
  761. .headerSearchPath("../../../"),
  762. ],
  763. linkerSettings: [
  764. .linkedFramework("Security"),
  765. ]
  766. ),
  767. .target(
  768. name: "FirebaseMLModelDownloader",
  769. dependencies: [
  770. "FirebaseCore",
  771. "FirebaseCoreExtension",
  772. "FirebaseInstallations",
  773. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  774. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  775. .product(name: "SwiftProtobuf", package: "swift-protobuf"),
  776. ],
  777. path: "FirebaseMLModelDownloader/Sources",
  778. exclude: [
  779. "proto/firebase_ml_log_sdk.proto",
  780. ],
  781. cSettings: [
  782. .define("FIRMLModelDownloader_VERSION", to: firebaseVersion),
  783. ]
  784. ),
  785. .testTarget(
  786. name: "FirebaseMLModelDownloaderUnit",
  787. dependencies: ["FirebaseMLModelDownloader"],
  788. path: "FirebaseMLModelDownloader/Tests/Unit"
  789. ),
  790. .target(
  791. name: "FirebaseMessaging",
  792. dependencies: [
  793. "FirebaseCore",
  794. "FirebaseInstallations",
  795. .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
  796. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  797. .product(name: "GULReachability", package: "GoogleUtilities"),
  798. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  799. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  800. .product(name: "nanopb", package: "nanopb"),
  801. ],
  802. path: "FirebaseMessaging/Sources",
  803. resources: [.process("Resources/PrivacyInfo.xcprivacy")],
  804. publicHeadersPath: "Public",
  805. cSettings: [
  806. .headerSearchPath("../../"),
  807. .define("PB_FIELD_32BIT", to: "1"),
  808. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  809. .define("PB_ENABLE_MALLOC", to: "1"),
  810. ],
  811. linkerSettings: [
  812. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  813. ]
  814. ),
  815. // Internal headers only for consuming from Swift.
  816. .target(
  817. name: "FirebaseMessagingInterop",
  818. path: "FirebaseMessaging/Interop",
  819. publicHeadersPath: ".",
  820. cSettings: [
  821. .headerSearchPath("../../"),
  822. ]
  823. ),
  824. .testTarget(
  825. name: "MessagingUnit",
  826. dependencies: [
  827. "FirebaseMessaging",
  828. "SharedTestUtilities",
  829. .product(name: "OCMock", package: "ocmock"),
  830. ],
  831. path: "FirebaseMessaging/Tests/UnitTests",
  832. exclude: [
  833. "FIRMessagingContextManagerServiceTest.m", // TODO: Adapt its NSBundle usage to SPM.
  834. ],
  835. cSettings: [
  836. .headerSearchPath("../../.."),
  837. ]
  838. ),
  839. .target(
  840. name: "FirebasePerformanceTarget",
  841. dependencies: [.target(name: "FirebasePerformance",
  842. condition: .when(platforms: [.iOS, .tvOS, .visionOS]))],
  843. path: "SwiftPM-PlatformExclude/FirebasePerformanceWrap"
  844. ),
  845. .target(
  846. name: "FirebasePerformance",
  847. dependencies: [
  848. "FirebaseCore",
  849. "FirebaseInstallations",
  850. // Performance depends on the Obj-C target of FirebaseRemoteConfig to
  851. // avoid including Swift code from the `FirebaseRemoteConfig` target
  852. // that is unneeded.
  853. "FirebaseRemoteConfigInternal",
  854. "FirebaseSessions",
  855. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  856. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  857. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  858. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  859. .product(name: "nanopb", package: "nanopb"),
  860. ],
  861. path: "FirebasePerformance/Sources",
  862. publicHeadersPath: "Public",
  863. cSettings: [
  864. .headerSearchPath("../../"),
  865. .define("PB_FIELD_32BIT", to: "1"),
  866. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  867. .define("PB_ENABLE_MALLOC", to: "1"),
  868. .define("FIRPerformance_LIB_VERSION", to: firebaseVersion),
  869. ],
  870. linkerSettings: [
  871. .linkedFramework("MobileCoreServices", .when(platforms: [.iOS, .tvOS])),
  872. .linkedFramework("QuartzCore", .when(platforms: [.iOS, .tvOS])),
  873. ]
  874. ),
  875. .testTarget(
  876. name: "PerformanceUnit",
  877. dependencies: [
  878. "FirebasePerformanceTarget",
  879. "SharedTestUtilities",
  880. "GCDWebServer",
  881. .product(name: "OCMock", package: "ocmock"),
  882. ],
  883. path: "FirebasePerformance/Tests/Unit",
  884. resources: [
  885. .process("FPRURLFilterTests-Info.plist"),
  886. .process("Server/smallDownloadFile"),
  887. .process("Server/bigDownloadFile"),
  888. ],
  889. cSettings: [
  890. .headerSearchPath("../../.."),
  891. .define("PB_FIELD_32BIT", to: "1"),
  892. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  893. .define("PB_ENABLE_MALLOC", to: "1"),
  894. ]
  895. ),
  896. .target(
  897. name: "SharedTestUtilities",
  898. dependencies: ["FirebaseCore",
  899. "FirebaseAppCheckInterop",
  900. "FirebaseAuthInterop",
  901. "FirebaseMessagingInterop",
  902. "GoogleDataTransport",
  903. .product(name: "OCMock", package: "ocmock")],
  904. path: "SharedTestUtilities",
  905. publicHeadersPath: "./",
  906. cSettings: [
  907. .headerSearchPath("../"),
  908. ]
  909. ),
  910. // MARK: - Firebase Remote Config
  911. .target(
  912. name: "FirebaseRemoteConfigInternal",
  913. dependencies: [
  914. "FirebaseCore",
  915. "FirebaseABTesting",
  916. "FirebaseInstallations",
  917. "FirebaseRemoteConfigInterop",
  918. .product(name: "GULNSData", package: "GoogleUtilities"),
  919. ],
  920. path: "FirebaseRemoteConfig/Sources",
  921. publicHeadersPath: "Public",
  922. cSettings: [
  923. .headerSearchPath("../../"),
  924. ]
  925. ),
  926. .testTarget(
  927. name: "RemoteConfigUnit",
  928. dependencies: ["FirebaseRemoteConfigInternal", .product(name: "OCMock", package: "ocmock")],
  929. path: "FirebaseRemoteConfig/Tests/Unit",
  930. exclude: [
  931. // Need to be evaluated/ported to RC V2.
  932. "RCNConfigAnalyticsTest.m",
  933. "RCNConfigSettingsTest.m",
  934. "RCNConfigTest.m",
  935. "RCNRemoteConfig+FIRAppTest.m",
  936. "RCNThrottlingTests.m",
  937. ],
  938. resources: [
  939. .process("SecondApp-GoogleService-Info.plist"),
  940. .process("Defaults-testInfo.plist"),
  941. .process("TestABTPayload.txt"),
  942. ],
  943. cSettings: [
  944. .headerSearchPath("../../.."),
  945. ]
  946. ),
  947. .testTarget(
  948. name: "RemoteConfigSwiftUnit",
  949. dependencies: ["FirebaseRemoteConfigInternal"],
  950. path: "FirebaseRemoteConfig/Tests/SwiftUnit",
  951. cSettings: [
  952. .headerSearchPath("../../.."),
  953. ]
  954. ),
  955. .target(
  956. name: "FirebaseRemoteConfig",
  957. dependencies: [
  958. "FirebaseRemoteConfigInternal",
  959. "FirebaseSharedSwift",
  960. ],
  961. path: "FirebaseRemoteConfig/Swift",
  962. resources: [.process("Resources/PrivacyInfo.xcprivacy")]
  963. ),
  964. .testTarget(
  965. name: "RemoteConfigFakeConsole",
  966. dependencies: ["FirebaseRemoteConfig",
  967. "RemoteConfigFakeConsoleObjC"],
  968. path: "FirebaseRemoteConfig/Tests/Swift",
  969. exclude: [
  970. "AccessToken.json",
  971. "README.md",
  972. "ObjC/",
  973. ],
  974. resources: [
  975. .process("Defaults-testInfo.plist"),
  976. ],
  977. cSettings: [
  978. .headerSearchPath("../../../"),
  979. ]
  980. ),
  981. .target(
  982. name: "RemoteConfigFakeConsoleObjC",
  983. dependencies: [.product(name: "OCMock", package: "ocmock")],
  984. path: "FirebaseRemoteConfig/Tests/Swift/ObjC",
  985. publicHeadersPath: ".",
  986. cSettings: [
  987. .headerSearchPath("../../../../"),
  988. ]
  989. ),
  990. // Internal headers only for consuming from other SDK.
  991. .target(
  992. name: "FirebaseRemoteConfigInterop",
  993. path: "FirebaseRemoteConfig/Interop",
  994. publicHeadersPath: ".",
  995. cSettings: [
  996. .headerSearchPath("../../"),
  997. ]
  998. ),
  999. // MARK: - Firebase Sessions
  1000. .target(
  1001. name: "FirebaseSessions",
  1002. dependencies: [
  1003. "FirebaseCore",
  1004. "FirebaseInstallations",
  1005. "FirebaseCoreExtension",
  1006. "FirebaseSessionsObjC",
  1007. .product(name: "Promises", package: "Promises"),
  1008. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  1009. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1010. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  1011. ],
  1012. path: "FirebaseSessions/Sources",
  1013. cSettings: [
  1014. .headerSearchPath(".."),
  1015. .define("DISPLAY_VERSION", to: firebaseVersion),
  1016. .define("PB_FIELD_32BIT", to: "1"),
  1017. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1018. .define("PB_ENABLE_MALLOC", to: "1"),
  1019. ],
  1020. linkerSettings: [
  1021. .linkedFramework("Security"),
  1022. .linkedFramework(
  1023. "SystemConfiguration",
  1024. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1025. ),
  1026. ]
  1027. ),
  1028. // The Sessions SDK is Swift-first with Objective-C code to support
  1029. // nanopb. Because Swift Package Manager doesn't support mixed
  1030. // language targets, the ObjC code has been extracted out into
  1031. // a separate target.
  1032. .target(
  1033. name: "FirebaseSessionsObjC",
  1034. dependencies: [
  1035. "FirebaseCore",
  1036. "FirebaseCoreExtension",
  1037. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1038. .product(name: "nanopb", package: "nanopb"),
  1039. ],
  1040. path: "FirebaseSessions",
  1041. exclude: [
  1042. "README.md",
  1043. "Sources/",
  1044. "Tests/",
  1045. "ProtoSupport/",
  1046. "generate_project.sh",
  1047. "generate_protos.sh",
  1048. "generate_testapp.sh",
  1049. ],
  1050. publicHeadersPath: "SourcesObjC",
  1051. cSettings: [
  1052. .headerSearchPath(".."),
  1053. .define("DISPLAY_VERSION", to: firebaseVersion),
  1054. .define("PB_FIELD_32BIT", to: "1"),
  1055. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1056. .define("PB_ENABLE_MALLOC", to: "1"),
  1057. ],
  1058. linkerSettings: [
  1059. .linkedFramework("Security"),
  1060. .linkedFramework(
  1061. "SystemConfiguration",
  1062. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1063. ),
  1064. ]
  1065. ),
  1066. .testTarget(
  1067. name: "FirebaseSessionsUnit",
  1068. dependencies: ["FirebaseSessions"],
  1069. path: "FirebaseSessions/Tests/Unit"
  1070. ),
  1071. // MARK: - Firebase Storage
  1072. .target(
  1073. name: "FirebaseStorage",
  1074. dependencies: [
  1075. "FirebaseAppCheckInterop",
  1076. "FirebaseAuthInterop",
  1077. "FirebaseCore",
  1078. "FirebaseCoreExtension",
  1079. .product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
  1080. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1081. ],
  1082. path: "FirebaseStorage/Sources"
  1083. ),
  1084. .testTarget(
  1085. name: "FirebaseStorageUnit",
  1086. dependencies: ["FirebaseStorage",
  1087. "SharedTestUtilities"],
  1088. path: "FirebaseStorage/Tests/Unit",
  1089. cSettings: [
  1090. .headerSearchPath("../../../"),
  1091. ]
  1092. ),
  1093. .testTarget(
  1094. name: "StorageObjCIntegration",
  1095. dependencies: ["FirebaseStorage"],
  1096. path: "FirebaseStorage/Tests/ObjCIntegration",
  1097. exclude: [
  1098. // See https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730
  1099. "FIRStorageIntegrationTests.m",
  1100. "ObjCPPAPITests.mm",
  1101. "Credentials.h",
  1102. ],
  1103. cSettings: [
  1104. .headerSearchPath("../../.."),
  1105. ]
  1106. ),
  1107. .testTarget(
  1108. name: "swift-test",
  1109. dependencies: [
  1110. "Firebase",
  1111. "FirebaseAuth",
  1112. "FirebaseAppCheck",
  1113. "FirebaseABTesting",
  1114. "FirebaseAnalytics",
  1115. .target(name: "FirebaseAppDistribution",
  1116. condition: .when(platforms: [.iOS])),
  1117. "FirebaseAuthCombineSwift",
  1118. "FirebaseFirestoreCombineSwift",
  1119. "FirebaseFunctionsCombineSwift",
  1120. "FirebaseStorageCombineSwift",
  1121. "FirebaseCrashlytics",
  1122. "FirebaseCore",
  1123. "FirebaseDatabase",
  1124. "FirebaseDynamicLinks",
  1125. "FirebaseFirestoreTarget",
  1126. "FirebaseFunctions",
  1127. .target(name: "FirebaseInAppMessaging",
  1128. condition: .when(platforms: [.iOS, .tvOS])),
  1129. "FirebaseInstallations",
  1130. "FirebaseMessaging",
  1131. .target(name: "FirebasePerformance",
  1132. condition: .when(platforms: [.iOS, .tvOS])),
  1133. "FirebaseRemoteConfig",
  1134. "FirebaseSessions",
  1135. "FirebaseStorage",
  1136. .product(name: "nanopb", package: "nanopb"),
  1137. ],
  1138. path: "SwiftPMTests/swift-test"
  1139. ),
  1140. .testTarget(
  1141. name: "analytics-import-test",
  1142. dependencies: [
  1143. "FirebaseAnalyticsWrapper",
  1144. "Firebase",
  1145. ],
  1146. path: "SwiftPMTests/analytics-import-test"
  1147. ),
  1148. .testTarget(
  1149. name: "objc-import-test",
  1150. dependencies: [
  1151. "Firebase",
  1152. "FirebaseAuth",
  1153. "FirebaseABTesting",
  1154. "FirebaseAppCheck",
  1155. .target(name: "FirebaseAppDistribution",
  1156. condition: .when(platforms: [.iOS])),
  1157. "FirebaseCrashlytics",
  1158. "FirebaseCore",
  1159. "FirebaseDatabase",
  1160. "FirebaseDynamicLinks",
  1161. "FirebaseFirestoreTarget",
  1162. "FirebaseFunctions",
  1163. .target(name: "FirebaseInAppMessaging",
  1164. condition: .when(platforms: [.iOS, .tvOS])),
  1165. "FirebaseInstallations",
  1166. "FirebaseMessaging",
  1167. .target(name: "FirebasePerformance",
  1168. condition: .when(platforms: [.iOS, .tvOS])),
  1169. "FirebaseRemoteConfig",
  1170. "FirebaseStorage",
  1171. ],
  1172. path: "SwiftPMTests/objc-import-test"
  1173. ),
  1174. .testTarget(
  1175. name: "version-test",
  1176. dependencies: [
  1177. "FirebaseCore",
  1178. ],
  1179. path: "SwiftPMTests/version-test",
  1180. cSettings: [
  1181. .define("FIR_VERSION", to: firebaseVersion),
  1182. ]
  1183. ),
  1184. // MARK: - Firebase App Check
  1185. .target(name: "FirebaseAppCheck",
  1186. dependencies: [
  1187. "FirebaseAppCheckInterop",
  1188. "FirebaseCore",
  1189. .product(name: "AppCheckCore", package: "app-check"),
  1190. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1191. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  1192. ],
  1193. path: "FirebaseAppCheck/Sources",
  1194. publicHeadersPath: "Public",
  1195. cSettings: [
  1196. .headerSearchPath("../.."),
  1197. ],
  1198. linkerSettings: [
  1199. .linkedFramework(
  1200. "DeviceCheck",
  1201. .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
  1202. ),
  1203. ]),
  1204. // Internal headers only for consuming from Swift.
  1205. .target(
  1206. name: "FirebaseAppCheckInterop",
  1207. path: "FirebaseAppCheck/Interop",
  1208. exclude: [
  1209. "CMakeLists.txt",
  1210. ],
  1211. publicHeadersPath: "Public",
  1212. cSettings: [
  1213. .headerSearchPath("../../"),
  1214. ]
  1215. ),
  1216. .testTarget(
  1217. name: "FirebaseAppCheckUnit",
  1218. dependencies: [
  1219. "FirebaseAppCheck",
  1220. "SharedTestUtilities",
  1221. .product(name: "OCMock", package: "ocmock"),
  1222. ],
  1223. path: "FirebaseAppCheck/Tests/Unit",
  1224. exclude: [
  1225. // Swift tests are in the target `FirebaseAppCheckUnitSwift` since mixed language targets
  1226. // are not supported (as of Xcode 15.0).
  1227. "Swift",
  1228. ],
  1229. cSettings: [
  1230. .headerSearchPath("../../.."),
  1231. ]
  1232. ),
  1233. .testTarget(
  1234. name: "FirebaseAppCheckUnitSwift",
  1235. dependencies: ["FirebaseAppCheck"],
  1236. path: "FirebaseAppCheck/Tests/Unit/Swift"
  1237. ),
  1238. // MARK: Testing support
  1239. .target(
  1240. name: "FirebaseFirestoreTestingSupport",
  1241. dependencies: ["FirebaseFirestoreTarget"],
  1242. path: "FirebaseTestingSupport/Firestore/Sources",
  1243. publicHeadersPath: "./",
  1244. cSettings: [
  1245. .headerSearchPath("../../.."),
  1246. .headerSearchPath("../../../Firestore/Source/Public/FirebaseFirestore"),
  1247. ]
  1248. ),
  1249. .testTarget(
  1250. name: "FirestoreTestingSupportTests",
  1251. dependencies: ["FirebaseFirestoreTestingSupport"],
  1252. path: "FirebaseTestingSupport/Firestore/Tests",
  1253. cSettings: [
  1254. .headerSearchPath("../../.."),
  1255. ]
  1256. ),
  1257. // MARK: - Firebase Vertex AI
  1258. .target(
  1259. name: "FirebaseVertexAI",
  1260. dependencies: [
  1261. "FirebaseAppCheckInterop",
  1262. "FirebaseAuthInterop",
  1263. "FirebaseCore",
  1264. "FirebaseCoreExtension",
  1265. ],
  1266. path: "FirebaseVertexAI/Sources"
  1267. ),
  1268. .testTarget(
  1269. name: "FirebaseVertexAIUnit",
  1270. dependencies: ["FirebaseVertexAI", "SharedTestUtilities"],
  1271. path: "FirebaseVertexAI/Tests/Unit",
  1272. resources: [
  1273. .process("vertexai-sdk-test-data/mock-responses"),
  1274. ],
  1275. cSettings: [
  1276. .headerSearchPath("../../../"),
  1277. ]
  1278. ),
  1279. .testTarget(
  1280. name: "FirebaseVertexAIIntegration",
  1281. dependencies: ["FirebaseVertexAI"],
  1282. path: "FirebaseVertexAI/Tests/Integration",
  1283. resources: [
  1284. .process("Resources"),
  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.0.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.20240116.1" ..< "0.20240117.0"
  1309. )
  1310. } else {
  1311. packageInfo = (
  1312. "https://github.com/google/abseil-cpp-binary.git",
  1313. "1.2024011602.0" ..< "1.2024011700.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.65.0" ..< "1.66.0")
  1324. } else {
  1325. packageInfo = ("https://github.com/google/grpc-binary.git", "1.65.1" ..< "1.66.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.1.0/pre_rc0/FirebaseFirestoreInternal.zip",
  1458. checksum: "acd39abe17bdf465bc42f9cee055ef18cfa36df33ee2e5a87bac2c4a23cef89e"
  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. }