run swift format for Swift 5.1

This commit is contained in:
yonaskolb
2019-11-10 11:56:23 +11:00
parent 7ce43f2657
commit 0e4e08bfc4
45 changed files with 135 additions and 137 deletions
@@ -14,13 +14,13 @@ public class CarthageDependencyResolver {
/// Carthage's base build path as specified by the
/// project's `SpecOptions`, or `Carthage/Build` by default
var buildPath: String {
return project.options.carthageBuildPath ?? "Carthage/Build"
project.options.carthageBuildPath ?? "Carthage/Build"
}
/// Carthage's executable path as specified by the
/// project's `SpecOptions`, or `carthage` by default
var executable: String {
return project.options.carthageExecutablePath ?? "carthage"
project.options.carthageExecutablePath ?? "carthage"
}
private let project: Project
@@ -52,12 +52,12 @@ struct CarthageVersionFile: Decodable {
extension Platform: CodingKey {
public var stringValue: String {
return carthageName
carthageName
}
}
extension CarthageVersionFile {
func frameworks(for platform: Platform) -> [String] {
return data[platform] ?? []
data[platform] ?? []
}
}
+6 -6
View File
@@ -615,7 +615,7 @@ public class PBXProjGenerator {
let fileReference = self.sourceGenerator.getFileReference(path: frameworkPath, inPath: platformPath)
self.carthageFrameworksByPlatform[target.platform.carthageName, default: []].insert(fileReference)
if dependency.link ?? (target.type != .staticLibrary) {
let buildFile = self.addObject(
PBXBuildFile(file: fileReference, settings: getDependencyFrameworkSettings(dependency: dependency))
@@ -651,7 +651,7 @@ public class PBXProjGenerator {
}
for dependency in carthageDependencies {
let embed = dependency.embed ?? target.shouldEmbedCarthageDependencies
var platformPath = Path(carthageResolver.buildPath(for: target.platform, linkType: dependency.carthageLinkType ?? .default))
@@ -681,7 +681,7 @@ public class PBXProjGenerator {
var buildPhases: [PBXBuildPhase] = []
func getBuildFilesForSourceFiles(_ sourceFiles: [SourceFile]) -> [PBXBuildFile] {
return sourceFiles
sourceFiles
.reduce(into: [SourceFile]()) { output, sourceFile in
if !output.contains(where: { $0.fileReference === sourceFile.fileReference }) {
output.append(sourceFile)
@@ -993,7 +993,7 @@ public class PBXProjGenerator {
}
func getInfoPlist(_ sources: [TargetSource]) -> Path? {
return sources
sources
.lazy
.map { self.project.basePath + $0.path }
.compactMap { (path) -> Path? in
@@ -1060,11 +1060,11 @@ public class PBXProjGenerator {
extension Target {
var shouldEmbedDependencies: Bool {
return type.isApp || type.isTest
type.isApp || type.isTest
}
var shouldEmbedCarthageDependencies: Bool {
return (type.isApp && platform != .watchOS)
(type.isApp && platform != .watchOS)
|| type == .watch2Extension
|| type.isTest
}
+2 -2
View File
@@ -16,11 +16,11 @@ public class SchemeGenerator {
let pbxProj: PBXProj
var defaultDebugConfig: Config {
return project.configs.first { $0.type == .debug }!
project.configs.first { $0.type == .debug }!
}
var defaultReleaseConfig: Config {
return project.configs.first { $0.type == .release }!
project.configs.first { $0.type == .release }!
}
public init(project: Project, pbxProj: PBXProj) {
+1 -1
View File
@@ -115,7 +115,7 @@ extension Project {
}
public func targetHasBuildSetting(_ setting: String, target: Target, config: Config) -> Bool {
return getCombinedBuildSetting(setting, target: target, config: config) != nil
getCombinedBuildSetting(setting, target: target, config: config) != nil
}
/// Removes values from build settings if they are defined in an xcconfig file
+4 -4
View File
@@ -72,7 +72,7 @@ class SourceGenerator {
}
func getAllSourceFiles(targetType: PBXProductType, sources: [TargetSource]) throws -> [SourceFile] {
return try sources.flatMap { try getSourceFiles(targetType: targetType, targetSource: $0, path: project.basePath + $0.path) }
try sources.flatMap { try getSourceFiles(targetType: targetType, targetSource: $0, path: project.basePath + $0.path) }
}
// get groups without build files. Use for Project.fileGroups
@@ -354,7 +354,7 @@ class SourceGenerator {
/// Checks whether the path is not in any default or TargetSource excludes
func isIncludedPath(_ path: Path, excludePaths: Set<Path>, includePaths: Set<Path>) -> Bool {
return !defaultExcludedFiles.contains(where: { path.lastComponent.contains($0) })
!defaultExcludedFiles.contains(where: { path.lastComponent.contains($0) })
&& !(path.extension.map(defaultExcludedExtensions.contains) ?? false)
&& !excludePaths.contains(path)
// If includes is empty, it's included. If it's not empty, the path either needs to match exactly, or it needs to be a direct parent of an included path.
@@ -366,7 +366,7 @@ class SourceGenerator {
/// Gets all the children paths that aren't excluded
private func getSourceChildren(targetSource: TargetSource, dirPath: Path, excludePaths: Set<Path>, includePaths: Set<Path>) throws -> [Path] {
return try dirPath.children()
try dirPath.children()
.filter {
if $0.isDirectory {
let children = try $0.children()
@@ -432,7 +432,7 @@ class SourceGenerator {
// find the base localised directory
let baseLocalisedDirectory: Path? = {
func findLocalisedDirectory(by languageId: String) -> Path? {
return localisedDirectories.first { $0.lastComponent == "\(languageId).lproj" }
localisedDirectories.first { $0.lastComponent == "\(languageId).lproj" }
}
return findLocalisedDirectory(by: "Base") ??
findLocalisedDirectory(by: NSLocale.canonicalLanguageIdentifier(from: project.options.developmentLanguage ?? "en"))
+4 -4
View File
@@ -4,19 +4,19 @@ import ProjectSpec
extension Project {
var xcodeVersion: String {
return XCodeVersion.parse(options.xcodeVersion ?? "10.2")
XCodeVersion.parse(options.xcodeVersion ?? "10.2")
}
var schemeVersion: String {
return "1.3"
"1.3"
}
var compatibilityVersion: String {
return "Xcode 10.0"
"Xcode 10.0"
}
var objectVersion: UInt {
return 51
51
}
}
+2 -2
View File
@@ -5,7 +5,7 @@ import XcodeProj
extension PBXFileElement {
public var nameOrPath: String {
return name ?? path ?? ""
name ?? path ?? ""
}
}
@@ -39,7 +39,7 @@ extension PBXProj {
extension Dictionary {
public var valueArray: [Value] {
return Array(values)
Array(values)
}
}