formatting

This commit is contained in:
yonaskolb 2019-11-08 00:37:29 +11:00
parent aa0fd85bfe
commit 44f9ffa51a
6 changed files with 23 additions and 14 deletions

View File

@ -144,7 +144,7 @@ extension Dictionary where Key == String, Value: Any {
return merged
}
func expand(variables: [String:String]) -> JSONDictionary {
func expand(variables: [String: String]) -> JSONDictionary {
var expanded: JSONDictionary = self
if !variables.isEmpty {
@ -189,8 +189,7 @@ extension Dictionary where Key == String, Value: Any {
index = result.endIndex
} else if substring[index] == "$"
&& substring[substring.index(index, offsetBy: 1)] == "{"
&& substring[substring.index(index, offsetBy: 2)] != "}"
{
&& substring[substring.index(index, offsetBy: 2)] != "}" {
// This is the start of a variable expansion...
let variableStart = index
if let variableEnd = substring.firstIndex(of: "}") {

View File

@ -9,11 +9,19 @@ class DumpCommand: ProjectCommand {
override var name: String { "dump" }
override var shortDescription: String { "Dumps the project spec to stdout" }
private let dumpType = Key<DumpType>("--type", "-t", description: """
The type of dump to output. Either "json", "yaml", "summary", "swift-dump", "parsed-json", or "parsed-yaml". Defaults to yaml. The "parsed" types parse the project into swift and then back again and can be used for testing.
""")
private let dumpType = Key<DumpType>(
"--type",
"-t",
description: """
The type of dump to output. Either "json", "yaml", "summary", "swift-dump", "parsed-json", or "parsed-yaml". Defaults to yaml. The "parsed" types parse the project into swift and then back again and can be used for testing.
"""
)
private let file = Key<Path>("--file", "-f", description: "The path of a file to write to. If not supplied will output to stdout")
private let file = Key<Path>(
"--file",
"-f",
description: "The path of a file to write to. If not supplied will output to stdout"
)
override func execute(specLoader: SpecLoader, projectSpecPath: Path, project: Project) throws {
let type = dumpType.value ?? .yaml
@ -47,7 +55,7 @@ class DumpCommand: ProjectCommand {
}
}
fileprivate enum DumpType: String, ConvertibleFromString {
private enum DumpType: String, ConvertibleFromString {
case swiftDump = "swift-dump"
case json
case yaml

View File

@ -29,7 +29,11 @@ class GenerateCommand: ProjectCommand {
description: "Where the cache file will be loaded from and save to. Defaults to ~/.xcodegen/cache/{SPEC_PATH_HASH}"
)
let projectDirectory = Key<Path>("-p", "--project", description: "The path to the directory where the project should be generated. Defaults to the directory the spec is in. The filename is defined in the project spec")
let projectDirectory = Key<Path>(
"-p",
"--project",
description: "The path to the directory where the project should be generated. Defaults to the directory the spec is in. The filename is defined in the project spec"
)
override func execute(specLoader: SpecLoader, projectSpecPath: Path, project: Project) throws {

View File

@ -50,7 +50,5 @@ class ProjectCommand: Command {
try execute(specLoader: specLoader, projectSpecPath: projectSpecPath, project: project)
}
func execute(specLoader: SpecLoader, projectSpecPath: Path, project: Project) throws {
}
func execute(specLoader: SpecLoader, projectSpecPath: Path, project: Project) throws {}
}

View File

@ -14,7 +14,7 @@ public class XcodeGenCLI {
description: "Generates Xcode projects",
commands: [
generateCommand,
DumpCommand(version: version)
DumpCommand(version: version),
]
)
cli.parser.routeBehavior = .searchWithFallback(generateCommand)

View File

@ -479,7 +479,7 @@ public class PBXProjGenerator {
let dependecyLinkage = dependencyTarget.defaultLinkage
let link = dependency.link ??
((dependecyLinkage == .dynamic && target.type != .staticLibrary) ||
(dependecyLinkage == .static && target.type.isExecutable))
(dependecyLinkage == .static && target.type.isExecutable))
if link {
let dependencyFile = targetFileReferences[dependencyTarget.name]!