mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2024-11-14 04:14:15 +03:00
swiftformat
This commit is contained in:
parent
68f3a57d2c
commit
3cfd3ce816
@ -53,12 +53,12 @@ extension ProjectSpec: Equatable {
|
||||
|
||||
public static func ==(lhs: ProjectSpec, rhs: ProjectSpec) -> Bool {
|
||||
return lhs.name == rhs.name &&
|
||||
lhs.targets == rhs.targets &&
|
||||
lhs.settings == rhs.settings &&
|
||||
lhs.settingPresets == rhs.settingPresets &&
|
||||
lhs.configs == rhs.configs &&
|
||||
lhs.schemes == rhs.schemes &&
|
||||
lhs.options == rhs.options
|
||||
lhs.targets == rhs.targets &&
|
||||
lhs.settings == rhs.settings &&
|
||||
lhs.settingPresets == rhs.settingPresets &&
|
||||
lhs.configs == rhs.configs &&
|
||||
lhs.schemes == rhs.schemes &&
|
||||
lhs.options == rhs.options
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,10 +125,10 @@ public struct Scheme: Equatable {
|
||||
public static func ==(lhs: Scheme, rhs: Scheme) -> Bool {
|
||||
return lhs.build == rhs.build &&
|
||||
lhs.run == rhs.run &&
|
||||
lhs.test == rhs.test &&
|
||||
lhs.analyze == rhs.analyze &&
|
||||
lhs.profile == rhs.profile &&
|
||||
lhs.archive == rhs.archive
|
||||
lhs.test == rhs.test &&
|
||||
lhs.analyze == rhs.analyze &&
|
||||
lhs.profile == rhs.profile &&
|
||||
lhs.archive == rhs.archive
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,7 +138,6 @@ protocol BuildAction: Equatable {
|
||||
init(config: String)
|
||||
}
|
||||
|
||||
|
||||
extension Scheme.Run: JSONObjectConvertible {
|
||||
|
||||
public init(jsonDictionary: JSONDictionary) throws {
|
||||
@ -213,7 +212,7 @@ extension Scheme.BuildTarget: JSONObjectConvertible {
|
||||
let types: [String: Bool] = try jsonDictionary.json(atKeyPath: "buildTypes")
|
||||
var buildTypes: [BuildType] = []
|
||||
for (type, build) in types {
|
||||
if build , let buildType = BuildType.from(jsonValue: type) {
|
||||
if build, let buildType = BuildType.from(jsonValue: type) {
|
||||
buildTypes.append(buildType)
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,6 @@ public class ProjectGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let scripts = target.prebuildScripts + target.postbuildScripts
|
||||
for script in scripts {
|
||||
if case let .path(pathString) = script.script {
|
||||
@ -222,14 +221,13 @@ public class ProjectGenerator {
|
||||
if scheme.configVariants.isEmpty {
|
||||
let schemeName = target.name
|
||||
|
||||
let debugConfig = spec.configs.first { $0.type == .debug}!
|
||||
let releaseConfig = spec.configs.first { $0.type == .release}!
|
||||
let debugConfig = spec.configs.first { $0.type == .debug }!
|
||||
let releaseConfig = spec.configs.first { $0.type == .release }!
|
||||
|
||||
let specScheme = Scheme(name: schemeName, targets: [Scheme.BuildTarget(target: target.name)], debugConfig: debugConfig.name, releaseConfig: releaseConfig.name)
|
||||
let scheme = try generateScheme(specScheme, pbxProject: pbxProject, tests: scheme.testTargets)
|
||||
xcschemes.append(scheme)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
for configVariant in scheme.configVariants {
|
||||
|
||||
let schemeName = "\(target.name) \(configVariant)"
|
||||
|
@ -73,7 +73,7 @@ func specLoadingTests() {
|
||||
["target": "Target", "buildTypes": "all"],
|
||||
["target": "Target", "buildTypes": ["testing": true]],
|
||||
["target": "Target", "buildTypes": ["testing": false]],
|
||||
]],
|
||||
]],
|
||||
]
|
||||
let scheme = try Scheme(name: "Scheme", jsonDictionary: schemeDictionary)
|
||||
let expectedTargets: [Scheme.BuildTarget] = [
|
||||
@ -83,7 +83,7 @@ func specLoadingTests() {
|
||||
Scheme.BuildTarget(target: "Target", buildTypes: BuildType.all),
|
||||
Scheme.BuildTarget(target: "Target", buildTypes: [.testing]),
|
||||
Scheme.BuildTarget(target: "Target", buildTypes: []),
|
||||
]
|
||||
]
|
||||
try expect(scheme.name) == "Scheme"
|
||||
try expect(scheme.build.targets) == expectedTargets
|
||||
}
|
||||
@ -118,15 +118,15 @@ func specLoadingTests() {
|
||||
var target = validTarget
|
||||
let scripts: [[String: Any]] = [
|
||||
["path": "script.sh"],
|
||||
["script": "shell script\ndo thing", "name": "myscript", "inputFiles": ["file","file2"], "outputFiles": ["file","file2"], "shell": "bin/customshell", "runOnlyWhenInstalling": true],
|
||||
["script": "shell script\ndo thing", "name": "myscript", "inputFiles": ["file", "file2"], "outputFiles": ["file", "file2"], "shell": "bin/customshell", "runOnlyWhenInstalling": true],
|
||||
]
|
||||
target["prebuildScripts"] = scripts
|
||||
target["postbuildScripts"] = scripts
|
||||
|
||||
let expectedScripts = [
|
||||
RunScript(script: .path("script.sh")),
|
||||
RunScript(script: .script("shell script\ndo thing"), name: "myscript", inputFiles: ["file","file2"], outputFiles: ["file","file2"], shell: "bin/customshell", runOnlyWhenInstalling: true),
|
||||
]
|
||||
RunScript(script: .script("shell script\ndo thing"), name: "myscript", inputFiles: ["file", "file2"], outputFiles: ["file", "file2"], shell: "bin/customshell", runOnlyWhenInstalling: true),
|
||||
]
|
||||
|
||||
let parsedTarget = try Target(jsonDictionary: target)
|
||||
try expect(parsedTarget.prebuildScripts) == expectedScripts
|
||||
@ -135,7 +135,7 @@ func specLoadingTests() {
|
||||
|
||||
$0.it("parses options") {
|
||||
let expected = ProjectSpec(name: "test", options: .init(carthageBuildPath: "../Carthage/Build"))
|
||||
let parsedSpec = try getProjectSpec(["options":["carthageBuildPath": "../Carthage/Build"]])
|
||||
let parsedSpec = try getProjectSpec(["options": ["carthageBuildPath": "../Carthage/Build"]])
|
||||
try expect(parsedSpec) == expected
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user