mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
Merge branch 'master' into external-target-ref
This commit is contained in:
@@ -69,6 +69,7 @@ public struct Scheme: Equatable {
|
||||
|
||||
public struct Run: BuildAction {
|
||||
public static let disableMainThreadCheckerDefault = false
|
||||
public static let debugEnabledDefault = true
|
||||
|
||||
public var config: String?
|
||||
public var commandLineArguments: [String: Bool]
|
||||
@@ -78,6 +79,7 @@ public struct Scheme: Equatable {
|
||||
public var disableMainThreadChecker: Bool
|
||||
public var language: String?
|
||||
public var region: String?
|
||||
public var debugEnabled: Bool
|
||||
|
||||
public init(
|
||||
config: String,
|
||||
@@ -87,7 +89,8 @@ public struct Scheme: Equatable {
|
||||
environmentVariables: [XCScheme.EnvironmentVariable] = [],
|
||||
disableMainThreadChecker: Bool = disableMainThreadCheckerDefault,
|
||||
language: String? = nil,
|
||||
region: String? = nil
|
||||
region: String? = nil,
|
||||
debugEnabled: Bool = debugEnabledDefault
|
||||
) {
|
||||
self.config = config
|
||||
self.commandLineArguments = commandLineArguments
|
||||
@@ -97,12 +100,14 @@ public struct Scheme: Equatable {
|
||||
self.disableMainThreadChecker = disableMainThreadChecker
|
||||
self.language = language
|
||||
self.region = region
|
||||
self.debugEnabled = debugEnabled
|
||||
}
|
||||
}
|
||||
|
||||
public struct Test: BuildAction {
|
||||
public static let gatherCoverageDataDefault = false
|
||||
public static let disableMainThreadCheckerDefault = false
|
||||
public static let debugEnabledDefault = true
|
||||
|
||||
public var config: String?
|
||||
public var gatherCoverageData: Bool
|
||||
@@ -114,6 +119,7 @@ public struct Scheme: Equatable {
|
||||
public var environmentVariables: [XCScheme.EnvironmentVariable]
|
||||
public var language: String?
|
||||
public var region: String?
|
||||
public var debugEnabled: Bool
|
||||
|
||||
public struct TestTarget: Equatable, ExpressibleByStringLiteral {
|
||||
public static let randomExecutionOrderDefault = false
|
||||
@@ -161,7 +167,8 @@ public struct Scheme: Equatable {
|
||||
postActions: [ExecutionAction] = [],
|
||||
environmentVariables: [XCScheme.EnvironmentVariable] = [],
|
||||
language: String? = nil,
|
||||
region: String? = nil
|
||||
region: String? = nil,
|
||||
debugEnabled: Bool = debugEnabledDefault
|
||||
) {
|
||||
self.config = config
|
||||
self.gatherCoverageData = gatherCoverageData
|
||||
@@ -173,6 +180,7 @@ public struct Scheme: Equatable {
|
||||
self.environmentVariables = environmentVariables
|
||||
self.language = language
|
||||
self.region = region
|
||||
self.debugEnabled = debugEnabled
|
||||
}
|
||||
|
||||
public var shouldUseLaunchSchemeArgsEnv: Bool {
|
||||
@@ -324,6 +332,7 @@ extension Scheme.Run: JSONObjectConvertible {
|
||||
disableMainThreadChecker = jsonDictionary.json(atKeyPath: "disableMainThreadChecker") ?? Scheme.Run.disableMainThreadCheckerDefault
|
||||
language = jsonDictionary.json(atKeyPath: "language")
|
||||
region = jsonDictionary.json(atKeyPath: "region")
|
||||
debugEnabled = jsonDictionary.json(atKeyPath: "debugEnabled") ?? Scheme.Run.debugEnabledDefault
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,6 +352,9 @@ extension Scheme.Run: JSONEncodable {
|
||||
dict["disableMainThreadChecker"] = disableMainThreadChecker
|
||||
}
|
||||
|
||||
if debugEnabled != Scheme.Run.debugEnabledDefault {
|
||||
dict["debugEnabled"] = debugEnabled
|
||||
}
|
||||
return dict
|
||||
}
|
||||
}
|
||||
@@ -372,6 +384,7 @@ extension Scheme.Test: JSONObjectConvertible {
|
||||
environmentVariables = try XCScheme.EnvironmentVariable.parseAll(jsonDictionary: jsonDictionary)
|
||||
language = jsonDictionary.json(atKeyPath: "language")
|
||||
region = jsonDictionary.json(atKeyPath: "region")
|
||||
debugEnabled = jsonDictionary.json(atKeyPath: "debugEnabled") ?? Scheme.Test.debugEnabledDefault
|
||||
}
|
||||
}
|
||||
|
||||
@@ -396,6 +409,10 @@ extension Scheme.Test: JSONEncodable {
|
||||
dict["disableMainThreadChecker"] = disableMainThreadChecker
|
||||
}
|
||||
|
||||
if debugEnabled != Scheme.Run.debugEnabledDefault {
|
||||
dict["debugEnabled"] = debugEnabled
|
||||
}
|
||||
|
||||
return dict
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,6 +161,7 @@ public class SchemeGenerator {
|
||||
testables: testables,
|
||||
preActions: scheme.test?.preActions.map(getExecutionAction) ?? [],
|
||||
postActions: scheme.test?.postActions.map(getExecutionAction) ?? [],
|
||||
selectedDebuggerIdentifier: (scheme.test?.debugEnabled ?? Scheme.Test.debugEnabledDefault) ? XCScheme.defaultDebugger : "",
|
||||
shouldUseLaunchSchemeArgsEnv: scheme.test?.shouldUseLaunchSchemeArgsEnv ?? true,
|
||||
codeCoverageEnabled: scheme.test?.gatherCoverageData ?? Scheme.Test.gatherCoverageDataDefault,
|
||||
disableMainThreadChecker: scheme.test?.disableMainThreadChecker ?? Scheme.Test.disableMainThreadCheckerDefault,
|
||||
@@ -176,6 +177,8 @@ public class SchemeGenerator {
|
||||
preActions: scheme.run?.preActions.map(getExecutionAction) ?? [],
|
||||
postActions: scheme.run?.postActions.map(getExecutionAction) ?? [],
|
||||
macroExpansion: shouldExecuteOnLaunch ? nil : buildableReference,
|
||||
selectedDebuggerIdentifier: (scheme.run?.debugEnabled ?? Scheme.Run.debugEnabledDefault) ? XCScheme.defaultDebugger : "",
|
||||
selectedLauncherIdentifier: (scheme.run?.debugEnabled ?? Scheme.Run.debugEnabledDefault) ? XCScheme.defaultLauncher : "Xcode.IDEFoundation.Launcher.PosixSpawn",
|
||||
disableMainThreadChecker: scheme.run?.disableMainThreadChecker ?? Scheme.Run.disableMainThreadCheckerDefault,
|
||||
commandlineArguments: launchCommandLineArgs,
|
||||
environmentVariables: launchVariables,
|
||||
|
||||
@@ -242,12 +242,15 @@ class SourceGenerator {
|
||||
let groupReference: PBXGroup
|
||||
|
||||
if let cachedGroup = groupsByPath[path] {
|
||||
var cachedGroupChildren = cachedGroup.children
|
||||
for child in children {
|
||||
// only add the children that aren't already in the cachedGroup
|
||||
if !cachedGroup.children.contains(child) {
|
||||
cachedGroup.children.append(child)
|
||||
// Check equality by path and sourceTree because XcodeProj.PBXObject.== is very slow.
|
||||
if !cachedGroupChildren.contains(where: { $0.path == child.path && $0.sourceTree == child.sourceTree }) {
|
||||
cachedGroupChildren.append(child)
|
||||
}
|
||||
}
|
||||
cachedGroup.children = cachedGroupChildren
|
||||
groupReference = cachedGroup
|
||||
} else {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user