diff --git a/Package.swift b/Package.swift index 75c1a845..d180b01b 100644 --- a/Package.swift +++ b/Package.swift @@ -20,35 +20,35 @@ let package = Package( ], targets: [ .target(name: "XcodeGen", dependencies: [ - "XcodeGenCLI", + "XcodeGenCLI", ]), .target(name: "XcodeGenCLI", dependencies: [ - "XcodeGenKit", - "ProjectSpec", - "SwiftCLI", - "Rainbow", - "PathKit", + "XcodeGenKit", + "ProjectSpec", + "SwiftCLI", + "Rainbow", + "PathKit", ]), .target(name: "XcodeGenKit", dependencies: [ - "ProjectSpec", - "JSONUtilities", - "xcodeproj", - "PathKit", + "ProjectSpec", + "JSONUtilities", + "xcodeproj", + "PathKit", ]), .target(name: "ProjectSpec", dependencies: [ - "JSONUtilities", - "xcodeproj", - "Yams", + "JSONUtilities", + "xcodeproj", + "Yams", ]), .testTarget(name: "XcodeGenKitTests", dependencies: [ - "XcodeGenKit", - "Spectre", - "PathKit", + "XcodeGenKit", + "Spectre", + "PathKit", ]), .testTarget(name: "PerformanceTests", dependencies: [ - "XcodeGenKit", - "Spectre", - "PathKit", - ]) + "XcodeGenKit", + "Spectre", + "PathKit", + ]), ] ) diff --git a/Sources/ProjectSpec/BuildScript.swift b/Sources/ProjectSpec/BuildScript.swift index 7042e18a..242a2813 100644 --- a/Sources/ProjectSpec/BuildScript.swift +++ b/Sources/ProjectSpec/BuildScript.swift @@ -49,7 +49,7 @@ extension BuildScript: JSONObjectConvertible { outputFiles = jsonDictionary.json(atKeyPath: "outputFiles") ?? [] inputFileLists = jsonDictionary.json(atKeyPath: "inputFileLists") ?? [] outputFileLists = jsonDictionary.json(atKeyPath: "outputFileLists") ?? [] - + if let string: String = jsonDictionary.json(atKeyPath: "script") { script = .script(string) } else { diff --git a/Sources/ProjectSpec/PathContainer.swift b/Sources/ProjectSpec/PathContainer.swift index a21e1e2e..127a6bc2 100644 --- a/Sources/ProjectSpec/PathContainer.swift +++ b/Sources/ProjectSpec/PathContainer.swift @@ -14,7 +14,7 @@ enum PathProperty { } extension Array where Element == PathProperty { - + func resolvingPaths(in jsonDictionary: JSONDictionary, relativeTo path: Path) -> JSONDictionary { var result = jsonDictionary diff --git a/Sources/ProjectSpec/SpecFile.swift b/Sources/ProjectSpec/SpecFile.swift index adae6092..110ff804 100644 --- a/Sources/ProjectSpec/SpecFile.swift +++ b/Sources/ProjectSpec/SpecFile.swift @@ -21,7 +21,7 @@ public struct SpecFile { } else if let dictionary = any as? JSONDictionary, let path = dictionary["path"] as? String { self.path = Path(path) - self.relativePaths = dictionary["relativePaths"] as? Bool ?? Include.defaultRelativePaths + relativePaths = dictionary["relativePaths"] as? Bool ?? Include.defaultRelativePaths } else { return nil } @@ -91,8 +91,7 @@ public struct SpecFile { return jsonDictionary.merged(onto: subSpecs .map { $0.mergedDictionary() } - .reduce([:]) { $1.merged(onto: $0) } - ) + .reduce([:]) { $1.merged(onto: $0) }) } func resolvingPaths(relativeTo basePath: Path = Path()) -> SpecFile { @@ -105,7 +104,7 @@ public struct SpecFile { return SpecFile( jsonDictionary: jsonDictionary, relativePath: self.relativePath, - subSpecs: self.subSpecs.map { $0.resolvingPaths(relativeTo: relativePath) } + subSpecs: subSpecs.map { $0.resolvingPaths(relativeTo: relativePath) } ) } } @@ -117,7 +116,7 @@ extension Dictionary where Key == String, Value: Any { for (key, value) in self { if key.hasSuffix(":REPLACE") { - let newKey = key[key.startIndex ..< key.index(key.endIndex, offsetBy: -8)] + let newKey = key[key.startIndex.., let base = merged[key] as? Dictionary { merged[key] = dictionary.merged(onto: base) as? Value diff --git a/Sources/XcodeGenKit/MD5.swift b/Sources/XcodeGenKit/MD5.swift index 0977e4ad..b52f772a 100644 --- a/Sources/XcodeGenKit/MD5.swift +++ b/Sources/XcodeGenKit/MD5.swift @@ -48,18 +48,18 @@ func arrayOfBytes(_ value: T, length: Int? = nil) -> [UInt8] { let bytes = valuePointer.withMemoryRebound(to: UInt8.self, capacity: totalBytes) { (bytesPointer) -> [UInt8] in var bytes = [UInt8](repeating: 0, count: totalBytes) - for j in 0 ..< min(MemoryLayout.size, totalBytes) { + for j in 0...size, totalBytes) { bytes[totalBytes - 1 - j] = (bytesPointer + j).pointee } return bytes } #if swift(>=4.1) - valuePointer.deinitialize(count: 1) - valuePointer.deallocate() + valuePointer.deinitialize(count: 1) + valuePointer.deallocate() #else - valuePointer.deinitialize() - valuePointer.deallocate(capacity: 1) + valuePointer.deinitialize() + valuePointer.deallocate(capacity: 1) #endif return bytes @@ -136,7 +136,7 @@ struct BytesIterator: IteratorProtocol { mutating func next() -> ArraySlice? { let end = min(chunkSize, data.count - offset) - let result = data[offset ..< offset + end] + let result = data[offset.. 0 ? result : nil } @@ -222,24 +222,24 @@ class MD5: HashProtocol { var dTemp: UInt32 = 0 // Main loop - for j in 0 ..< sines.count { + for j in 0.. FirstDi let lenMin = min(len1, len2) - for i in 0 ..< lenMin { + for i in 0..