Package.swift 52 KB

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