Skip to content

[SR-5631] 'swift build' should not build dependencies of test targets #4967

Open
@sharplet

Description

@sharplet
Previous ID SR-5631
Radar rdar://problem/40205281
Original Reporter @sharplet
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Improvement
Assignee None
Priority Medium

md5: a2af221716faab84b949750ebf255c7e

Issue Description:

When using the Swift 4 package manifest format, it's possibly to declare dependencies that are only depended on by test targets. When running swift build (without the --build-tests option), the package manager currently builds all dependencies, regardless of whether they are depended on by the package's public products. This seems like an error, as test dependencies shouldn't need to be built unless I'm running the tests, or I explicitly request them.

This PR demonstrates the issue: sharplet/Regex#60 Here's the output I get from swift build:

sharplet sharplet/Regex (swift4pm)% swift package clean
sharplet sharplet/Regex (swift4pm)% swift build
Compile QuickSpecBase QuickSpecBase.m
Compile Swift Module 'Regex' (7 sources)
Compile Swift Module 'Nimble' (50 sources)
Compile Swift Module 'Quick' (22 sources)

Metadata

Metadata

Assignees

No one assigned

    Labels

    swift buildChanges impacting `swift build`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions