Package.swift 41 KB

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