Skip to content

Commit

Permalink
Add showNonLocalizedStrings option to XCScheme+LaunchAction (#806)
Browse files Browse the repository at this point in the history
* LaunchAction - Add showNonLocalizedStrings option

* LaunchAction - add test for showNonLocalizedStrings
  • Loading branch information
ladislas committed Jan 12, 2024
1 parent 3262641 commit 2b9c2ac
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Sources/XcodeProj/Scheme/XCScheme+LaunchAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ extension XCScheme {
public var environmentVariables: [EnvironmentVariable]?
public var language: String?
public var region: String?
public var showNonLocalizedStrings: Bool
public var launchAutomaticallySubstyle: String?
public var storeKitConfigurationFileReference: StoreKitConfigurationFileReference?
// To enable the option in Xcode: defaults write com.apple.dt.Xcode IDEDebuggerFeatureSetting 12
Expand Down Expand Up @@ -106,6 +107,7 @@ extension XCScheme {
environmentVariables: [EnvironmentVariable]? = nil,
language: String? = nil,
region: String? = nil,
showNonLocalizedStrings: Bool = false,
launchAutomaticallySubstyle: String? = nil,
storeKitConfigurationFileReference: StoreKitConfigurationFileReference? = nil,
customLaunchCommand: String? = nil,
Expand Down Expand Up @@ -141,6 +143,7 @@ extension XCScheme {
self.environmentVariables = environmentVariables
self.language = language
self.region = region
self.showNonLocalizedStrings = showNonLocalizedStrings
self.launchAutomaticallySubstyle = launchAutomaticallySubstyle
self.storeKitConfigurationFileReference = storeKitConfigurationFileReference
self.customLaunchCommand = customLaunchCommand
Expand Down Expand Up @@ -216,6 +219,7 @@ extension XCScheme {

language = element.attributes["language"]
region = element.attributes["region"]
showNonLocalizedStrings = element.attributes["showNonLocalizedStrings"] == "YES"
launchAutomaticallySubstyle = element.attributes["launchAutomaticallySubstyle"]

if element["StoreKitConfigurationFileReference"].all?.first != nil {
Expand Down Expand Up @@ -327,6 +331,11 @@ extension XCScheme {
if let region = region {
element.attributes["region"] = region
}

if showNonLocalizedStrings {
element.attributes["showNonLocalizedStrings"] = showNonLocalizedStrings.xmlString
}

if let launchAutomaticallySubstyle = launchAutomaticallySubstyle {
element.attributes["launchAutomaticallySubstyle"] = launchAutomaticallySubstyle
}
Expand Down
19 changes: 19 additions & 0 deletions Tests/XcodeProjTests/Scheme/XCSchemeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,25 @@ final class XCSchemeIntegrationTests: XCTestCase {
XCTAssertEqual(reconstructedSubject, subject)
}

func test_launchAction_remoteRunnable_showNonLocalizedStrings() throws {
// Given
let buildableReference = try buildableReferenceWithStringBluePrint()
let remoteRunnable = XCScheme.RemoteRunnable(buildableReference: buildableReference,
bundleIdentifier: "io.tuist",
remotePath: "/Some/Path")
let subject = XCScheme.LaunchAction(runnable: remoteRunnable,
buildConfiguration: "Debug",
showNonLocalizedStrings: true)

// When
let element = subject.xmlElement()
let reconstructedSubject = try XCScheme.LaunchAction(element: element)

// Then
XCTAssertEqual(reconstructedSubject, subject)
XCTAssertEqual(reconstructedSubject.showNonLocalizedStrings, true)
}

func test_runnable_equtable() throws {
// Given
let buildableReferenceA = try buildableReferenceWithStringBluePrint(name: "A")
Expand Down

0 comments on commit 2b9c2ac

Please sign in to comment.