@@ -496,7 +496,7 @@ extension SwiftExecuteTestAsyncCommand {
496
496
try swiftCommandState. fileSystem. removeFileTree ( productsBuildParameters. codeCovPath)
497
497
}
498
498
499
- if self . shouldSkipTestExecution {
499
+ if ! self . shouldSkipTestExecution {
500
500
try await run (
501
501
swiftCommandState,
502
502
buildParameters: productsBuildParameters,
@@ -656,9 +656,12 @@ extension SwiftExecuteTestAsyncCommand {
656
656
let llvmCov = try toolchain. getLLVMCov ( )
657
657
658
658
// Get all production source files from test targets
659
+ let buildSystem = try await swiftCommandState. createBuildSystem ( )
660
+ let packageGraph = try await buildSystem. getPackageGraph ( )
661
+
659
662
let sourceFiles = try await getProductionSourceFiles (
660
663
testProducts: testProducts,
661
- swiftCommandState : swiftCommandState
664
+ packageGraph : packageGraph ,
662
665
)
663
666
let configuration = try await self . getCodeCoverageConfiguration ( swiftCommandState, format: . html)
664
667
for product in testProducts {
@@ -681,11 +684,8 @@ extension SwiftExecuteTestAsyncCommand {
681
684
/// Gets all production source files from test targets and their dependencies.
682
685
private func getProductionSourceFiles(
683
686
testProducts: [ BuiltTestProduct ] ,
684
- swiftCommandState : SwiftCommandState
687
+ packageGraph : ModulesGraph ,
685
688
) async throws -> [ AbsolutePath ] {
686
- let buildSystem = try await swiftCommandState. createBuildSystem ( )
687
- let packageGraph = try await buildSystem. getPackageGraph ( )
688
-
689
689
var sourceFiles = Set < AbsolutePath > ( )
690
690
691
691
// Get all modules from root packages that are not test modules
@@ -819,7 +819,7 @@ extension SwiftExecuteTestAsyncCommand {
819
819
// Add all the production source files of the test targets
820
820
args. append ( contentsOf: sourceFiles. map { $0. pathString } )
821
821
822
- print ( " Generating HTML report. calling >>> \( args) " )
822
+ // print("Generating HTML report. calling >>> \(args)")
823
823
let result = try await AsyncProcess . popen ( arguments: args)
824
824
825
825
if result. exitStatus != . terminated( code: 0 ) {
@@ -968,19 +968,17 @@ public struct SwiftTestCommand: SwiftExecuteTestAsyncCommand {
968
968
var options : TestCommandOptions
969
969
970
970
/// Whether to enable code coverage.
971
- @Flag ( name: . customLong( " code-coverage " ) ,
972
- inversion: . prefixedEnableDisable,
973
- help: " Enable code coverage. " )
974
- var isCovEnabled : Bool = false
971
+ @Flag (
972
+ name: . customLong( " code-coverage " ) ,
973
+ inversion: . prefixedEnableDisable,
974
+ help: " Enable code coverage. " ,
975
+ )
976
+ var isCodeCoverageEnabled : Bool = false
975
977
976
978
@OptionGroup ( title: " Coverage Options " )
977
979
var coverageOptions : CoverageOptions
978
980
979
981
980
- var isCodeCoverageEnabled : Bool {
981
- self . isCovEnabled
982
- }
983
-
984
982
var shouldSkipTestExecution : Bool { false }
985
983
986
984
public func run( _ swiftCommandState: CoreCommands . SwiftCommandState ) async throws {
@@ -1023,18 +1021,14 @@ extension SwiftTestCommand {
1023
1021
name: . customLong( " skip-test-execution " ) ,
1024
1022
help: " Skip test execution. " ,
1025
1023
)
1026
- var skipTestExecution : Bool = false
1024
+ var shouldSkipTestExecution : Bool = false
1027
1025
1028
1026
@OptionGroup ( title: " Coverage Options " )
1029
1027
var coverageOptions : CoverageOptions
1030
1028
1031
1029
1032
1030
var isCodeCoverageEnabled : Bool { true }
1033
1031
1034
- var shouldSkipTestExecution : Bool {
1035
- !skipTestExecution
1036
- }
1037
-
1038
1032
public func run( _ swiftCommandState: CoreCommands . SwiftCommandState ) async throws {
1039
1033
try await self . run (
1040
1034
swiftCommandState,
0 commit comments