Skip to content

Add devDependencies support in SwiftPM #7007

Open
@Kyle-Ye

Description

@Kyle-Ye

Description

context: swiftlang/swift-markdown#153 (comment)

When integrating swift-testing into a library, the downstream user of the library will also get the dependency for swift-testing and its dependency(SwiftSyntax)

I propose to add a new devDependencies parameters for the existing Package model.

"devDependencies" is only used for development and testing. And it can't be used on target which will be exported via the products.

Other Languages and Package Manager have the same idea
See npm

Expected behavior

dependencies: [
  .package(xx),
],
// devDependencies can't be used on targets exposed by products
devDependencies: [ // or testDependencies
  .package(url: "https://github.com/apple/swift-testing.git", branch: "main"),
]

Actual behavior

dependencies: [
  .package(xx),
  // the dependency for swift-testing and its dependency(SwiftSyntax) will also be exported
  .package(url: "https://github.com/apple/swift-testing.git", branch: "main"),
],

Steps to reproduce

No response

Swift Package Manager version/commit hash

5.9

Swift & OS version (output of swift --version && uname -a)

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions