swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.65k stars 1.31k forks source link

SwiftPM should only build direct dependencies of a test target as @testable #7718

Open rauhul opened 4 days ago

rauhul commented 4 days ago

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

Description

Given graph A -> B -> BTests. BTests should not be able to testable import A. See the attached repro project. repro.zip

The issue with the current behavior is the following graph causes a huge amount of code to be rebuilt with no value: swift-syntax -> MMIOMacros -> MMIOMacrosTests