Skip to content

Commit

Permalink
Merge pull request #368 from schiewe/master
Browse files Browse the repository at this point in the history
Add GPUFrameCaptureMode and GPUValidationMode options to LaunchAction
  • Loading branch information
Pedro Piñera Buendía authored Feb 16, 2019
2 parents ee9a680 + c050f4a commit 10cca96
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## next version

### Added
- Added `GPUFrameCaptureMode` and `GPUValidationMode` options to `LaunchAction` https://github.com/tuist/xcodeproj/pull/368 by @schiewe.

### Fixed
- Fix PBXTarget extension methods https://github.com/tuist/xcodeproj/pull/367 by @danilsmakotin

Expand Down
2 changes: 2 additions & 0 deletions Sources/xcodeproj/Extensions/AEXML+XcodeFormat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ let attributesOrder: [String: [String]] = [
"ignoresPersistentStateOnLaunch",
"debugDocumentVersioning",
"debugServiceExtension",
"enableGPUFrameCaptureMode",
"enableGPUValidationMode",
"allowLocationSimulation",
],
"ProfileAction": [
Expand Down
29 changes: 29 additions & 0 deletions Sources/xcodeproj/Scheme/XCScheme+LaunchAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,25 @@ extension XCScheme {
case auto = "0"
case wait = "1"
}
public enum GPUFrameCaptureMode: String {
case autoEnabled = "0"
case Metal = "1"
case OpenGL = "2"
case disabled = "3"
}
public enum GPUValidationMode: String {
case enabled = "0"
case disabled = "1"
case extended = "2"
}

// MARK: - Static

private static let defaultBuildConfiguration = "Debug"
public static let defaultDebugServiceExtension = "internal"
private static let defaultLaunchStyle = Style.auto
public static let defaultGPUFrameCaptureMode = GPUFrameCaptureMode.autoEnabled
public static let defaultGPUValidationMode = GPUValidationMode.enabled

// MARK: - Attributes

Expand All @@ -30,6 +43,8 @@ extension XCScheme {
public var debugServiceExtension: String
public var allowLocationSimulation: Bool
public var locationScenarioReference: LocationScenarioReference?
public var enableGPUFrameCaptureMode: GPUFrameCaptureMode
public var enableGPUValidationMode: GPUValidationMode
public var enableAddressSanitizer: Bool
public var enableASanStackUseAfterReturn: Bool
public var enableThreadSanitizer: Bool
Expand Down Expand Up @@ -61,6 +76,8 @@ extension XCScheme {
debugServiceExtension: String = LaunchAction.defaultDebugServiceExtension,
allowLocationSimulation: Bool = true,
locationScenarioReference: LocationScenarioReference? = nil,
enableGPUFrameCaptureMode: GPUFrameCaptureMode = LaunchAction.defaultGPUFrameCaptureMode,
enableGPUValidationMode: GPUValidationMode = LaunchAction.defaultGPUValidationMode,
enableAddressSanitizer: Bool = false,
enableASanStackUseAfterReturn: Bool = false,
enableThreadSanitizer: Bool = false,
Expand All @@ -87,6 +104,8 @@ extension XCScheme {
self.debugServiceExtension = debugServiceExtension
self.allowLocationSimulation = allowLocationSimulation
self.locationScenarioReference = locationScenarioReference
self.enableGPUFrameCaptureMode = enableGPUFrameCaptureMode
self.enableGPUValidationMode = enableGPUValidationMode
self.enableAddressSanitizer = enableAddressSanitizer
self.enableASanStackUseAfterReturn = enableASanStackUseAfterReturn
self.enableThreadSanitizer = enableThreadSanitizer
Expand Down Expand Up @@ -130,6 +149,8 @@ extension XCScheme {
locationScenarioReference = nil
}

enableGPUFrameCaptureMode = element.attributes["enableGPUFrameCaptureMode"].flatMap { GPUFrameCaptureMode(rawValue: $0) } ?? LaunchAction.defaultGPUFrameCaptureMode
enableGPUValidationMode = element.attributes["enableGPUValidationMode"].flatMap { GPUValidationMode(rawValue: $0) } ?? LaunchAction.defaultGPUValidationMode
enableAddressSanitizer = element.attributes["enableAddressSanitizer"] == "YES"
enableASanStackUseAfterReturn = element.attributes["enableASanStackUseAfterReturn"] == "YES"
enableThreadSanitizer = element.attributes["enableThreadSanitizer"] == "YES"
Expand Down Expand Up @@ -174,6 +195,12 @@ extension XCScheme {
"allowLocationSimulation": allowLocationSimulation.xmlString,
]

if enableGPUFrameCaptureMode != LaunchAction.defaultGPUFrameCaptureMode {
attributes["enableGPUFrameCaptureMode"] = enableGPUFrameCaptureMode.rawValue
}
if enableGPUValidationMode != LaunchAction.defaultGPUValidationMode {
attributes["enableGPUValidationMode"] = enableGPUValidationMode.rawValue
}
if enableAddressSanitizer {
attributes["enableAddressSanitizer"] = enableAddressSanitizer.xmlString
}
Expand Down Expand Up @@ -263,6 +290,8 @@ extension XCScheme {
debugServiceExtension == rhs.debugServiceExtension &&
allowLocationSimulation == rhs.allowLocationSimulation &&
locationScenarioReference == rhs.locationScenarioReference &&
enableGPUFrameCaptureMode == rhs.enableGPUFrameCaptureMode &&
enableGPUValidationMode == rhs.enableGPUValidationMode &&
enableAddressSanitizer == rhs.enableAddressSanitizer &&
enableASanStackUseAfterReturn == rhs.enableASanStackUseAfterReturn &&
enableThreadSanitizer == rhs.enableThreadSanitizer &&
Expand Down

0 comments on commit 10cca96

Please sign in to comment.