Package.swift 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. // swift-tools-version:5.2
  2. // The swift-tools-version declares the minimum version of Swift required to build this package.
  3. import PackageDescription
  4. let package = Package(
  5. name: "Firebase",
  6. platforms: [ .iOS(.v9), .macOS(.v10_11), .tvOS(.v10) ],
  7. products: [
  8. // Products define the executables and libraries produced by a package, and make them visible to
  9. // other packages.
  10. // This is a test-only executable for us to try `swift run` and use all imported modules from a
  11. // Swift target.
  12. .executable(name: "firebase-test", targets: ["firebase-test"]),
  13. ],
  14. dependencies: [
  15. .package(name: "Promises", url: "https://www.github.com/google/promises", from: "1.2.0"),
  16. ],
  17. targets: [
  18. // Targets are the basic building blocks of a package. A target can define a module or a test suite.
  19. // Targets can depend on other targets in this package, and on products in packages which this package depends on.
  20. .target(
  21. name: "firebase-test",
  22. dependencies: [ "GoogleUtilities_AppDelegateSwizzler",
  23. "GoogleUtilities_Environment",
  24. "GoogleUtilities_Logger",
  25. "FirebaseCore"]
  26. ),
  27. // MARK: - Firebase
  28. .target(
  29. name: "FirebaseCore",
  30. dependencies: ["GoogleUtilities_Environment", "GoogleUtilities_Logger"],
  31. // Need to explicitly say `Source` because `Tests` has .swift files and you can't have a mix-language
  32. // target yet.
  33. path: "FirebaseCore/Sources",
  34. publicHeadersPath: "Public",
  35. cSettings: [
  36. .headerSearchPath("../.."), // Root of the repo, needed for Firebase's absolute filepaths.
  37. .define("FIRCore_VERSION", to: "0.0.1"), // TODO Fix version
  38. .define("Firebase_VERSION", to: "0.0.1") // TODO Fix version
  39. // TODO - Add support for cflags cSetting so that we can set the -fno-autolink option
  40. ]),
  41. // MARK: - Google Utilities Sub-targets
  42. .target(
  43. name: "GoogleUtilities_AppDelegateSwizzler",
  44. dependencies: ["GoogleUtilities_Environment", "GoogleUtilities_Logger", "GoogleUtilities_Network"],
  45. path: "GoogleUtilities/AppDelegateSwizzler",
  46. publicHeadersPath: "Private", // Need to expose private headers.
  47. cSettings: [
  48. .headerSearchPath("../..") // Root of the repo, needed for Firebase's absolute filepaths.
  49. ]
  50. ),
  51. .target(
  52. name: "GoogleUtilities_Environment",
  53. dependencies: [ .product(name: "FBLPromises", package: "Promises") ],
  54. path: "GoogleUtilities/Environment",
  55. publicHeadersPath: "Public",
  56. cSettings: [
  57. .headerSearchPath("../..") // Root of the repo, needed for Firebase's absolute filepaths.
  58. ]),
  59. .target(
  60. name: "GoogleUtilities_Logger",
  61. dependencies: ["GoogleUtilities_Environment"],
  62. path: "GoogleUtilities/Logger",
  63. publicHeadersPath: "Public",
  64. cSettings: [
  65. .headerSearchPath("../..") // Root of the repo, needed for Firebase's absolute filepaths.
  66. ]
  67. ),
  68. .target(
  69. name: "GoogleUtilities_NSData",
  70. path: "GoogleUtilities/NSData+zlib",
  71. publicHeadersPath: ".", // All headers are public (there's only one).
  72. cSettings: [
  73. .headerSearchPath("../..") // Root of the repo, needed for Firebase's absolute filepaths.
  74. ],
  75. linkerSettings: [
  76. .linkedLibrary("z"),
  77. ]
  78. ),
  79. .target(
  80. name: "GoogleUtilities_Reachability",
  81. dependencies: ["GoogleUtilities_Logger"],
  82. path: "GoogleUtilities/Reachability",
  83. // We need to expose the private internal headers as public.
  84. publicHeadersPath: "Private",
  85. cSettings: [
  86. .headerSearchPath("../..") // Root of the repo, needed for Firebase's absolute filepaths.
  87. ],
  88. linkerSettings: [
  89. .linkedFramework("SystemConfiguration"),
  90. ]
  91. ),
  92. .target(
  93. name: "GoogleUtilities_Network",
  94. dependencies: ["GoogleUtilities_Logger", "GoogleUtilities_NSData", "GoogleUtilities_Reachability"],
  95. path: "GoogleUtilities/Network",
  96. publicHeadersPath: "Private",
  97. cSettings: [
  98. .headerSearchPath("../..") // Root of the repo, needed for Firebase's absolute filepaths.
  99. ],
  100. linkerSettings: [
  101. .linkedFramework("Security"),
  102. ]
  103. ),
  104. .target(
  105. name: "GoogleUtilities_UserDefaults",
  106. dependencies: ["GoogleUtilities_Logger"],
  107. path: "GoogleUtilities/UserDefaults",
  108. publicHeadersPath: "Private", // Consider renaming "Private" directory to "Public"
  109. cSettings: [
  110. .headerSearchPath("../..") // Root of the repo, needed for Firebase's absolute filepaths.
  111. ]
  112. )
  113. ],
  114. cLanguageStandard: .c99
  115. )