Package.swift 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356
  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",
  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. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  920. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  921. .product(name: "GULISASwizzler", package: "GoogleUtilities"),
  922. .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
  923. .product(name: "GULUserDefaults", package: "GoogleUtilities"),
  924. .product(name: "nanopb", package: "nanopb"),
  925. ],
  926. path: "FirebasePerformance/Sources",
  927. publicHeadersPath: "Public",
  928. cSettings: [
  929. .headerSearchPath("../../"),
  930. .define("PB_FIELD_32BIT", to: "1"),
  931. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  932. .define("PB_ENABLE_MALLOC", to: "1"),
  933. .define("FIRPerformance_LIB_VERSION", to: firebaseVersion),
  934. ],
  935. linkerSettings: [
  936. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .tvOS])),
  937. .linkedFramework("MobileCoreServices", .when(platforms: [.iOS, .tvOS])),
  938. .linkedFramework("QuartzCore", .when(platforms: [.iOS, .tvOS])),
  939. ]
  940. ),
  941. .testTarget(
  942. name: "PerformanceUnit",
  943. dependencies: [
  944. "FirebasePerformanceTarget",
  945. "OCMock",
  946. "SharedTestUtilities",
  947. "GCDWebServer",
  948. ],
  949. path: "FirebasePerformance/Tests/Unit",
  950. resources: [
  951. .process("FPRURLFilterTests-Info.plist"),
  952. .process("Server/smallDownloadFile"),
  953. .process("Server/bigDownloadFile"),
  954. ],
  955. cSettings: [
  956. .headerSearchPath("../../.."),
  957. .define("PB_FIELD_32BIT", to: "1"),
  958. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  959. .define("PB_ENABLE_MALLOC", to: "1"),
  960. ]
  961. ),
  962. .target(
  963. name: "SharedTestUtilities",
  964. dependencies: ["FirebaseCore",
  965. "FirebaseAppCheckInterop",
  966. "FirebaseAuthInterop",
  967. "FirebaseMessagingInterop",
  968. "GoogleDataTransport",
  969. "OCMock"],
  970. path: "SharedTestUtilities",
  971. publicHeadersPath: "./",
  972. cSettings: [
  973. .headerSearchPath("../"),
  974. ]
  975. ),
  976. // MARK: - Firebase Remote Config
  977. .target(
  978. name: "FirebaseRemoteConfig",
  979. dependencies: [
  980. "FirebaseCore",
  981. "FirebaseABTesting",
  982. "FirebaseInstallations",
  983. .product(name: "GULNSData", package: "GoogleUtilities"),
  984. ],
  985. path: "FirebaseRemoteConfig/Sources",
  986. publicHeadersPath: "Public",
  987. cSettings: [
  988. .headerSearchPath("../../"),
  989. ]
  990. ),
  991. .testTarget(
  992. name: "RemoteConfigUnit",
  993. dependencies: ["FirebaseRemoteConfig", "OCMock"],
  994. path: "FirebaseRemoteConfig/Tests/Unit",
  995. exclude: [
  996. // Need to be evaluated/ported to RC V2.
  997. "RCNConfigAnalyticsTest.m",
  998. "RCNConfigSettingsTest.m",
  999. "RCNConfigTest.m",
  1000. "RCNRemoteConfig+FIRAppTest.m",
  1001. "RCNThrottlingTests.m",
  1002. ],
  1003. resources: [
  1004. .process("SecondApp-GoogleService-Info.plist"),
  1005. .process("Defaults-testInfo.plist"),
  1006. .process("TestABTPayload.txt"),
  1007. ],
  1008. cSettings: [
  1009. .headerSearchPath("../../.."),
  1010. ]
  1011. ),
  1012. .target(
  1013. name: "FirebaseRemoteConfigSwift",
  1014. dependencies: [
  1015. "FirebaseRemoteConfig",
  1016. "FirebaseSharedSwift",
  1017. ],
  1018. path: "FirebaseRemoteConfigSwift/Sources"
  1019. ),
  1020. .testTarget(
  1021. name: "RemoteConfigFakeConsole",
  1022. dependencies: ["FirebaseRemoteConfigSwift",
  1023. "RemoteConfigFakeConsoleObjC"],
  1024. path: "FirebaseRemoteConfigSwift/Tests",
  1025. exclude: [
  1026. "AccessToken.json",
  1027. "README.md",
  1028. "ObjC/",
  1029. ],
  1030. resources: [
  1031. .process("Defaults-testInfo.plist"),
  1032. ],
  1033. cSettings: [
  1034. .headerSearchPath("../../"),
  1035. ]
  1036. ),
  1037. .target(
  1038. name: "RemoteConfigFakeConsoleObjC",
  1039. dependencies: ["OCMock"],
  1040. path: "FirebaseRemoteConfigSwift/Tests/ObjC",
  1041. publicHeadersPath: ".",
  1042. cSettings: [
  1043. .headerSearchPath("../../../"),
  1044. ]
  1045. ),
  1046. // MARK: - Firebase Sessions
  1047. .target(
  1048. name: "FirebaseSessions",
  1049. dependencies: [
  1050. "FirebaseCore",
  1051. "FirebaseInstallations",
  1052. "FirebaseCoreExtension",
  1053. "FirebaseSessionsObjC",
  1054. .product(name: "Promises", package: "Promises"),
  1055. .product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
  1056. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1057. ],
  1058. path: "FirebaseSessions/Sources",
  1059. cSettings: [
  1060. .headerSearchPath(".."),
  1061. .define("DISPLAY_VERSION", to: firebaseVersion),
  1062. .define("PB_FIELD_32BIT", to: "1"),
  1063. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1064. .define("PB_ENABLE_MALLOC", to: "1"),
  1065. ],
  1066. linkerSettings: [
  1067. .linkedFramework("Security"),
  1068. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  1069. ]
  1070. ),
  1071. // The Sessions SDK is Swift-first with Objective-C code to support
  1072. // nanopb. Because Swift Package Manager doesn't support mixed
  1073. // language targets, the ObjC code has been extracted out into
  1074. // a separate target.
  1075. .target(
  1076. name: "FirebaseSessionsObjC",
  1077. dependencies: [
  1078. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1079. .product(name: "nanopb", package: "nanopb"),
  1080. ],
  1081. path: "FirebaseSessions",
  1082. exclude: [
  1083. "README.md",
  1084. "Sources/",
  1085. "Tests/",
  1086. "ProtoSupport/",
  1087. "generate_project.sh",
  1088. "generate_protos.sh",
  1089. "generate_testapp.sh",
  1090. ],
  1091. publicHeadersPath: "SourcesObjC",
  1092. cSettings: [
  1093. .headerSearchPath(".."),
  1094. .define("DISPLAY_VERSION", to: firebaseVersion),
  1095. .define("PB_FIELD_32BIT", to: "1"),
  1096. .define("PB_NO_PACKED_STRUCTS", to: "1"),
  1097. .define("PB_ENABLE_MALLOC", to: "1"),
  1098. ],
  1099. linkerSettings: [
  1100. .linkedFramework("Security"),
  1101. .linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
  1102. ]
  1103. ),
  1104. .testTarget(
  1105. name: "FirebaseSessionsUnit",
  1106. dependencies: ["FirebaseSessions"],
  1107. path: "FirebaseSessions/Tests/Unit"
  1108. ),
  1109. // MARK: - Firebase Storage
  1110. .target(
  1111. name: "FirebaseStorage",
  1112. dependencies: [
  1113. "FirebaseAppCheckInterop",
  1114. "FirebaseAuthInterop",
  1115. "FirebaseCore",
  1116. "FirebaseCoreExtension",
  1117. .product(name: "GTMSessionFetcherCore", package: "GTMSessionFetcher"),
  1118. ],
  1119. path: "FirebaseStorage/Sources"
  1120. ),
  1121. .testTarget(
  1122. name: "FirebaseStorageUnit",
  1123. dependencies: ["FirebaseStorage",
  1124. "SharedTestUtilities"],
  1125. path: "FirebaseStorage/Tests/Unit",
  1126. cSettings: [
  1127. .headerSearchPath("../../../"),
  1128. ]
  1129. ),
  1130. .testTarget(
  1131. name: "StorageObjCIntegration",
  1132. dependencies: ["FirebaseStorage"],
  1133. path: "FirebaseStorage/Tests/ObjCIntegration",
  1134. exclude: [
  1135. // See https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730
  1136. "FIRStorageIntegrationTests.m",
  1137. "ObjCPPAPITests.mm",
  1138. "Credentials.h",
  1139. ],
  1140. cSettings: [
  1141. .headerSearchPath("../../.."),
  1142. ]
  1143. ),
  1144. .testTarget(
  1145. name: "swift-test",
  1146. dependencies: [
  1147. "Firebase",
  1148. "FirebaseAuth",
  1149. "FirebaseAppCheck",
  1150. "FirebaseABTesting",
  1151. "FirebaseAnalytics",
  1152. "FirebaseAnalyticsSwift",
  1153. .target(name: "FirebaseAppDistribution",
  1154. condition: .when(platforms: [.iOS])),
  1155. "FirebaseAuthCombineSwift",
  1156. "FirebaseFirestoreCombineSwift",
  1157. "FirebaseFunctionsCombineSwift",
  1158. "FirebaseStorageCombineSwift",
  1159. "FirebaseCrashlytics",
  1160. "FirebaseCore",
  1161. "FirebaseDatabase",
  1162. "FirebaseDynamicLinks",
  1163. "FirebaseFirestore",
  1164. "FirebaseFirestoreSwift",
  1165. "FirebaseFunctions",
  1166. "FirebaseInAppMessaging",
  1167. .target(name: "FirebaseInAppMessagingSwift",
  1168. condition: .when(platforms: [.iOS, .tvOS])),
  1169. "FirebaseInstallations",
  1170. "FirebaseMessaging",
  1171. .target(name: "FirebasePerformance",
  1172. condition: .when(platforms: [.iOS, .tvOS])),
  1173. "FirebaseRemoteConfig",
  1174. "FirebaseSessions",
  1175. "FirebaseStorage",
  1176. .product(name: "nanopb", package: "nanopb"),
  1177. ],
  1178. path: "SwiftPMTests/swift-test"
  1179. ),
  1180. .testTarget(
  1181. name: "analytics-import-test",
  1182. dependencies: [
  1183. "FirebaseAnalyticsSwiftTarget",
  1184. "FirebaseAnalyticsWrapper",
  1185. "Firebase",
  1186. ],
  1187. path: "SwiftPMTests/analytics-import-test"
  1188. ),
  1189. .testTarget(
  1190. name: "objc-import-test",
  1191. dependencies: [
  1192. "Firebase",
  1193. "FirebaseAuth",
  1194. "FirebaseABTesting",
  1195. "FirebaseAppCheck",
  1196. .target(name: "FirebaseAppDistribution",
  1197. condition: .when(platforms: [.iOS])),
  1198. "FirebaseCrashlytics",
  1199. "FirebaseCore",
  1200. "FirebaseDatabase",
  1201. "FirebaseDynamicLinks",
  1202. "FirebaseFirestore",
  1203. "FirebaseFunctions",
  1204. "FirebaseInAppMessaging",
  1205. "FirebaseInstallations",
  1206. "FirebaseMessaging",
  1207. .target(name: "FirebasePerformance",
  1208. condition: .when(platforms: [.iOS, .tvOS])),
  1209. "FirebaseRemoteConfig",
  1210. "FirebaseStorage",
  1211. ],
  1212. path: "SwiftPMTests/objc-import-test"
  1213. ),
  1214. .testTarget(
  1215. name: "version-test",
  1216. dependencies: [
  1217. "FirebaseCore",
  1218. ],
  1219. path: "SwiftPMTests/version-test",
  1220. cSettings: [
  1221. .define("FIR_VERSION", to: firebaseVersion),
  1222. ]
  1223. ),
  1224. // MARK: - Firebase App Check
  1225. .target(name: "FirebaseAppCheck",
  1226. dependencies: [
  1227. "FirebaseCore",
  1228. .product(name: "FBLPromises", package: "Promises"),
  1229. .product(name: "GULEnvironment", package: "GoogleUtilities"),
  1230. ],
  1231. path: "FirebaseAppCheck/Sources",
  1232. publicHeadersPath: "Public",
  1233. cSettings: [
  1234. .headerSearchPath("../.."),
  1235. ],
  1236. linkerSettings: [
  1237. .linkedFramework("DeviceCheck", .when(platforms: [.iOS, .macOS, .tvOS])),
  1238. ]),
  1239. // Internal headers only for consuming from Swift.
  1240. .target(
  1241. name: "FirebaseAppCheckInterop",
  1242. path: "FirebaseAppCheck/Interop",
  1243. exclude: [
  1244. "CMakeLists.txt",
  1245. ],
  1246. publicHeadersPath: ".",
  1247. cSettings: [
  1248. .headerSearchPath("../../"),
  1249. ]
  1250. ),
  1251. .testTarget(
  1252. name: "AppCheckUnit",
  1253. dependencies: [
  1254. "FirebaseAppCheck",
  1255. "OCMock",
  1256. "SharedTestUtilities",
  1257. "HeartbeatLoggingTestUtils",
  1258. ],
  1259. path: "FirebaseAppCheck/Tests",
  1260. exclude: [
  1261. // Disable Swift tests as mixed targets are not supported (Xcode 12.3).
  1262. "Unit/Swift",
  1263. ],
  1264. resources: [
  1265. .process("Fixture"),
  1266. ],
  1267. cSettings: [
  1268. .headerSearchPath("../.."),
  1269. ]
  1270. ),
  1271. .testTarget(
  1272. name: "AppCheckUnitSwift",
  1273. dependencies: ["FirebaseAppCheck"],
  1274. path: "FirebaseAppCheck/Tests/Unit/Swift",
  1275. cSettings: [
  1276. .headerSearchPath("../.."),
  1277. ]
  1278. ),
  1279. // MARK: Testing support
  1280. .target(
  1281. name: "FirebaseFirestoreTestingSupport",
  1282. dependencies: ["FirebaseFirestore"],
  1283. path: "FirebaseTestingSupport/Firestore/Sources",
  1284. publicHeadersPath: "./",
  1285. cSettings: [
  1286. .headerSearchPath("../../.."),
  1287. .headerSearchPath("../../../Firestore/Source/Public/FirebaseFirestore"),
  1288. ]
  1289. ),
  1290. .testTarget(
  1291. name: "FirestoreTestingSupportTests",
  1292. dependencies: ["FirebaseFirestoreTestingSupport"],
  1293. path: "FirebaseTestingSupport/Firestore/Tests",
  1294. cSettings: [
  1295. .headerSearchPath("../../.."),
  1296. ]
  1297. ),
  1298. ],
  1299. cLanguageStandard: .c99,
  1300. cxxLanguageStandard: CXXLanguageStandard.gnucxx14
  1301. )
  1302. if ProcessInfo.processInfo.environment["FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT"] != nil {
  1303. if let GoogleAppMeasurementIndex = package.dependencies
  1304. .firstIndex(where: { $0.name == "GoogleAppMeasurement" }) {
  1305. package.dependencies[GoogleAppMeasurementIndex] = .package(
  1306. name: "GoogleAppMeasurement",
  1307. url: "https://github.com/google/GoogleAppMeasurement.git",
  1308. .branch("main")
  1309. )
  1310. }
  1311. }