Package.swift 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // swift-tools-version: 5.8
  2. // Package.swift
  3. //
  4. // Copyright (c) 2024 Apple Inc. and the project authors
  5. // Licensed under Apache License v2.0 with Runtime Library Exception
  6. //
  7. // See LICENSE.txt for license information:
  8. // https://github.com/apple/swift-protobuf/blob/main/LICENSE.txt
  9. import PackageDescription
  10. #if compiler(>=5.9)
  11. let package = Package(
  12. name: "CompileTests",
  13. dependencies: [
  14. .package(path: "../..")
  15. ],
  16. targets: [
  17. .executableTarget(
  18. name: "InternalImportsByDefault",
  19. dependencies: [
  20. .product(name: "SwiftProtobuf", package: "swift-protobuf")
  21. ],
  22. exclude: [
  23. "Protos/SomeProtoWithBytes.proto",
  24. "Protos/ServiceOnly.proto",
  25. ],
  26. swiftSettings: [
  27. .enableExperimentalFeature("InternalImportsByDefault"),
  28. .enableExperimentalFeature("AccessLevelOnImport"),
  29. // Enable warnings as errors so the build fails if warnings are
  30. // present in generated code.
  31. .unsafeFlags(["-warnings-as-errors"]),
  32. ],
  33. plugins: [
  34. .plugin(name: "SwiftProtobufPlugin", package: "swift-protobuf")
  35. ]
  36. )
  37. ]
  38. )
  39. #else
  40. let package = Package(
  41. name: "CompileTests",
  42. targets: [
  43. .executableTarget(
  44. name: "InternalImportsByDefault",
  45. exclude: [
  46. "swift-protobuf-config.json",
  47. "Protos/SomeProtoWithBytes.proto",
  48. "Protos/ServiceOnly.proto",
  49. ]
  50. )
  51. ]
  52. )
  53. #endif