File tree Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -986,9 +986,9 @@ extension BuildPlan {
986
986
}
987
987
988
988
for module in package . modules {
989
- if case . test = module . underlying . type ,
990
- !graph . rootPackages . contains ( id : package . id )
991
- {
989
+ // Tests are discovered through an aggregate product which also
990
+ // informs their destination.
991
+ if case . test = module . underlying . type {
992
992
continue
993
993
}
994
994
@@ -1002,7 +1002,7 @@ extension BuildPlan {
1002
1002
for product: ResolvedProduct ,
1003
1003
destination: Destination
1004
1004
) -> [ TraversalNode ] {
1005
- guard destination == . host else {
1005
+ guard destination == . host || product . underlying . type == . test else {
1006
1006
return [ ]
1007
1007
}
1008
1008
Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ package func macrosTestsPackageGraph() throws -> MockPackageGraph {
137
137
" /swift-mmio/Sources/MMIOMacros/source.swift " ,
138
138
" /swift-mmio/Sources/MMIOMacrosTests/source.swift " ,
139
139
" /swift-mmio/Sources/MMIOMacro+PluginTests/source.swift " ,
140
+ " /swift-mmio/Sources/NOOPTests/source.swift " ,
140
141
" /swift-syntax/Sources/SwiftSyntax/source.swift " ,
141
142
" /swift-syntax/Sources/SwiftSyntaxMacrosTestSupport/source.swift " ,
142
143
" /swift-syntax/Sources/SwiftSyntaxMacros/source.swift " ,
@@ -203,6 +204,11 @@ package func macrosTestsPackageGraph() throws -> MockPackageGraph {
203
204
. target( name: " MMIOMacros " )
204
205
] ,
205
206
type: . test
207
+ ) ,
208
+ TargetDescription (
209
+ name: " NOOPTests " ,
210
+ dependencies: [ ] ,
211
+ type: . test
206
212
)
207
213
]
208
214
) ,
Original file line number Diff line number Diff line change @@ -295,9 +295,15 @@ final class CrossCompilationBuildPlanTests: XCTestCase {
295
295
fileSystem: fs,
296
296
observabilityScope: scope
297
297
)
298
+
299
+ // Make sure that build plan doesn't have any "target" tests.
300
+ for (_, description) in plan. targetMap where description. module. underlying. type == . test {
301
+ XCTAssertEqual ( description. buildParameters. destination, . host)
302
+ }
303
+
298
304
let result = try BuildPlanResult ( plan: plan)
299
305
result. checkProductsCount ( 2 )
300
- result. checkTargetsCount ( 16 )
306
+ result. checkTargetsCount ( 17 )
301
307
302
308
XCTAssertTrue ( try result. allTargets ( named: " SwiftSyntax " )
303
309
. map { try $0. swift ( ) }
You can’t perform that action at this time.
0 commit comments