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 {
|
public static func ==(lhs: ProjectSpec, rhs: ProjectSpec) -> Bool {
|
||||||
return lhs.name == rhs.name &&
|
return lhs.name == rhs.name &&
|
||||||
lhs.targets == rhs.targets &&
|
lhs.targets == rhs.targets &&
|
||||||
lhs.settings == rhs.settings &&
|
lhs.settings == rhs.settings &&
|
||||||
lhs.settingPresets == rhs.settingPresets &&
|
lhs.settingPresets == rhs.settingPresets &&
|
||||||
lhs.configs == rhs.configs &&
|
lhs.configs == rhs.configs &&
|
||||||
lhs.schemes == rhs.schemes &&
|
lhs.schemes == rhs.schemes &&
|
||||||
lhs.options == rhs.options
|
lhs.options == rhs.options
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,10 +125,10 @@ public struct Scheme: Equatable {
|
|||||||
public static func ==(lhs: Scheme, rhs: Scheme) -> Bool {
|
public static func ==(lhs: Scheme, rhs: Scheme) -> Bool {
|
||||||
return lhs.build == rhs.build &&
|
return lhs.build == rhs.build &&
|
||||||
lhs.run == rhs.run &&
|
lhs.run == rhs.run &&
|
||||||
lhs.test == rhs.test &&
|
lhs.test == rhs.test &&
|
||||||
lhs.analyze == rhs.analyze &&
|
lhs.analyze == rhs.analyze &&
|
||||||
lhs.profile == rhs.profile &&
|
lhs.profile == rhs.profile &&
|
||||||
lhs.archive == rhs.archive
|
lhs.archive == rhs.archive
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +138,6 @@ protocol BuildAction: Equatable {
|
|||||||
init(config: String)
|
init(config: String)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extension Scheme.Run: JSONObjectConvertible {
|
extension Scheme.Run: JSONObjectConvertible {
|
||||||
|
|
||||||
public init(jsonDictionary: JSONDictionary) throws {
|
public init(jsonDictionary: JSONDictionary) throws {
|
||||||
@ -213,7 +212,7 @@ extension Scheme.BuildTarget: JSONObjectConvertible {
|
|||||||
let types: [String: Bool] = try jsonDictionary.json(atKeyPath: "buildTypes")
|
let types: [String: Bool] = try jsonDictionary.json(atKeyPath: "buildTypes")
|
||||||
var buildTypes: [BuildType] = []
|
var buildTypes: [BuildType] = []
|
||||||
for (type, build) in types {
|
for (type, build) in types {
|
||||||
if build , let buildType = BuildType.from(jsonValue: type) {
|
if build, let buildType = BuildType.from(jsonValue: type) {
|
||||||
buildTypes.append(buildType)
|
buildTypes.append(buildType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -237,7 +236,7 @@ extension BuildType: JSONPrimitiveConvertible {
|
|||||||
default: return nil
|
default: return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static var all: [BuildType] {
|
public static var all: [BuildType] {
|
||||||
return [.running, .testing, .profiling, .analyzing, .archiving]
|
return [.running, .testing, .profiling, .analyzing, .archiving]
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,6 @@ public class ProjectGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let scripts = target.prebuildScripts + target.postbuildScripts
|
let scripts = target.prebuildScripts + target.postbuildScripts
|
||||||
for script in scripts {
|
for script in scripts {
|
||||||
if case let .path(pathString) = script.script {
|
if case let .path(pathString) = script.script {
|
||||||
@ -222,14 +221,13 @@ public class ProjectGenerator {
|
|||||||
if scheme.configVariants.isEmpty {
|
if scheme.configVariants.isEmpty {
|
||||||
let schemeName = target.name
|
let schemeName = target.name
|
||||||
|
|
||||||
let debugConfig = spec.configs.first { $0.type == .debug}!
|
let debugConfig = spec.configs.first { $0.type == .debug }!
|
||||||
let releaseConfig = spec.configs.first { $0.type == .release}!
|
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 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)
|
let scheme = try generateScheme(specScheme, pbxProject: pbxProject, tests: scheme.testTargets)
|
||||||
xcschemes.append(scheme)
|
xcschemes.append(scheme)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
for configVariant in scheme.configVariants {
|
for configVariant in scheme.configVariants {
|
||||||
|
|
||||||
let schemeName = "\(target.name) \(configVariant)"
|
let schemeName = "\(target.name) \(configVariant)"
|
||||||
|
@ -73,7 +73,7 @@ func specLoadingTests() {
|
|||||||
["target": "Target", "buildTypes": "all"],
|
["target": "Target", "buildTypes": "all"],
|
||||||
["target": "Target", "buildTypes": ["testing": true]],
|
["target": "Target", "buildTypes": ["testing": true]],
|
||||||
["target": "Target", "buildTypes": ["testing": false]],
|
["target": "Target", "buildTypes": ["testing": false]],
|
||||||
]],
|
]],
|
||||||
]
|
]
|
||||||
let scheme = try Scheme(name: "Scheme", jsonDictionary: schemeDictionary)
|
let scheme = try Scheme(name: "Scheme", jsonDictionary: schemeDictionary)
|
||||||
let expectedTargets: [Scheme.BuildTarget] = [
|
let expectedTargets: [Scheme.BuildTarget] = [
|
||||||
@ -83,7 +83,7 @@ func specLoadingTests() {
|
|||||||
Scheme.BuildTarget(target: "Target", buildTypes: BuildType.all),
|
Scheme.BuildTarget(target: "Target", buildTypes: BuildType.all),
|
||||||
Scheme.BuildTarget(target: "Target", buildTypes: [.testing]),
|
Scheme.BuildTarget(target: "Target", buildTypes: [.testing]),
|
||||||
Scheme.BuildTarget(target: "Target", buildTypes: []),
|
Scheme.BuildTarget(target: "Target", buildTypes: []),
|
||||||
]
|
]
|
||||||
try expect(scheme.name) == "Scheme"
|
try expect(scheme.name) == "Scheme"
|
||||||
try expect(scheme.build.targets) == expectedTargets
|
try expect(scheme.build.targets) == expectedTargets
|
||||||
}
|
}
|
||||||
@ -118,15 +118,15 @@ func specLoadingTests() {
|
|||||||
var target = validTarget
|
var target = validTarget
|
||||||
let scripts: [[String: Any]] = [
|
let scripts: [[String: Any]] = [
|
||||||
["path": "script.sh"],
|
["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["prebuildScripts"] = scripts
|
||||||
target["postbuildScripts"] = scripts
|
target["postbuildScripts"] = scripts
|
||||||
|
|
||||||
let expectedScripts = [
|
let expectedScripts = [
|
||||||
RunScript(script: .path("script.sh")),
|
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)
|
let parsedTarget = try Target(jsonDictionary: target)
|
||||||
try expect(parsedTarget.prebuildScripts) == expectedScripts
|
try expect(parsedTarget.prebuildScripts) == expectedScripts
|
||||||
@ -135,7 +135,7 @@ func specLoadingTests() {
|
|||||||
|
|
||||||
$0.it("parses options") {
|
$0.it("parses options") {
|
||||||
let expected = ProjectSpec(name: "test", options: .init(carthageBuildPath: "../Carthage/Build"))
|
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
|
try expect(parsedSpec) == expected
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user