Package.swift 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // swift-tools-version: 5.8
  2. import PackageDescription
  3. let package = Package(
  4. name: "PluginExamples",
  5. dependencies: [
  6. .package(path: "../")
  7. ],
  8. targets: targets()
  9. )
  10. private func targets() -> [Target] {
  11. var testDependencies: [Target.Dependency] = [
  12. .target(name: "Simple"),
  13. .target(name: "Nested"),
  14. .target(name: "Import"),
  15. ]
  16. #if compiler(>=5.9)
  17. testDependencies.append(.target(name: "AccessLevelOnImport"))
  18. #endif
  19. var targets: [Target] = [
  20. .testTarget(
  21. name: "ExampleTests",
  22. dependencies: testDependencies
  23. ),
  24. .target(
  25. name: "Simple",
  26. dependencies: [
  27. .product(name: "SwiftProtobuf", package: "swift-protobuf")
  28. ],
  29. plugins: [
  30. .plugin(name: "SwiftProtobufPlugin", package: "swift-protobuf")
  31. ]
  32. ),
  33. .target(
  34. name: "Nested",
  35. dependencies: [
  36. .product(name: "SwiftProtobuf", package: "swift-protobuf")
  37. ],
  38. plugins: [
  39. .plugin(name: "SwiftProtobufPlugin", package: "swift-protobuf")
  40. ]
  41. ),
  42. .target(
  43. name: "Import",
  44. dependencies: [
  45. .product(name: "SwiftProtobuf", package: "swift-protobuf")
  46. ],
  47. plugins: [
  48. .plugin(name: "SwiftProtobufPlugin", package: "swift-protobuf")
  49. ]
  50. ),
  51. ]
  52. #if compiler(>=5.9)
  53. targets.append(
  54. .target(
  55. name: "AccessLevelOnImport",
  56. dependencies: [
  57. .product(name: "SwiftProtobuf", package: "swift-protobuf")
  58. ],
  59. swiftSettings: [
  60. .enableExperimentalFeature("AccessLevelOnImport")
  61. ],
  62. plugins: [
  63. .plugin(name: "SwiftProtobufPlugin", package: "swift-protobuf")
  64. ]
  65. )
  66. )
  67. #endif
  68. return targets
  69. }