Skip to content

Commit

Permalink
unify argument positions
Browse files Browse the repository at this point in the history
Signed-off-by: Corentin Kerisit <[email protected]>
  • Loading branch information
cerisier committed Oct 24, 2024
1 parent 02f6de4 commit ff38973
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 40 deletions.
7 changes: 7 additions & 0 deletions tools/generators/lib/XCScheme/src/CreateTestAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public struct CreateTestAction {
enableThreadSanitizer: Bool,
enableUBSanitizer: Bool,
enableMainThreadChecker: Bool,
enableThreadPerformanceChecker: Bool,
environmentVariables: [EnvironmentVariable],
expandVariablesBasedOn: BuildableReference?,
postActions: [ExecutionAction],
Expand All @@ -30,6 +31,7 @@ public struct CreateTestAction {
/*enableThreadSanitizer:*/ enableThreadSanitizer,
/*enableUBSanitizer:*/ enableUBSanitizer,
/*enableMainThreadChecker:*/ enableMainThreadChecker,
/*enableThreadPerformanceChecker:*/ enableThreadPerformanceChecker,
/*environmentVariables:*/ environmentVariables,
/*expandVariablesBasedOn:*/ expandVariablesBasedOn,
/*postActions:*/ postActions,
Expand All @@ -50,6 +52,7 @@ extension CreateTestAction {
_ enableThreadSanitizer: Bool,
_ enableUBSanitizer: Bool,
_ enableMainThreadChecker: Bool,
_ enableThreadPerformanceChecker: Bool,
_ environmentVariables: [EnvironmentVariable],
_ expandVariablesBasedOn: BuildableReference?,
_ postActions: [ExecutionAction],
Expand All @@ -65,6 +68,7 @@ extension CreateTestAction {
enableThreadSanitizer: Bool,
enableUBSanitizer: Bool,
enableMainThreadChecker: Bool,
enableThreadPerformanceChecker: Bool,
environmentVariables: [EnvironmentVariable],
expandVariablesBasedOn macroReference: BuildableReference?,
postActions: [ExecutionAction],
Expand Down Expand Up @@ -96,6 +100,9 @@ buildConfiguration = "\#(buildConfiguration)"
if !enableMainThreadChecker {
components.append(#"disableMainThreadChecker = "YES""#)
}
if !enableThreadPerformanceChecker {
components.append(#"disablePerformanceAntipatternChecker = "YES""#)
}

let macroExpansion: String
if let macroReference {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ private func createTestActionWithDefaults(
enableThreadSanitizer: Bool = false,
enableUBSanitizer: Bool = false,
enableMainThreadChecker: Bool = true,
enableThreadPerformanceChecker: Bool = true,
environmentVariables: [EnvironmentVariable] = [],
expandVariablesBasedOn macroReference: BuildableReference? = nil,
postActions: [ExecutionAction] = [],
Expand All @@ -407,6 +408,7 @@ private func createTestActionWithDefaults(
enableThreadSanitizer: enableThreadSanitizer,
enableUBSanitizer: enableUBSanitizer,
enableMainThreadChecker: enableMainThreadChecker,
enableThreadPerformanceChecker: enableThreadPerformanceChecker,
environmentVariables: environmentVariables,
expandVariablesBasedOn: macroReference,
postActions: postActions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,11 @@ extension Generator.CreateAutomaticSchemeInfo {
test: .init(
buildTargets: [],
commandLineArguments: testCommandLineArguments,
enableMainThreadChecker: false,
enableAddressSanitizer: false,
enableThreadSanitizer: false,
enableUBSanitizer: false,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
environmentVariables: testEnvironmentVariables,
testTargets: isTest ?
[.init(target: target, isEnabled: true)] : [],
Expand All @@ -126,11 +127,11 @@ extension Generator.CreateAutomaticSchemeInfo {
buildTargets: buildTargets,
commandLineArguments: runCommandLineArguments,
customWorkingDirectory: nil,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
enableAddressSanitizer: false,
enableThreadSanitizer: false,
enableUBSanitizer: false,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
environmentVariables: runEnvironmentVariables,
launchTarget: launchTarget,
xcodeConfiguration: nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,11 +538,11 @@ set
buildTargets: buildTargets,
commandLineArguments: commandLineArguments,
customWorkingDirectory: customWorkingDirectory,
enableMainThreadChecker: enableMainThreadChecker,
enableThreadPerformanceChecker: enableThreadPerformanceChecker,
enableAddressSanitizer: enableAddressSanitizer,
enableThreadSanitizer: enableThreadSanitizer,
enableUBSanitizer: enableUBSanitizer,
enableMainThreadChecker: enableMainThreadChecker,
enableThreadPerformanceChecker: enableThreadPerformanceChecker,
environmentVariables: environmentVariables,
launchTarget: launchTarget,
xcodeConfiguration: xcodeConfiguration
Expand Down Expand Up @@ -609,9 +609,7 @@ set
as: Bool.self,
in: url
)
// Ignoring this param as for now, the logic for writing diagnostics params
// are shared between test and run.
let _ = try consumeArg(
let enableThreadPerformanceChecker = try consumeArg(
"test-enable-performance-anti-pattern-checker",
as: Bool.self,
in: url
Expand Down Expand Up @@ -704,10 +702,11 @@ set
return SchemeInfo.Test(
buildTargets: buildTargets,
commandLineArguments: commandLineArguments,
enableMainThreadChecker: enableMainThreadChecker,
enableAddressSanitizer: enableAddressSanitizer,
enableThreadSanitizer: enableThreadSanitizer,
enableUBSanitizer: enableUBSanitizer,
enableMainThreadChecker: enableMainThreadChecker,
enableThreadPerformanceChecker: enableThreadPerformanceChecker,
environmentVariables: environmentVariables,
testTargets: testTargets,
useRunArgsAndEnv: useRunArgsAndEnv,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ extension Generator.CreateScheme {
enableThreadSanitizer: schemeInfo.test.enableThreadSanitizer,
enableUBSanitizer: schemeInfo.test.enableUBSanitizer,
enableMainThreadChecker: schemeInfo.test.enableMainThreadChecker,
enableThreadPerformanceChecker: schemeInfo.test.enableThreadPerformanceChecker,
environmentVariables: schemeInfo.test.environmentVariables,
expandVariablesBasedOn: testUseLaunchSchemeArgsEnv ?
nil : testables.first?.buildableReference,
Expand Down
7 changes: 4 additions & 3 deletions tools/generators/xcschemes/src/Generator/SchemeInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ struct SchemeInfo: Equatable {
struct Test: Equatable {
let buildTargets: [Target]
let commandLineArguments: [CommandLineArgument]
let enableMainThreadChecker: Bool
let enableAddressSanitizer: Bool
let enableThreadSanitizer: Bool
let enableUBSanitizer: Bool
let enableMainThreadChecker: Bool
let enableThreadPerformanceChecker: Bool
let environmentVariables: [EnvironmentVariable]
let testTargets: [TestTarget]
let useRunArgsAndEnv: Bool
Expand All @@ -56,11 +57,11 @@ struct SchemeInfo: Equatable {
let buildTargets: [Target]
let commandLineArguments: [CommandLineArgument]
let customWorkingDirectory: String?
let enableMainThreadChecker: Bool
let enableThreadPerformanceChecker: Bool
let enableAddressSanitizer: Bool
let enableThreadSanitizer: Bool
let enableUBSanitizer: Bool
let enableMainThreadChecker: Bool
let enableThreadPerformanceChecker: Bool
let environmentVariables: [EnvironmentVariable]
let launchTarget: LaunchTarget?
let xcodeConfiguration: String?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,11 @@ final class CreateAutomaticSchemeInfoTests: XCTestCase {
test: .init(
buildTargets: [],
commandLineArguments: [],
enableMainThreadChecker: false,
enableAddressSanitizer: false,
enableThreadSanitizer: false,
enableUBSanitizer: false,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
environmentVariables: [],
testTargets: [],
useRunArgsAndEnv: true,
Expand All @@ -143,11 +144,11 @@ final class CreateAutomaticSchemeInfoTests: XCTestCase {
buildTargets: [],
commandLineArguments: [],
customWorkingDirectory: nil,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
enableAddressSanitizer: false,
enableThreadSanitizer: false,
enableUBSanitizer: false,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
environmentVariables: baseEnvironmentVariables,
launchTarget: .target(
primary: launchable,
Expand Down Expand Up @@ -210,10 +211,11 @@ final class CreateAutomaticSchemeInfoTests: XCTestCase {
test: .init(
buildTargets: [],
commandLineArguments: [],
enableMainThreadChecker: false,
enableAddressSanitizer: false,
enableThreadSanitizer: false,
enableUBSanitizer: false,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
environmentVariables: [],
testTargets: [],
useRunArgsAndEnv: true,
Expand All @@ -223,11 +225,11 @@ final class CreateAutomaticSchemeInfoTests: XCTestCase {
buildTargets: [],
commandLineArguments: [],
customWorkingDirectory: nil,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
enableAddressSanitizer: false,
enableThreadSanitizer: false,
enableUBSanitizer: false,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
environmentVariables: baseEnvironmentVariables,
launchTarget: .target(
primary: launchable,
Expand Down Expand Up @@ -286,10 +288,11 @@ final class CreateAutomaticSchemeInfoTests: XCTestCase {
test: .init(
buildTargets: [],
commandLineArguments: [],
enableMainThreadChecker: false,
enableAddressSanitizer: false,
enableThreadSanitizer: false,
enableUBSanitizer: false,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
environmentVariables: [],
testTargets: [],
useRunArgsAndEnv: true,
Expand All @@ -299,11 +302,11 @@ final class CreateAutomaticSchemeInfoTests: XCTestCase {
buildTargets: [],
commandLineArguments: commandLineArguments,
customWorkingDirectory: nil,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
enableAddressSanitizer: false,
enableThreadSanitizer: false,
enableUBSanitizer: false,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
environmentVariables: baseEnvironmentVariables,
launchTarget: .target(
primary: launchable,
Expand Down Expand Up @@ -361,10 +364,11 @@ final class CreateAutomaticSchemeInfoTests: XCTestCase {
test: .init(
buildTargets: [],
commandLineArguments: [],
enableMainThreadChecker: false,
enableAddressSanitizer: false,
enableThreadSanitizer: false,
enableUBSanitizer: false,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
environmentVariables: [],
testTargets: [],
useRunArgsAndEnv: true,
Expand All @@ -374,11 +378,11 @@ final class CreateAutomaticSchemeInfoTests: XCTestCase {
buildTargets: [],
commandLineArguments: [],
customWorkingDirectory: nil,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
enableAddressSanitizer: false,
enableThreadSanitizer: false,
enableUBSanitizer: false,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
environmentVariables:
baseEnvironmentVariables + environmentVariables,
launchTarget: .target(
Expand Down Expand Up @@ -435,10 +439,11 @@ final class CreateAutomaticSchemeInfoTests: XCTestCase {
test: .init(
buildTargets: [],
commandLineArguments: [],
enableMainThreadChecker: false,
enableAddressSanitizer: false,
enableThreadSanitizer: false,
enableUBSanitizer: false,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
environmentVariables: [],
testTargets: [],
useRunArgsAndEnv: true,
Expand All @@ -448,11 +453,11 @@ final class CreateAutomaticSchemeInfoTests: XCTestCase {
buildTargets: [library],
commandLineArguments: [],
customWorkingDirectory: nil,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
enableAddressSanitizer: false,
enableThreadSanitizer: false,
enableUBSanitizer: false,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
environmentVariables: baseEnvironmentVariables,
launchTarget: nil,
xcodeConfiguration: nil
Expand Down Expand Up @@ -501,10 +506,11 @@ final class CreateAutomaticSchemeInfoTests: XCTestCase {
test: .init(
buildTargets: [],
commandLineArguments: [],
enableMainThreadChecker: false,
enableAddressSanitizer: false,
enableThreadSanitizer: false,
enableUBSanitizer: false,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
environmentVariables: baseEnvironmentVariables,
testTargets: [.init(target: test, isEnabled: true)],
useRunArgsAndEnv: false,
Expand All @@ -514,11 +520,11 @@ final class CreateAutomaticSchemeInfoTests: XCTestCase {
buildTargets: [test],
commandLineArguments: [],
customWorkingDirectory: nil,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
enableAddressSanitizer: false,
enableThreadSanitizer: false,
enableUBSanitizer: false,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
environmentVariables: [],
launchTarget: nil,
xcodeConfiguration: nil
Expand Down Expand Up @@ -570,10 +576,11 @@ final class CreateAutomaticSchemeInfoTests: XCTestCase {
test: .init(
buildTargets: [],
commandLineArguments: commandLineArguments,
enableMainThreadChecker: false,
enableAddressSanitizer: false,
enableThreadSanitizer: false,
enableUBSanitizer: false,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
environmentVariables: baseEnvironmentVariables,
testTargets: [.init(target: test, isEnabled: true)],
useRunArgsAndEnv: false,
Expand All @@ -583,11 +590,11 @@ final class CreateAutomaticSchemeInfoTests: XCTestCase {
buildTargets: [test],
commandLineArguments: [],
customWorkingDirectory: nil,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
enableAddressSanitizer: false,
enableThreadSanitizer: false,
enableUBSanitizer: false,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
environmentVariables: [],
launchTarget: nil,
xcodeConfiguration: nil
Expand Down Expand Up @@ -639,10 +646,11 @@ final class CreateAutomaticSchemeInfoTests: XCTestCase {
test: .init(
buildTargets: [],
commandLineArguments: [],
enableMainThreadChecker: false,
enableAddressSanitizer: false,
enableThreadSanitizer: false,
enableUBSanitizer: false,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
environmentVariables:
baseEnvironmentVariables + environmentVariables,
testTargets: [.init(target: test, isEnabled: true)],
Expand All @@ -653,11 +661,11 @@ final class CreateAutomaticSchemeInfoTests: XCTestCase {
buildTargets: [test],
commandLineArguments: [],
customWorkingDirectory: nil,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
enableAddressSanitizer: false,
enableThreadSanitizer: false,
enableUBSanitizer: false,
enableMainThreadChecker: false,
enableThreadPerformanceChecker: false,
environmentVariables: [],
launchTarget: nil,
xcodeConfiguration: nil
Expand Down
Loading

0 comments on commit ff38973

Please sign in to comment.