Skip to content

Commit 2d7b929

Browse files
committed
Add SwiftBuild coverage support
Ensure the SwiftBuild build systam has feature parity with the Native build system as it relates to coverage. Fixes: #9077 Issue: rdar://159461439
1 parent caa4fd1 commit 2d7b929

File tree

5 files changed

+686
-491
lines changed

5 files changed

+686
-491
lines changed

Sources/Commands/SwiftTestCommand.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,6 @@ public struct SwiftTestCommand: AsyncSwiftCommand {
619619
}
620620
}
621621
args += ["-o", productsBuildParameters.codeCovDataFile.pathString]
622-
623622
try await AsyncProcess.checkNonZeroExit(arguments: args)
624623
}
625624

Sources/SwiftBuildSupport/SwiftBuildSystem.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -925,8 +925,8 @@ public final class SwiftBuildSystem: SPMBuildCore.BuildSystem {
925925

926926
private static func constructTestingSettingsOverrides(from parameters: BuildParameters.Testing) -> [String: String] {
927927
var settings: [String: String] = [:]
928-
// TODO: enableCodeCoverage
929-
// explicitlyEnabledTestability
928+
929+
settings["CLANG_COVERAGE_MAPPING"] = parameters.enableCodeCoverage ? "YES" : "NO"
930930

931931
switch parameters.explicitlyEnabledTestability {
932932
case true:

0 commit comments

Comments
 (0)