Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ public struct BuildableReference: Equatable, Hashable {
public let blueprintIdentifier: String
let buildableName: String
public let blueprintName: String
let referencedContainer: String
public let referencedContainer: String

public init(
blueprintIdentifier: String,
Expand Down
10 changes: 10 additions & 0 deletions tools/generators/lib/XCScheme/src/CreateLaunchAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public struct CreateLaunchAction {
public func callAsFunction(
buildConfiguration: String,
commandLineArguments: [CommandLineArgument],
customLLDBInitFile: String?,
customWorkingDirectory: String?,
enableAddressSanitizer: Bool,
enableThreadSanitizer: Bool,
Expand All @@ -27,6 +28,7 @@ public struct CreateLaunchAction {
return callable(
/*buildConfiguration:*/ buildConfiguration,
/*commandLineArguments:*/ commandLineArguments,
/*customLLDBInitFile:*/ customLLDBInitFile,
/*customWorkingDirectory:*/ customWorkingDirectory,
/*enableAddressSanitizer:*/ enableAddressSanitizer,
/*enableThreadSanitizer:*/ enableThreadSanitizer,
Expand All @@ -48,6 +50,7 @@ extension CreateLaunchAction {
public typealias Callable = (
_ buildConfiguration: String,
_ commandLineArguments: [CommandLineArgument],
_ customLLDBInitFile: String?,
_ customWorkingDirectory: String?,
_ enableAddressSanitizer: Bool,
_ enableThreadSanitizer: Bool,
Expand All @@ -64,6 +67,7 @@ extension CreateLaunchAction {
public static func defaultCallable(
buildConfiguration: String,
commandLineArguments: [CommandLineArgument],
customLLDBInitFile: String?,
customWorkingDirectory: String?,
enableAddressSanitizer: Bool,
enableThreadSanitizer: Bool,
Expand Down Expand Up @@ -100,6 +104,12 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
)
}

if let customLLDBInitFile {
components.append(
#"customLLDBInitFile = "\#(customLLDBInitFile)""#
)
}

if enableAddressSanitizer {
components.append(#"enableAddressSanitizer = "YES""#)
}
Expand Down
10 changes: 10 additions & 0 deletions tools/generators/lib/XCScheme/src/CreateProfileAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public struct CreateProfileAction {
public func callAsFunction(
buildConfiguration: String,
commandLineArguments: [CommandLineArgument],
customLLDBInitFile: String?,
customWorkingDirectory: String?,
environmentVariables: [EnvironmentVariable],
postActions: [ExecutionAction],
Expand All @@ -22,6 +23,7 @@ public struct CreateProfileAction {
return callable(
/*buildConfiguration:*/ buildConfiguration,
/*commandLineArguments:*/ commandLineArguments,
/*customLLDBInitFile:*/ customLLDBInitFile,
/*customWorkingDirectory:*/ customWorkingDirectory,
/*environmentVariables:*/ environmentVariables,
/*postActions:*/ postActions,
Expand All @@ -38,6 +40,7 @@ extension CreateProfileAction {
public typealias Callable = (
_ buildConfiguration: String,
_ commandLineArguments: [CommandLineArgument],
_ customLLDBInitFile: String?,
_ customWorkingDirectory: String?,
_ environmentVariables: [EnvironmentVariable],
_ postActions: [ExecutionAction],
Expand All @@ -49,6 +52,7 @@ extension CreateProfileAction {
public static func defaultCallable(
buildConfiguration: String,
commandLineArguments: [CommandLineArgument],
customLLDBInitFile: String?,
customWorkingDirectory: String?,
environmentVariables: [EnvironmentVariable],
postActions: [ExecutionAction],
Expand All @@ -66,6 +70,12 @@ buildConfiguration = "\#(buildConfiguration)"
"""#,
]

if let customLLDBInitFile {
components.append(
#"customLLDBInitFile = "\#(customLLDBInitFile)""#
)
}

if let customWorkingDirectory {
components.append(
#"""
Expand Down
10 changes: 10 additions & 0 deletions tools/generators/lib/XCScheme/src/CreateTestAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public struct CreateTestAction {
codeCoverage: Bool,
buildConfiguration: String,
commandLineArguments: [CommandLineArgument],
customLLDBInitFile: String?,
enableAddressSanitizer: Bool,
enableThreadSanitizer: Bool,
enableUBSanitizer: Bool,
Expand All @@ -33,6 +34,7 @@ public struct CreateTestAction {
/*codeCoverage:*/ codeCoverage,
/*buildConfiguration:*/ buildConfiguration,
/*commandLineArguments:*/ commandLineArguments,
/*customLLDBInitFile:*/ customLLDBInitFile,
/*enableAddressSanitizer:*/ enableAddressSanitizer,
/*enableThreadSanitizer:*/ enableThreadSanitizer,
/*enableUBSanitizer:*/ enableUBSanitizer,
Expand All @@ -57,6 +59,7 @@ extension CreateTestAction {
_ codeCoverage: Bool,
_ buildConfiguration: String,
_ commandLineArguments: [CommandLineArgument],
_ customLLDBInitFile: String?,
_ enableAddressSanitizer: Bool,
_ enableThreadSanitizer: Bool,
_ enableUBSanitizer: Bool,
Expand All @@ -76,6 +79,7 @@ extension CreateTestAction {
codeCoverage: Bool,
buildConfiguration: String,
commandLineArguments: [CommandLineArgument],
customLLDBInitFile: String?,
enableAddressSanitizer: Bool,
enableThreadSanitizer: Bool,
enableUBSanitizer: Bool,
Expand All @@ -99,6 +103,12 @@ buildConfiguration = "\#(buildConfiguration)"
"""#,
]

if let customLLDBInitFile {
components.append(
#"customLLDBInitFile = "\#(customLLDBInitFile)""#
)
}

if enableAddressSanitizer {
components.append(#"enableAddressSanitizer = "YES""#)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,33 @@ final class CreateLaunchActionTests: XCTestCase {
XCTAssertNoDifference(action, expectedAction)
}

func test_customLLDBInitFile() {
let buildConfiguration = "Release"
let customLLDBInitFile = "$(SRCROOT)/.lldbinit-rules_xcodeproj"

let expectedAction = #"""
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/.lldbinit-rules_xcodeproj"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
"""#

let action = createLaunchActionWithDefaults(
buildConfiguration: buildConfiguration,
customLLDBInitFile: customLLDBInitFile
)

XCTAssertNoDifference(action, expectedAction)
}

func test_disableMainThreadChecker() {
// Arrange

Expand Down Expand Up @@ -585,6 +612,7 @@ final class CreateLaunchActionTests: XCTestCase {
private func createLaunchActionWithDefaults(
buildConfiguration: String,
commandLineArguments: [CommandLineArgument] = [],
customLLDBInitFile: String? = nil,
customWorkingDirectory: String? = nil,
enableAddressSanitizer: Bool = false,
enableThreadSanitizer: Bool = false,
Expand All @@ -600,6 +628,7 @@ private func createLaunchActionWithDefaults(
return CreateLaunchAction.defaultCallable(
buildConfiguration: buildConfiguration,
commandLineArguments: commandLineArguments,
customLLDBInitFile: customLLDBInitFile,
customWorkingDirectory: customWorkingDirectory,
enableAddressSanitizer: enableAddressSanitizer,
enableThreadSanitizer: enableThreadSanitizer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,29 @@ final class CreateProfileActionTests: XCTestCase {
XCTAssertNoDifference(prefix, expectedPrefix)
}

func test_customLLDBInitFile() {
let buildConfiguration = "Profile"
let customLLDBInitFile = "$(SRCROOT)/.lldbinit-rules_xcodeproj"

let expectedPrefix = #"""
<ProfileAction
buildConfiguration = "Profile"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
customLLDBInitFile = "$(SRCROOT)/.lldbinit-rules_xcodeproj"
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
"""#

let prefix = createProfileActionWithDefaults(
buildConfiguration: buildConfiguration,
customLLDBInitFile: customLLDBInitFile
)

XCTAssertNoDifference(prefix, expectedPrefix)
}

func test_environmentVariables() {
// Arrange

Expand Down Expand Up @@ -379,6 +402,7 @@ final class CreateProfileActionTests: XCTestCase {
private func createProfileActionWithDefaults(
buildConfiguration: String,
commandLineArguments: [CommandLineArgument] = [],
customLLDBInitFile: String? = nil,
customWorkingDirectory: String? = nil,
environmentVariables: [EnvironmentVariable] = [],
postActions: [ExecutionAction] = [],
Expand All @@ -389,6 +413,7 @@ private func createProfileActionWithDefaults(
return CreateProfileAction.defaultCallable(
buildConfiguration: buildConfiguration,
commandLineArguments: commandLineArguments,
customLLDBInitFile: customLLDBInitFile,
customWorkingDirectory: customWorkingDirectory,
environmentVariables: environmentVariables,
postActions: postActions,
Expand Down
26 changes: 26 additions & 0 deletions tools/generators/lib/XCScheme/test/CreateTestActionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,30 @@ final class CreateTestActionTests: XCTestCase {
XCTAssertNoDifference(action, expectedAction)
}

func test_customLLDBInitFile() {
let buildConfiguration = "Debug"
let customLLDBInitFile = "$(SRCROOT)/.lldbinit-rules_xcodeproj"

let expectedAction = #"""
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
customLLDBInitFile = "$(SRCROOT)/.lldbinit-rules_xcodeproj">
<Testables>
</Testables>
</TestAction>
"""#

let action = createTestActionWithDefaults(
buildConfiguration: buildConfiguration,
customLLDBInitFile: customLLDBInitFile
)

XCTAssertNoDifference(action, expectedAction)
}

func test_disableMainThreadChecker() {
// Arrange

Expand Down Expand Up @@ -458,6 +482,7 @@ private func createTestActionWithDefaults(
codeCoverage: Bool = false,
buildConfiguration: String,
commandLineArguments: [CommandLineArgument] = [],
customLLDBInitFile: String? = nil,
enableAddressSanitizer: Bool = false,
enableThreadSanitizer: Bool = false,
enableUBSanitizer: Bool = false,
Expand All @@ -476,6 +501,7 @@ private func createTestActionWithDefaults(
codeCoverage: codeCoverage,
buildConfiguration: buildConfiguration,
commandLineArguments: commandLineArguments,
customLLDBInitFile: customLLDBInitFile,
enableAddressSanitizer: enableAddressSanitizer,
enableThreadSanitizer: enableThreadSanitizer,
enableUBSanitizer: enableUBSanitizer,
Expand Down
4 changes: 2 additions & 2 deletions tools/generators/pbxproj_prefix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ Here is an example output:
BAZEL_CONFIG = rules_xcodeproj;
BAZEL_EXTERNAL = "$(BAZEL_OUTPUT_BASE)/external";
BAZEL_INTEGRATION_DIR = "$(INTERNAL_DIR)/bazel";
BAZEL_LLDB_INIT = "$(HOME)/.lldbinit-rules_xcodeproj";
BAZEL_LLDB_INIT = "$(PROJECT_FILE_PATH)/rules_xcodeproj/bazel.lldbinit";
BAZEL_OUT = "$(PROJECT_DIR)/bazel-out";
BAZEL_OUTPUT_BASE = "$(_BAZEL_OUTPUT_BASE:standardizepath)";
BAZEL_WORKSPACE_ROOT = "$(SRCROOT)";
Expand Down Expand Up @@ -258,7 +258,7 @@ Here is an example output:
BAZEL_CONFIG = rules_xcodeproj;
BAZEL_EXTERNAL = "$(BAZEL_OUTPUT_BASE)/external";
BAZEL_INTEGRATION_DIR = "$(INTERNAL_DIR)/bazel";
BAZEL_LLDB_INIT = "$(HOME)/.lldbinit-rules_xcodeproj";
BAZEL_LLDB_INIT = "$(PROJECT_FILE_PATH)/rules_xcodeproj/bazel.lldbinit";
BAZEL_OUT = "$(PROJECT_DIR)/bazel-out";
BAZEL_OUTPUT_BASE = "$(_BAZEL_OUTPUT_BASE:standardizepath)";
BAZEL_WORKSPACE_ROOT = "$(SRCROOT)";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extension Generator {
),
.init(
key: "BAZEL_LLDB_INIT",
value: #""$(HOME)/.lldbinit-rules_xcodeproj""#
value: #""$(PROJECT_FILE_PATH)/rules_xcodeproj/bazel.lldbinit""#
),
.init(
key: "BAZEL_OUT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class PBXProjectBuildSettingsTests: XCTestCase {
BAZEL_CONFIG = rxcp_custom_config;
BAZEL_EXTERNAL = "$(BAZEL_OUTPUT_BASE)/external";
BAZEL_INTEGRATION_DIR = "$(INTERNAL_DIR)/bazel";
BAZEL_LLDB_INIT = "$(HOME)/.lldbinit-rules_xcodeproj";
BAZEL_LLDB_INIT = "$(PROJECT_FILE_PATH)/rules_xcodeproj/bazel.lldbinit";
BAZEL_OUT = "$(PROJECT_DIR)/bazel-out";
BAZEL_OUTPUT_BASE = "$(_BAZEL_OUTPUT_BASE:standardizepath)";
BAZEL_WORKSPACE_ROOT = "$(SRCROOT)";
Expand Down Expand Up @@ -121,7 +121,7 @@ class PBXProjectBuildSettingsTests: XCTestCase {
BAZEL_CONFIG = rxcp_custom_config;
BAZEL_EXTERNAL = "$(BAZEL_OUTPUT_BASE)/external";
BAZEL_INTEGRATION_DIR = "$(INTERNAL_DIR)/bazel";
BAZEL_LLDB_INIT = "$(HOME)/.lldbinit-rules_xcodeproj";
BAZEL_LLDB_INIT = "$(PROJECT_FILE_PATH)/rules_xcodeproj/bazel.lldbinit";
BAZEL_OUT = "$(PROJECT_DIR)/bazel-out";
BAZEL_OUTPUT_BASE = "$(_BAZEL_OUTPUT_BASE:standardizepath)";
BAZEL_SUPPRESS_COVERAGE_BUILD = YES;
Expand Down Expand Up @@ -215,7 +215,7 @@ class PBXProjectBuildSettingsTests: XCTestCase {
BAZEL_CONFIG = rxcp_custom_config;
BAZEL_EXTERNAL = "$(BAZEL_OUTPUT_BASE)/external";
BAZEL_INTEGRATION_DIR = "$(INTERNAL_DIR)/bazel";
BAZEL_LLDB_INIT = "$(HOME)/.lldbinit-rules_xcodeproj";
BAZEL_LLDB_INIT = "$(PROJECT_FILE_PATH)/rules_xcodeproj/bazel.lldbinit";
BAZEL_OUT = "$(PROJECT_DIR)/bazel-out";
BAZEL_OUTPUT_BASE = "$(_BAZEL_OUTPUT_BASE:standardizepath)";
BAZEL_SEPARATE_INDEXBUILD_OUTPUT_BASE = YES;
Expand Down
3 changes: 3 additions & 0 deletions tools/generators/xcschemes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ Here is an example output:
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
customLLDBInitFile = "/Users/brentley/Developer/rules_xcodeproj/tools/tools.xcodeproj/rules_xcodeproj/bazel.lldbinit"
enableAddressSanitizer = "YES">
<PreActions>
<ExecutionAction
Expand Down Expand Up @@ -223,6 +224,7 @@ Here is an example output:
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "/Users/brentley/Developer/rules_xcodeproj/tools/tools.xcodeproj/rules_xcodeproj/bazel.lldbinit"
enableAddressSanitizer = "YES"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
Expand Down Expand Up @@ -329,6 +331,7 @@ Here is an example output:
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
customLLDBInitFile = "/Users/brentley/Developer/rules_xcodeproj/tools/tools.xcodeproj/rules_xcodeproj/bazel.lldbinit"
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<PreActions>
Expand Down
Loading
Loading