Skip to content
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

adding support for enableGPUValidationMode #1294

Merged
merged 6 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Sources/ProjectSpec/Scheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public struct Scheme: Equatable {
public var postActions: [ExecutionAction]
public var environmentVariables: [XCScheme.EnvironmentVariable]
public var enableGPUFrameCaptureMode: XCScheme.LaunchAction.GPUFrameCaptureMode
public var enableGPUValidationMode: XCScheme.LaunchAction.GPUValidationMode
public var disableMainThreadChecker: Bool
public var stopOnEveryMainThreadCheckerIssue: Bool
public var language: String?
Expand All @@ -131,6 +132,7 @@ public struct Scheme: Equatable {
postActions: [ExecutionAction] = [],
environmentVariables: [XCScheme.EnvironmentVariable] = [],
enableGPUFrameCaptureMode: XCScheme.LaunchAction.GPUFrameCaptureMode = XCScheme.LaunchAction.defaultGPUFrameCaptureMode,
enableGPUValidationMode: XCScheme.LaunchAction.GPUValidationMode = XCScheme.LaunchAction.GPUValidationMode.enabled,
disableMainThreadChecker: Bool = disableMainThreadCheckerDefault,
stopOnEveryMainThreadCheckerIssue: Bool = stopOnEveryMainThreadCheckerIssueDefault,
language: String? = nil,
Expand All @@ -150,6 +152,7 @@ public struct Scheme: Equatable {
self.environmentVariables = environmentVariables
self.disableMainThreadChecker = disableMainThreadChecker
self.enableGPUFrameCaptureMode = enableGPUFrameCaptureMode
self.enableGPUValidationMode = enableGPUValidationMode
self.stopOnEveryMainThreadCheckerIssue = stopOnEveryMainThreadCheckerIssue
self.language = language
self.region = region
Expand Down Expand Up @@ -416,6 +419,11 @@ extension Scheme.Run: JSONObjectConvertible {
} else {
enableGPUFrameCaptureMode = XCScheme.LaunchAction.defaultGPUFrameCaptureMode
}
if let gpuValidationMode: String = jsonDictionary.json(atKeyPath: "enableGPUValidationMode") {
enableGPUValidationMode = XCScheme.LaunchAction.GPUValidationMode.fromJSONValue(gpuValidationMode)
} else {
enableGPUValidationMode = XCScheme.LaunchAction.defaultGPUValidationMode
}
LouisLWang marked this conversation as resolved.
Show resolved Hide resolved
disableMainThreadChecker = jsonDictionary.json(atKeyPath: "disableMainThreadChecker") ?? Scheme.Run.disableMainThreadCheckerDefault
stopOnEveryMainThreadCheckerIssue = jsonDictionary.json(atKeyPath: "stopOnEveryMainThreadCheckerIssue") ?? Scheme.Run.stopOnEveryMainThreadCheckerIssueDefault
language = jsonDictionary.json(atKeyPath: "language")
Expand Down Expand Up @@ -906,3 +914,29 @@ extension XCScheme.LaunchAction.GPUFrameCaptureMode: JSONEncodable {
}
}
}

extension XCScheme.LaunchAction.GPUValidationMode: JSONEncodable {
public func toJSONValue() -> Any {
switch self {
case .enabled:
return "enabled"
case .disabled:
return "disabled"
case .extended:
return "extended"
}
}

static func fromJSONValue(_ string: String) -> XCScheme.LaunchAction.GPUValidationMode {
switch string {
case "enabled":
return .enabled
case "disabled":
return .disabled
case "extended":
return .extended
default:
fatalError("Invalid enableGPUValidationMode value. Valid values are: enable, disable, extended")
}
}
}
1 change: 1 addition & 0 deletions Sources/XcodeGenKit/SchemeGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ public class SchemeGenerator {
allowLocationSimulation: allowLocationSimulation,
locationScenarioReference: locationScenarioReference,
enableGPUFrameCaptureMode: scheme.run?.enableGPUFrameCaptureMode ?? XCScheme.LaunchAction.defaultGPUFrameCaptureMode,
enableGPUValidationMode: scheme.run?.enableGPUValidationMode ?? XCScheme.LaunchAction.defaultGPUValidationMode,
disableMainThreadChecker: scheme.run?.disableMainThreadChecker ?? Scheme.Run.disableMainThreadCheckerDefault,
stopOnEveryMainThreadCheckerIssue: scheme.run?.stopOnEveryMainThreadCheckerIssue ?? Scheme.Run.stopOnEveryMainThreadCheckerIssueDefault,
commandlineArguments: launchCommandLineArgs,
Expand Down
1 change: 1 addition & 0 deletions Tests/Fixtures/TestProject/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ schemes:
defaultLocation: Honolulu, HI, USA
customLLDBInit: ${SRCROOT}/.lldbinit
enableGPUFrameCaptureMode: "disabled"
enableGPUValidationMode: "disabled"
storeKitConfiguration: "App_iOS/Configuration.storekit"
macroExpansion: App_iOS
test:
Expand Down