Package.swift 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. // swift-tools-version:5.3
  2. // The swift-tools-version declares the minimum version of Swift required to build this package.
  3. // Copyright 2020 Google LLC
  4. //
  5. // Licensed under the Apache License, Version 2.0 (the "License");
  6. // you may not use this file except in compliance with the License.
  7. // You may obtain a copy of the License at
  8. //
  9. // http://www.apache.org/licenses/LICENSE-2.0
  10. //
  11. // Unless required by applicable law or agreed to in writing, software
  12. // distributed under the License is distributed on an "AS IS" BASIS,
  13. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. // See the License for the specific language governing permissions and
  15. // limitations under the License.
  16. // This Package.swift is a Work in Progress, primarily for CI at this point.
  17. // Those interested in experimenting with Swift Package Manager should use the
  18. // spm-master2020 branch for now.
  19. import PackageDescription
  20. let package = Package(
  21. name: "Firebase",
  22. platforms: [.iOS(.v9), .macOS(.v10_11), .tvOS(.v10)],
  23. products: [
  24. // Products define the executables and libraries produced by a package, and make them visible to
  25. // other packages.
  26. // .library(
  27. // name: "Firebase",
  28. // targets: ["Firebase"]
  29. // ),
  30. .library(
  31. name: "FirebaseCore",
  32. targets: ["FirebaseCore"]
  33. ),
  34. .library(
  35. name: "FirebaseAuth",
  36. targets: ["FirebaseAuth"]
  37. ),
  38. // .library(
  39. // name: "FirebaseCrashlytics",
  40. // targets: ["FirebaseCrashlytics"]
  41. // ),
  42. .library(
  43. name: "FirebaseFunctions",
  44. targets: ["FirebaseFunctions"]
  45. ),
  46. .library(
  47. name: "FirebaseInstallations",
  48. targets: ["FirebaseInstallations"]
  49. ),
  50. // .library(
  51. // name: "FirebaseInstanceID",
  52. // targets: ["FirebaseInstanceID"]
  53. // ),
  54. // .library(
  55. // name: "FirebaseStorage",
  56. // targets: ["FirebaseStorage"]
  57. // ),
  58. .library(name: "FirebaseStorage",
  59. targets: ["FirebaseStorage", "FirebaseCore"]),
  60. .library(
  61. name: "FirebaseStorageSwift",
  62. targets: ["FirebaseStorageSwift"]
  63. ),
  64. ],
  65. dependencies: [
  66. .package(name: "Promises", url: "https://github.com/google/promises.git", "1.2.8" ..< "1.3.0"),
  67. .package(name: "GTMSessionFetcher", url: "https://github.com/google/gtm-session-fetcher.git", "1.4.0" ..< "2.0.0"),
  68. .package(name: "nanopb", url: "https://github.com/paulb777/nanopb.git", .branch("swift-package-manager")),
  69. // Branches need a force update with a run with the revision set like below.
  70. // .package(url: "https://github.com/paulb777/nanopb.git", .revision("564392bd87bd093c308a3aaed3997466efb95f74"))
  71. ],
  72. targets: [
  73. // Targets are the basic building blocks of a package. A target can define a module or a test suite.
  74. // Targets can depend on other targets in this package, and on products in packages which this package depends on.
  75. .testTarget(
  76. name: "firebase-test",
  77. dependencies: [
  78. "FirebaseAuth",
  79. "FirebaseFunctions",
  80. // "Firebase",
  81. "FirebaseCore",
  82. "FirebaseInstallations",
  83. // "FirebaseInstanceID",
  84. "FirebaseStorage",
  85. "FirebaseStorageSwift",
  86. "GoogleUtilities_AppDelegateSwizzler",
  87. "GoogleUtilities_Environment",
  88. // "GoogleUtilities_ISASwizzler", // Build needs to disable ARC.
  89. "GoogleUtilities_Logger",
  90. "GoogleUtilities_MethodSwizzler",
  91. "GoogleUtilities_Network",
  92. "GoogleUtilities_NSData",
  93. "GoogleUtilities_Reachability",
  94. "GoogleUtilities_UserDefaults",
  95. "nanopb",
  96. ]
  97. ),
  98. .target(
  99. name: "GoogleUtilities_AppDelegateSwizzler",
  100. dependencies: ["GoogleUtilities_Environment", "GoogleUtilities_Logger",
  101. "GoogleUtilities_Network"],
  102. path: "GoogleUtilities",
  103. exclude: [
  104. // Due to the directory structure of GoogleUtilities, we now need to explicitly exclude any
  105. // files that aren't part of the `sources` section.
  106. "AppDelegateSwizzler/README.md",
  107. "CHANGELOG.md",
  108. "CMakeLists.txt",
  109. "Environment",
  110. "Example",
  111. "ISASwizzler",
  112. "LICENSE",
  113. "Logger",
  114. "MethodSwizzler",
  115. "NSData+zlib",
  116. "Network",
  117. "README.md",
  118. "Reachability",
  119. "SwizzlerTestHelpers",
  120. "UserDefaults",
  121. ],
  122. sources: [
  123. "AppDelegateSwizzler/",
  124. "SceneDelegateSwizzler/",
  125. "Common/*.h",
  126. ],
  127. publicHeadersPath: "AppDelegateSwizzler/Public",
  128. cSettings: [
  129. .headerSearchPath("../"),
  130. ]
  131. ),
  132. .target(
  133. name: "GoogleUtilities_Environment",
  134. dependencies: [.product(name: "FBLPromises", package: "Promises")],
  135. path: "GoogleUtilities/Environment",
  136. exclude: [ "third_party/LICENSE" ],
  137. publicHeadersPath: "Private",
  138. cSettings: [
  139. .headerSearchPath("../../"),
  140. ]
  141. ),
  142. // Tests need OCMock and resource support.
  143. .target(
  144. name: "GoogleUtilities_Logger",
  145. dependencies: ["GoogleUtilities_Environment"],
  146. path: "GoogleUtilities/Logger",
  147. publicHeadersPath: "Public",
  148. cSettings: [
  149. .headerSearchPath("../../"),
  150. ]
  151. ),
  152. // TODO: ISA_Swizzler requires building without ARC.
  153. .target(
  154. name: "GoogleUtilities_MethodSwizzler",
  155. dependencies: ["GoogleUtilities_Logger"],
  156. path: "GoogleUtilities/MethodSwizzler",
  157. publicHeadersPath: "Private",
  158. cSettings: [
  159. .headerSearchPath("../../"),
  160. ]
  161. ),
  162. .target(
  163. name: "GoogleUtilities_Network",
  164. dependencies: ["GoogleUtilities_Logger", "GoogleUtilities_NSData",
  165. "GoogleUtilities_Reachability"],
  166. path: "GoogleUtilities/Network",
  167. publicHeadersPath: "Public",
  168. cSettings: [
  169. .headerSearchPath("../.."),
  170. ]
  171. // linkerSettings: [
  172. // .linkedFramework("Security"),
  173. // ]
  174. ),
  175. .target(
  176. name: "GoogleUtilities_NSData",
  177. path: "GoogleUtilities/NSData+zlib",
  178. publicHeadersPath: "Public",
  179. cSettings: [
  180. .headerSearchPath("../.."),
  181. ],
  182. linkerSettings: [
  183. .linkedLibrary("z"),
  184. ]
  185. ),
  186. .target(
  187. name: "GoogleUtilities_Reachability",
  188. dependencies: ["GoogleUtilities_Logger"],
  189. path: "GoogleUtilities/Reachability",
  190. publicHeadersPath: "Private",
  191. cSettings: [
  192. .headerSearchPath("../../"),
  193. ]
  194. ),
  195. .target(
  196. name: "GoogleUtilities_UserDefaults",
  197. dependencies: ["GoogleUtilities_Logger"],
  198. path: "GoogleUtilities/UserDefaults",
  199. publicHeadersPath: "Private",
  200. cSettings: [
  201. .headerSearchPath("../../"),
  202. ]
  203. ),
  204. // .target(
  205. // name: "Firebase",
  206. // path: "Firebase/Sources",
  207. // publicHeadersPath: "Public"
  208. // ),
  209. .target(
  210. name: "FirebaseCore",
  211. dependencies: ["GoogleUtilities_Environment", "GoogleUtilities_Logger"],
  212. path: "FirebaseCore/Sources",
  213. publicHeadersPath: "Public",
  214. cSettings: [
  215. .headerSearchPath("../.."),
  216. .define("FIRCore_VERSION", to: "0.0.1"), // TODO: Fix version
  217. .define("Firebase_VERSION", to: "0.0.1"), // TODO: Fix version
  218. // TODO: - Add support for cflags cSetting so that we can set the -fno-autolink option
  219. ]
  220. ),
  221. .target(
  222. name: "FirebaseAuth",
  223. dependencies: ["FirebaseCore",
  224. "GoogleUtilities_Environment",
  225. "GoogleUtilities_AppDelegateSwizzler",
  226. .product(name: "GTMSessionFetcherCore", package: "GTMSessionFetcher")],
  227. path: "FirebaseAuth/Sources",
  228. publicHeadersPath: "Public",
  229. cSettings: [
  230. .headerSearchPath("../../"),
  231. .define("FIRAuth_VERSION", to: "0.0.1"), // TODO: Fix version
  232. .define("FIRAuth_MINOR_VERSION", to: "1.1"), // TODO: Fix version
  233. ]
  234. ),
  235. .target(
  236. name: "FirebaseFunctions",
  237. dependencies: ["FirebaseCore",
  238. .product(name: "GTMSessionFetcherCore", package: "GTMSessionFetcher")],
  239. path: "Functions/FirebaseFunctions",
  240. publicHeadersPath: "Public",
  241. cSettings: [
  242. .headerSearchPath("../../"),
  243. .define("FIRFunctions_VERSION", to: "0.0.1"), // TODO: Fix version
  244. ]
  245. ),
  246. // .target(
  247. // name: "FirebaseInstanceID",
  248. // dependencies: ["FirebaseCore", "FirebaseInstallations",
  249. // "GoogleUtilities_Environment", "GoogleUtilities_UserDefaults"],
  250. // path: "Firebase/InstanceID",
  251. // publicHeadersPath: "Public",
  252. // cSettings: [
  253. // .headerSearchPath("../../"),
  254. // .define("FIRInstanceID_LIB_VERSION", to: "0.0.1"), // TODO: Fix version
  255. // ]
  256. // ),
  257. .target(
  258. name: "FirebaseInstallations",
  259. dependencies: ["FirebaseCore",
  260. .product(name: "FBLPromises", package: "Promises"),
  261. "GoogleUtilities_Environment", "GoogleUtilities_UserDefaults"],
  262. path: "FirebaseInstallations/Source/Library",
  263. publicHeadersPath: "Public",
  264. cSettings: [
  265. .headerSearchPath("../../../"),
  266. ]
  267. ),
  268. // .target(
  269. // name: "FirebaseStorage",
  270. // dependencies: ["FirebaseCore", .
  271. // product(name: "GTMSessionFetcherCore", package: "GTMSessionFetcher")],
  272. // path: "FirebaseStorage/Sources",
  273. // publicHeadersPath: "Public",
  274. // cSettings: [
  275. // .headerSearchPath("../../"),
  276. // .define("FIRStorage_VERSION", to: "0.0.1"), // TODO: Fix version
  277. // ]
  278. // ),
  279. .binaryTarget(
  280. name: "FirebaseStorage",
  281. url: "https://dl.google.com/firebase/ios/swiftpm/6.27.0/FirebaseStorage.zip",
  282. checksum: "5179d686b874bc58aa42eed039cf122c89b51c6cc0e76c038c5955c85bdbd5e1"
  283. ),
  284. .target(
  285. name: "FirebaseStorageSwift",
  286. dependencies: ["FirebaseStorage"],
  287. path: "FirebaseStorageSwift/Sources"
  288. ),
  289. // .target(
  290. // name: "GoogleDataTransport",
  291. // path: "GoogleDataTransport/GDTCORLibrary",
  292. // publicHeadersPath: "Public",
  293. // cSettings: [
  294. // .headerSearchPath("../"),
  295. // .define("GDTCOR_VERSION", to: "0.0.1"),
  296. // ]
  297. // ),
  298. // .target(
  299. // name: "GoogleDataTransportCCTSupport",
  300. // dependencies: ["GoogleDataTransport", "nanopb"],
  301. // path: "GoogleDataTransportCCTSupport/GDTCCTLibrary",
  302. // cSettings: [
  303. // .headerSearchPath("../"),
  304. // .define("PB_FIELD_32BIT", to: "1"),
  305. // .define("PB_NO_PACKED_STRUCTS", to: "1"),
  306. // .define("PB_ENABLE_MALLOC", to: "1"),
  307. // ]
  308. // ),
  309. // linkerSettings: [
  310. // .linkedFramework("CoreServices", .when(platforms: [.macOS])),
  311. // .linkedFramework("MobileCoreServices", .when(platforms: [.iOS, .tvOS])),
  312. // ]),
  313. ],
  314. cLanguageStandard: .c99
  315. )