Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the option to enable/disable the main thread checker from the gen…
…erated schemes (#1382) * Update the models in ProjectDescription to add support for enabling the main thread checker * Set disableMainThreadChecker depending on the given diagnostic options * Fix tests * Add unit tests * Update documentation * Update CHANGELOG Co-authored-by: Pedro Piñera <pedro@ppinera.es>
- Loading branch information
Pedro Piñera Buendía
and
Pedro Piñera
committed
May 27, 2020
1 parent
cd60082
commit dac7cb4
Showing
18 changed files
with
229 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,48 @@ | ||
import Foundation | ||
|
||
/// It represents the test action of a scheme. | ||
public struct RunAction: Equatable, Codable { | ||
/// Name of the configuration that should be used for building the runnable targets. | ||
public let configurationName: String | ||
|
||
/// Executable that will be run. | ||
public let executable: TargetReference? | ||
|
||
/// Arguments passed to the process running the app. | ||
public let arguments: Arguments? | ||
|
||
/// Diagnostics options. | ||
public let diagnosticsOptions: [SchemeDiagnosticsOption] | ||
|
||
/// Initializes a new instance of a run action. | ||
/// - Parameters: | ||
/// - configurationName: Name of the configuration that should be used for building the runnable targets. | ||
/// - executable: Executable that will be run. | ||
/// - arguments: Arguments passed to the process running the app. | ||
/// - diagnosticsOptions: Diagnostics options. | ||
public init(configurationName: String, | ||
executable: TargetReference? = nil, | ||
arguments: Arguments? = nil) { | ||
arguments: Arguments? = nil, | ||
diagnosticsOptions: [SchemeDiagnosticsOption] = []) { | ||
self.configurationName = configurationName | ||
self.executable = executable | ||
self.arguments = arguments | ||
self.diagnosticsOptions = diagnosticsOptions | ||
} | ||
|
||
/// Initializes a new instance of a run action. | ||
/// - Parameters: | ||
/// - config: Configuration that should be used for building the test targets. | ||
/// - executable: Executable that will be run. | ||
/// - arguments: Arguments passed to the process running the app. | ||
/// - diagnosticsOptions: Diagnostics options. | ||
public init(config: PresetBuildConfiguration = .debug, | ||
executable: TargetReference? = nil, | ||
arguments: Arguments? = nil) { | ||
arguments: Arguments? = nil, | ||
diagnosticsOptions: [SchemeDiagnosticsOption] = []) { | ||
self.init(configurationName: config.name, | ||
executable: executable, | ||
arguments: arguments) | ||
arguments: arguments, | ||
diagnosticsOptions: diagnosticsOptions) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Foundation | ||
|
||
public enum SchemeDiagnosticsOption: String, Equatable, Codable { | ||
/// Enable the main thread cheker | ||
case mainThreadChecker | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,84 @@ | ||
import Foundation | ||
|
||
/// It represents the test action of a scheme. | ||
public struct TestAction: Equatable, Codable { | ||
/// List of targets to be tested. | ||
public let targets: [TestableTarget] | ||
|
||
/// Arguments passed to the process running the tests. | ||
public let arguments: Arguments? | ||
|
||
/// Name of the configuration that should be used for building the test targets. | ||
public let configurationName: String | ||
|
||
/// True to collect the test coverage results. | ||
public let coverage: Bool | ||
|
||
/// List of targets for which Xcode will collect the coverage results. | ||
public let codeCoverageTargets: [TargetReference] | ||
|
||
/// List of actions to be executed before running the tests. | ||
public let preActions: [ExecutionAction] | ||
|
||
/// List of actions to be executed after running the tests. | ||
public let postActions: [ExecutionAction] | ||
|
||
/// Diagnostics options. | ||
public let diagnosticsOptions: [SchemeDiagnosticsOption] | ||
|
||
/// Initializes a new instance of a test action | ||
/// - Parameters: | ||
/// - targets: List of targets to be tested. | ||
/// - arguments: Arguments passed to the process running the tests. | ||
/// - configurationName: Name of the configuration that should be used for building the test targets. | ||
/// - coverage: True to collect the test coverage results. | ||
/// - codeCoverageTargets: List of targets for which Xcode will collect the coverage results. | ||
/// - preActions: ist of actions to be executed before running the tests. | ||
/// - postActions: List of actions to be executed after running the tests. | ||
/// - diagnosticsOptions: Diagnostics options. | ||
public init(targets: [TestableTarget] = [], | ||
arguments: Arguments? = nil, | ||
configurationName: String, | ||
coverage: Bool = false, | ||
codeCoverageTargets: [TargetReference] = [], | ||
preActions: [ExecutionAction] = [], | ||
postActions: [ExecutionAction] = []) { | ||
postActions: [ExecutionAction] = [], | ||
diagnosticsOptions: [SchemeDiagnosticsOption] = []) { | ||
self.targets = targets | ||
self.arguments = arguments | ||
self.configurationName = configurationName | ||
self.coverage = coverage | ||
self.preActions = preActions | ||
self.postActions = postActions | ||
self.codeCoverageTargets = codeCoverageTargets | ||
self.diagnosticsOptions = diagnosticsOptions | ||
} | ||
|
||
/// Initializes a new instance of a test action | ||
/// - Parameters: | ||
/// - targets: List of targets to be tested. | ||
/// - arguments: Arguments passed to the process running the tests. | ||
/// - config: Configuration that should be used for building the test targets. | ||
/// - coverage: True to collect the test coverage results. | ||
/// - codeCoverageTargets: List of targets for which Xcode will collect the coverage results. | ||
/// - preActions: ist of actions to be executed before running the tests. | ||
/// - postActions: List of actions to be executed after running the tests. | ||
/// - diagnosticsOptions: Diagnostics options. | ||
public init(targets: [TestableTarget], | ||
arguments: Arguments? = nil, | ||
config: PresetBuildConfiguration = .debug, | ||
coverage: Bool = false, | ||
codeCoverageTargets: [TargetReference] = [], | ||
preActions: [ExecutionAction] = [], | ||
postActions: [ExecutionAction] = []) { | ||
postActions: [ExecutionAction] = [], | ||
diagnosticsOptions: [SchemeDiagnosticsOption] = []) { | ||
self.init(targets: targets, | ||
arguments: arguments, | ||
configurationName: config.name, | ||
coverage: coverage, | ||
codeCoverageTargets: codeCoverageTargets, | ||
preActions: preActions, | ||
postActions: postActions) | ||
postActions: postActions, | ||
diagnosticsOptions: diagnosticsOptions) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Foundation | ||
|
||
public enum SchemeDiagnosticsOption: Equatable { | ||
case mainThreadChecker | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
Sources/TuistLoader/Models+ManifestMappers/SchemeDiagnosticsOption+ManifestMapper.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Foundation | ||
import ProjectDescription | ||
import TSCBasic | ||
import TuistCore | ||
|
||
extension TuistCore.SchemeDiagnosticsOption { | ||
static func from(manifest: ProjectDescription.SchemeDiagnosticsOption) -> TuistCore.SchemeDiagnosticsOption { | ||
switch manifest { | ||
case .mainThreadChecker: return .mainThreadChecker | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.