New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the option to enable/disable the main thread checker from the generated schemes #1382
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7e8f58a
Update the models in ProjectDescription to add support for enabling t…
af2c8b6
Set disableMainThreadChecker depending on the given diagnostic options
4952bd2
Fix tests
c4d8f91
Add unit tests
0a5c4c2
Update documentation
88c7f74
Update CHANGELOG
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about using the affermative (enable) instead of negative (disable)
disableMainThreadChecker
->isMainThreadCheckerEnabled
since I think that's more readable. But I see that's the name used in theXCScheme
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disableMainThreadChecker
is how Xcode calls the attribute 😛 . That's why I took the opportunity to make it positive from our API. mainThreadChecker