diff --git a/CHANGELOG.md b/CHANGELOG.md index 231c355a..828ac715 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ #### Fixed - Fixed resolving path to local Swift Packages [#796](https://github.com/yonaskolb/XcodeGen/pull/796) @freddi-kit +- Added ability to stop on every main thread checker issue on Run schemes and TargetSchemes [#799](https://github.com/yonaskolb/XcodeGen/pull/799) @ionutivan ## 2.14.0 diff --git a/Docs/ProjectSpec.md b/Docs/ProjectSpec.md index 52149355..3ac47e52 100644 --- a/Docs/ProjectSpec.md +++ b/Docs/ProjectSpec.md @@ -598,6 +598,7 @@ This is a convenience used to automatically generate schemes for a target based - [ ] **testTargets**: **[[Test Target](#test-target)]** - a list of test targets that should be included in the scheme. These will be added to the build targets and the test entries. Each entry can either be a simple string, or a [Test Target](#test-target) - [ ] **gatherCoverageData**: **Bool** - a boolean that indicates if this scheme should gather coverage data. This defaults to false - [ ] **disableMainThreadChecker**: **Bool** - a boolean that indicates if this scheme should disable disable the Main Thread Checker. This defaults to false +- [ ] **stopOnEveryMainThreadCheckerIssue**: **Bool** - a boolean that indicates if this scheme should stop at every Main Thread Checker issue. This defaults to false - [ ] **language**: **String** - a String that indicates the language used for running and testing. This defaults to nil - [ ] **region**: **String** - a String that indicates the region used for running and testing. This defaults to nil - [ ] **commandLineArguments**: **[String:Bool]** - a dictionary from the argument name (`String`) to if it is enabled (`Bool`). These arguments will be added to the Test, Profile and Run scheme actions @@ -733,6 +734,7 @@ The different actions share some properties: - [ ] **postActions**: **[[Execution Action](#execution-action)]** - Scripts that are run *after* the action - [ ] **environmentVariables**: **[[Environment Variable](#environment-variable)]** or **[String:String]** - `run`, `test` and `profile` actions can define the environment variables. When passing a dictionary, every key-value entry maps to a corresponding variable that is enabled. - [ ] **disableMainThreadChecker**: **Bool** - `run` and `test` actions can define a boolean that indicates that this scheme should disable the Main Thread Checker. This defaults to false +- [ ] **stopOnEveryMainThreadCheckerIssue**: **Bool** - a boolean that indicates if this scheme should stop at every Main Thread Checker issue. This defaults to false - [ ] **language**: **String** - `run` and `test` actions can define a language that is used for Application Language - [ ] **region**: **String** - `run` and `test` actions can define a language that is used for Application Region - [ ] **debugEnabled**: **Bool** - `run` and `test` actions can define a whether debugger should be used. This defaults to true. diff --git a/Docs/Usage.md b/Docs/Usage.md index 2c9e9c21..b4f740c5 100644 --- a/Docs/Usage.md +++ b/Docs/Usage.md @@ -122,7 +122,7 @@ By default these all have to be listed if you want to link and use them: ```yml targets: App: - frameworks: + dependencies: - carthage: ReactiveCocoa - carthage: ReactiveMapKit ``` @@ -134,7 +134,7 @@ options: findCarthageFrameworks: true targets: App: - frameworks: + dependencies: - carthage: ReactiveCocoa # will find ReactiveMapKit as well - carthage: OtherCarthageDependency findFrameworks: false # disables the global option diff --git a/README.md b/README.md index c34892f4..ebe42ff9 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ Options: - **--use-cache**: Used to prevent unnecessarily generating the project. If this is set, then a cache file will be written to when a project is generated. If `xcodegen` is later run but the spec and all the files it contains are the same, the project won't be generated. - **--cache-path**: A custom path to use for your cache file. This defaults to `~/.xcodegen/cache/{PROJECT_SPEC_PATH_HASH}` -There are other commands as well. Use `xcodegen help` to see more detailed usage information. +There are other commands as well such as `xcodegen dump` which lets out output the resolved spec in many different formats, or write it to a file. Use `xcodegen help` to see more detailed usage information. ## Editing ```shell diff --git a/Sources/ProjectSpec/Scheme.swift b/Sources/ProjectSpec/Scheme.swift index 45ed0f15..e7b0059f 100644 --- a/Sources/ProjectSpec/Scheme.swift +++ b/Sources/ProjectSpec/Scheme.swift @@ -95,6 +95,7 @@ public struct Scheme: Equatable { public struct Run: BuildAction { public static let disableMainThreadCheckerDefault = false + public static let stopOnEveryMainThreadCheckerIssueDefault = false public static let debugEnabledDefault = true public var config: String? @@ -103,6 +104,7 @@ public struct Scheme: Equatable { public var postActions: [ExecutionAction] public var environmentVariables: [XCScheme.EnvironmentVariable] public var disableMainThreadChecker: Bool + public var stopOnEveryMainThreadCheckerIssue: Bool public var language: String? public var region: String? public var debugEnabled: Bool @@ -115,6 +117,7 @@ public struct Scheme: Equatable { postActions: [ExecutionAction] = [], environmentVariables: [XCScheme.EnvironmentVariable] = [], disableMainThreadChecker: Bool = disableMainThreadCheckerDefault, + stopOnEveryMainThreadCheckerIssue: Bool = stopOnEveryMainThreadCheckerIssueDefault, language: String? = nil, region: String? = nil, debugEnabled: Bool = debugEnabledDefault, @@ -126,6 +129,7 @@ public struct Scheme: Equatable { self.postActions = postActions self.environmentVariables = environmentVariables self.disableMainThreadChecker = disableMainThreadChecker + self.stopOnEveryMainThreadCheckerIssue = stopOnEveryMainThreadCheckerIssue self.language = language self.region = region self.debugEnabled = debugEnabled @@ -340,6 +344,7 @@ extension Scheme.Run: JSONObjectConvertible { postActions = jsonDictionary.json(atKeyPath: "postActions") ?? [] environmentVariables = try XCScheme.EnvironmentVariable.parseAll(jsonDictionary: jsonDictionary) disableMainThreadChecker = jsonDictionary.json(atKeyPath: "disableMainThreadChecker") ?? Scheme.Run.disableMainThreadCheckerDefault + stopOnEveryMainThreadCheckerIssue = jsonDictionary.json(atKeyPath: "stopOnEveryMainThreadCheckerIssue") ?? Scheme.Run.stopOnEveryMainThreadCheckerIssueDefault language = jsonDictionary.json(atKeyPath: "language") region = jsonDictionary.json(atKeyPath: "region") debugEnabled = jsonDictionary.json(atKeyPath: "debugEnabled") ?? Scheme.Run.debugEnabledDefault @@ -362,6 +367,10 @@ extension Scheme.Run: JSONEncodable { if disableMainThreadChecker != Scheme.Run.disableMainThreadCheckerDefault { dict["disableMainThreadChecker"] = disableMainThreadChecker } + + if stopOnEveryMainThreadCheckerIssue != Scheme.Run.stopOnEveryMainThreadCheckerIssueDefault { + dict["stopOnEveryMainThreadCheckerIssue"] = stopOnEveryMainThreadCheckerIssue + } if debugEnabled != Scheme.Run.debugEnabledDefault { dict["debugEnabled"] = debugEnabled diff --git a/Sources/ProjectSpec/TargetScheme.swift b/Sources/ProjectSpec/TargetScheme.swift index 6337d8d5..f6d01294 100644 --- a/Sources/ProjectSpec/TargetScheme.swift +++ b/Sources/ProjectSpec/TargetScheme.swift @@ -5,6 +5,7 @@ import XcodeProj public struct TargetScheme: Equatable { public static let gatherCoverageDataDefault = false public static let disableMainThreadCheckerDefault = false + public static let stopOnEveryMainThreadCheckerIssueDefault = false public var testTargets: [Scheme.Test.TestTarget] public var configVariants: [String] @@ -12,6 +13,7 @@ public struct TargetScheme: Equatable { public var language: String? public var region: String? public var disableMainThreadChecker: Bool + public var stopOnEveryMainThreadCheckerIssue: Bool public var commandLineArguments: [String: Bool] public var environmentVariables: [XCScheme.EnvironmentVariable] public var preActions: [Scheme.ExecutionAction] @@ -24,6 +26,7 @@ public struct TargetScheme: Equatable { language: String? = nil, region: String? = nil, disableMainThreadChecker: Bool = disableMainThreadCheckerDefault, + stopOnEveryMainThreadCheckerIssue: Bool = stopOnEveryMainThreadCheckerIssueDefault, commandLineArguments: [String: Bool] = [:], environmentVariables: [XCScheme.EnvironmentVariable] = [], preActions: [Scheme.ExecutionAction] = [], @@ -35,6 +38,7 @@ public struct TargetScheme: Equatable { self.language = language self.region = region self.disableMainThreadChecker = disableMainThreadChecker + self.stopOnEveryMainThreadCheckerIssue = stopOnEveryMainThreadCheckerIssue self.commandLineArguments = commandLineArguments self.environmentVariables = environmentVariables self.preActions = preActions @@ -63,6 +67,7 @@ extension TargetScheme: JSONObjectConvertible { language = jsonDictionary.json(atKeyPath: "language") region = jsonDictionary.json(atKeyPath: "region") disableMainThreadChecker = jsonDictionary.json(atKeyPath: "disableMainThreadChecker") ?? TargetScheme.disableMainThreadCheckerDefault + stopOnEveryMainThreadCheckerIssue = jsonDictionary.json(atKeyPath: "stopOnEveryMainThreadCheckerIssue") ?? TargetScheme.stopOnEveryMainThreadCheckerIssueDefault commandLineArguments = jsonDictionary.json(atKeyPath: "commandLineArguments") ?? [:] environmentVariables = try XCScheme.EnvironmentVariable.parseAll(jsonDictionary: jsonDictionary) preActions = jsonDictionary.json(atKeyPath: "preActions") ?? [] @@ -88,6 +93,10 @@ extension TargetScheme: JSONEncodable { if disableMainThreadChecker != TargetScheme.disableMainThreadCheckerDefault { dict["disableMainThreadChecker"] = disableMainThreadChecker } + + if stopOnEveryMainThreadCheckerIssue != TargetScheme.stopOnEveryMainThreadCheckerIssueDefault { + dict["stopOnEveryMainThreadCheckerIssue"] = stopOnEveryMainThreadCheckerIssue + } if let language = language { dict["language"] = language diff --git a/Sources/XcodeGenKit/SchemeGenerator.swift b/Sources/XcodeGenKit/SchemeGenerator.swift index 4e8c04d8..151c6c9e 100644 --- a/Sources/XcodeGenKit/SchemeGenerator.swift +++ b/Sources/XcodeGenKit/SchemeGenerator.swift @@ -235,6 +235,7 @@ public class SchemeGenerator { allowLocationSimulation: allowLocationSimulation, locationScenarioReference: locationScenarioReference, disableMainThreadChecker: scheme.run?.disableMainThreadChecker ?? Scheme.Run.disableMainThreadCheckerDefault, + stopOnEveryMainThreadCheckerIssue: scheme.run?.stopOnEveryMainThreadCheckerIssue ?? Scheme.Run.stopOnEveryMainThreadCheckerIssueDefault, commandlineArguments: launchCommandLineArgs, environmentVariables: launchVariables, language: scheme.run?.language, @@ -302,6 +303,7 @@ extension Scheme { postActions: targetScheme.postActions, environmentVariables: targetScheme.environmentVariables, disableMainThreadChecker: targetScheme.disableMainThreadChecker, + stopOnEveryMainThreadCheckerIssue: targetScheme.stopOnEveryMainThreadCheckerIssue, language: targetScheme.language, region: targetScheme.region ), diff --git a/Tests/Fixtures/TestProject/Project.xcodeproj/xcshareddata/xcschemes/App_iOS Production.xcscheme b/Tests/Fixtures/TestProject/Project.xcodeproj/xcshareddata/xcschemes/App_iOS Production.xcscheme index 4a0a9733..fd17b922 100644 --- a/Tests/Fixtures/TestProject/Project.xcodeproj/xcshareddata/xcschemes/App_iOS Production.xcscheme +++ b/Tests/Fixtures/TestProject/Project.xcodeproj/xcshareddata/xcschemes/App_iOS Production.xcscheme @@ -86,7 +86,8 @@ debugDocumentVersioning = "YES" debugServiceExtension = "internal" allowLocationSimulation = "YES" - disableMainThreadChecker = "YES"> + disableMainThreadChecker = "YES" + stopOnEveryMainThreadCheckerIssue = "YES"> + disableMainThreadChecker = "YES" + stopOnEveryMainThreadCheckerIssue = "YES"> + disableMainThreadChecker = "YES" + stopOnEveryMainThreadCheckerIssue = "YES">