@@ -77,18 +77,20 @@ extension BuildParameters {
77
77
/// Whether to enable code coverage.
78
78
public var enableCodeCoverage : Bool
79
79
80
- /// Whether building for testability is enabled.
81
- public var enableTestability : Bool
80
+ /// Whether building for testability is explicitly enabled or disabled .
81
+ package var explicitlyEnabledTestability : Bool ?
82
82
83
83
/// Whether or not to enable the experimental test output mode.
84
84
public var experimentalTestOutput : Bool
85
85
86
- /// The style of test product to produce.
87
- public var testProductStyle : TestProductStyle
86
+ /// Whether to force test discovery.
87
+ fileprivate var explicitlyEnabledDiscovery : Bool
88
+
89
+ /// The path to the test entry point file, if one was specified explicitly
90
+ /// via `--experimental-test-entry-point-path <file>`.
91
+ fileprivate var explicitlySpecifiedPath : AbsolutePath ?
88
92
89
93
public init (
90
- configuration: BuildConfiguration ,
91
- targetTriple: Triple ,
92
94
enableCodeCoverage: Bool = false ,
93
95
enableTestability: Bool ? = nil ,
94
96
experimentalTestOutput: Bool = false ,
@@ -97,18 +99,29 @@ extension BuildParameters {
97
99
) {
98
100
self . enableCodeCoverage = enableCodeCoverage
99
101
self . experimentalTestOutput = experimentalTestOutput
100
- // decide on testability based on debug/release config
101
- // the goals of this being based on the build configuration is
102
- // that `swift build` followed by a `swift test` will need to do minimal rebuilding
103
- // given that the default configuration for `swift build` is debug
104
- // and that `swift test` normally requires building with testable enabled.
105
- // when building and testing in release mode, one can use the '--disable-testable-imports' flag
106
- // to disable testability in `swift test`, but that requires that the tests do not use the testable imports feature
107
- self . enableTestability = enableTestability ?? ( . debug == configuration)
108
- self . testProductStyle = targetTriple. isDarwin ( ) ? . loadableBundle : . entryPointExecutable(
109
- explicitlyEnabledDiscovery: forceTestDiscovery,
110
- explicitlySpecifiedPath: testEntryPointPath
111
- )
102
+ self . explicitlyEnabledTestability = enableTestability
103
+ self . explicitlyEnabledDiscovery = forceTestDiscovery
104
+ self . explicitlySpecifiedPath = testEntryPointPath
112
105
}
113
106
}
107
+
108
+ /// Whether building for testability is enabled.
109
+ public var enableTestability : Bool {
110
+ // decide on testability based on debug/release config
111
+ // the goals of this being based on the build configuration is
112
+ // that `swift build` followed by a `swift test` will need to do minimal rebuilding
113
+ // given that the default configuration for `swift build` is debug
114
+ // and that `swift test` normally requires building with testable enabled.
115
+ // when building and testing in release mode, one can use the '--disable-testable-imports' flag
116
+ // to disable testability in `swift test`, but that requires that the tests do not use the testable imports feature
117
+ self . testingParameters. explicitlyEnabledTestability ?? ( self . configuration == . debug)
118
+ }
119
+
120
+ /// The style of test product to produce.
121
+ public var testProductStyle : TestProductStyle {
122
+ return triple. isDarwin ( ) ? . loadableBundle : . entryPointExecutable(
123
+ explicitlyEnabledDiscovery: testingParameters. explicitlyEnabledDiscovery,
124
+ explicitlySpecifiedPath: testingParameters. explicitlySpecifiedPath
125
+ )
126
+ }
114
127
}
0 commit comments