Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-968] SwiftPM: Allow users to specify test-only targets #5427

Closed
swift-ci opened this issue Mar 17, 2016 · 2 comments
Closed

[SR-968] SwiftPM: Allow users to specify test-only targets #5427

swift-ci opened this issue Mar 17, 2016 · 2 comments

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-968
Radar None
Original Reporter bppr (JIRA User)
Type New Feature
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 1
Component/s Package Manager
Labels New Feature
Assignee None
Priority Medium

md5: d248170c0dac973ed70706078d031c1c

Issue Description:

It'd be nice to be able to define targets that are built only in test/dev environments, but not as part of a package.

Given a package that specifies test targets (note: actual API is TBD, but here's an example)

let package = Package(
  name: "Example",
  // etc
  targets: [ Target(name: "ExamplePkgTarget") ],
  testTargets: [
    Target(
      name: "ExampleTestTarget",
      dependencies: [
        .Dependency("some-test-dependency"),
        .Target(name: "ExamplePkgTarget")
      ]
    )
  ]
)

When I specify the package as a dependency, then ExamplePkgTarget should be built, and ExampleTestTarget should not be built

When the Example Package is the root package, then both ExamplePkgTarget and ExampleTestTarget should be built.

When a user specifies no test targets, assume (as we do now) that all targets will be built upon distribution.

Test targets should be allowed to link against testDependencies, while "normal" targets should not.

@abertelrud
Copy link
Contributor

This will be important functionality, and I think we'll want a swift-evolution proposal for the semantics around this and in particular the effect on the `PackageDescription` API.

@ankitspd
Copy link
Member

This is possible using .testTarget() API that was released with PackageDescription in Swift 4.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants