upgrade to Swift 4

This commit is contained in:
Yonas Kolb 2017-09-14 00:48:57 +02:00
parent 217b5422ad
commit 05e7928c7c
8 changed files with 126 additions and 77 deletions

View File

@ -1,7 +1,7 @@
os:
- osx
language: swift
osx_image: xcode8.3
osx_image: xcode9
script:
- swift build
- swift test

View File

@ -212,6 +212,7 @@
P81399456601 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0830;
};
buildConfigurationList = XCCL81399401 /* Build configuration list for PBXProject */;
compatibilityVersion = "Xcode 3.2";

View File

@ -1,60 +0,0 @@
{
"autoPin": true,
"pins": [
{
"package": "AEXML",
"reason": null,
"repositoryURL": "https://github.com/tadija/AEXML.git",
"version": "4.1.0"
},
{
"package": "Commander",
"reason": null,
"repositoryURL": "https://github.com/kylef/Commander.git",
"version": "0.6.1"
},
{
"package": "JSONUtilities",
"reason": null,
"repositoryURL": "https://github.com/yonaskolb/JSONUtilities.git",
"version": "3.3.8"
},
{
"package": "PathKit",
"reason": null,
"repositoryURL": "https://github.com/kylef/PathKit.git",
"version": "0.8.0"
},
{
"package": "Rainbow",
"reason": null,
"repositoryURL": "https://github.com/onevcat/Rainbow",
"version": "2.1.0"
},
{
"package": "Spectre",
"reason": null,
"repositoryURL": "https://github.com/kylef/Spectre.git",
"version": "0.7.2"
},
{
"package": "Unbox",
"reason": null,
"repositoryURL": "https://github.com/JohnSundell/Unbox",
"version": "2.5.0"
},
{
"package": "Yams",
"reason": null,
"repositoryURL": "https://github.com/jpsim/Yams.git",
"version": "0.3.5"
},
{
"package": "xcodeproj",
"reason": null,
"repositoryURL": "https://github.com/swift-xcode/xcodeproj.git",
"version": "0.1.1"
}
],
"version": 1
}

88
Package.resolved Normal file
View File

@ -0,0 +1,88 @@
{
"object": {
"pins": [
{
"package": "AEXML",
"repositoryURL": "https://github.com/tadija/AEXML.git",
"state": {
"branch": null,
"revision": "2981eccd86a69ea12a7f71a4c6b4d5177c2972a9",
"version": "4.1.0"
}
},
{
"package": "Commander",
"repositoryURL": "https://github.com/kylef/Commander",
"state": {
"branch": null,
"revision": "4c320a3507d621d27f89514eb576664becfee643",
"version": "0.6.1"
}
},
{
"package": "JSONUtilities",
"repositoryURL": "https://github.com/yonaskolb/JSONUtilities",
"state": {
"branch": null,
"revision": "6403a5455f30add5413095d1b5a70e8a5eb83ba0",
"version": "3.3.8"
}
},
{
"package": "PathKit",
"repositoryURL": "https://github.com/kylef/PathKit.git",
"state": {
"branch": null,
"revision": "891a3fec2699fc43aed18b7649950677c0152a22",
"version": "0.8.0"
}
},
{
"package": "Rainbow",
"repositoryURL": "https://github.com/onevcat/Rainbow.git",
"state": {
"branch": null,
"revision": "df197437d8acefb2ae01ab073be1d531fe7781ef",
"version": "2.1.0"
}
},
{
"package": "Spectre",
"repositoryURL": "https://github.com/kylef/Spectre.git",
"state": {
"branch": null,
"revision": "e46b75cf03ad5e563b4b0a5068d3d6f04d77d80b",
"version": "0.7.2"
}
},
{
"package": "Unbox",
"repositoryURL": "https://github.com/JohnSundell/Unbox",
"state": {
"branch": null,
"revision": "17ad6aa1cc2f1efa27a0bbbdb66f79796708aa95",
"version": "2.5.0"
}
},
{
"package": "Yams",
"repositoryURL": "https://github.com/jpsim/Yams",
"state": {
"branch": null,
"revision": "5ac9248b378b5e12201c255ba74caf990d1e0f4b",
"version": "0.3.6"
}
},
{
"package": "xcodeproj",
"repositoryURL": "https://github.com/swift-xcode/xcodeproj.git",
"state": {
"branch": null,
"revision": "a0d05f36203a50daa1a8e736f82bfa3124e98c40",
"version": "0.1.1"
}
}
]
},
"version": 1
}

View File

@ -1,21 +1,41 @@
// swift-tools-version:3.1
// swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "XcodeGen",
targets: [
Target(name: "XcodeGen", dependencies: ["XcodeGenKit"]),
Target(name: "XcodeGenKit", dependencies: ["ProjectSpec"]),
Target(name: "ProjectSpec"),
products: [
.executable(name: "XcodeGen", targets: ["XcodeGen"]),
.library(name: "XcodeGenKit", targets: ["XcodeGenKit"]),
],
dependencies: [
.Package(url: "https://github.com/kylef/PathKit.git", majorVersion: 0, minor: 8),
.Package(url: "https://github.com/kylef/Commander.git", majorVersion: 0, minor: 6),
.Package(url: "https://github.com/jpsim/Yams.git", majorVersion: 0, minor: 3),
.Package(url: "https://github.com/yonaskolb/JSONUtilities.git", majorVersion: 3, minor: 3),
.Package(url: "https://github.com/kylef/Spectre.git", majorVersion: 0, minor: 7),
.Package(url: "https://github.com/onevcat/Rainbow", majorVersion: 2),
.Package(url: "https://github.com/swift-xcode/xcodeproj.git", majorVersion: 0, minor: 1),
.package(url: "https://github.com/kylef/PathKit.git", from: "0.8.0"),
.package(url: "https://github.com/kylef/Commander.git", from: "0.6.1"),
.package(url: "https://github.com/jpsim/Yams.git", from: "0.3.6"),
.package(url: "https://github.com/yonaskolb/JSONUtilities.git", from: "3.3.0"),
.package(url: "https://github.com/kylef/Spectre.git", from: "0.7.0"),
.package(url: "https://github.com/onevcat/Rainbow.git", from: "2.1.0"),
.package(url: "https://github.com/swift-xcode/xcodeproj.git", .exact("0.1.1")),
],
targets: [
.target(name: "XcodeGen", dependencies: [
"XcodeGenKit",
"Commander",
"Rainbow",
]),
.target(name: "XcodeGenKit", dependencies: [
"ProjectSpec",
"JSONUtilities",
"xcodeproj",
"PathKit",
]),
.target(name: "ProjectSpec", dependencies: [
"JSONUtilities",
"xcodeproj",
"Yams",
]),
.testTarget(name: "XcodeGenKitTests", dependencies: [
"XcodeGenKit",
])
]
)

View File

@ -13,7 +13,7 @@ import Yams
extension Dictionary where Key: JSONKey {
public func json<T: NamedJSONDictionaryConvertible>(atKeyPath keyPath: KeyPath, invalidItemBehaviour: InvalidItemBehaviour<T> = .remove) throws -> [T] {
public func json<T: NamedJSONDictionaryConvertible>(atKeyPath keyPath: JSONUtilities.KeyPath, invalidItemBehaviour: InvalidItemBehaviour<T> = .remove) throws -> [T] {
guard let dictionary = json(atKeyPath: keyPath) as JSONDictionary? else {
return []
}
@ -26,7 +26,7 @@ extension Dictionary where Key: JSONKey {
return items
}
public func json<T: NamedJSONConvertible>(atKeyPath keyPath: KeyPath, invalidItemBehaviour: InvalidItemBehaviour<T> = .remove) throws -> [T] {
public func json<T: NamedJSONConvertible>(atKeyPath keyPath: JSONUtilities.KeyPath, invalidItemBehaviour: InvalidItemBehaviour<T> = .remove) throws -> [T] {
guard let dictionary = json(atKeyPath: keyPath) as JSONDictionary? else {
return []
}

View File

@ -29,7 +29,7 @@ public struct Settings: Equatable, JSONObjectConvertible, CustomStringConvertibl
groups = []
}
static let empty: Settings = Settings(dictionary: [:])
public static let empty: Settings = Settings(dictionary: [:])
public init(jsonDictionary: JSONDictionary) throws {
if jsonDictionary["configs"] != nil || jsonDictionary["groups"] != nil || jsonDictionary["base"] != nil {

View File

@ -23,7 +23,7 @@ func generate(spec: String, project: String) {
do {
spec = try SpecLoader.loadSpec(path: specPath)
print("Loaded spec: \(spec.targets.count) targets, \(spec.schemes.count) schemes, \(spec.configs.count) configs")
} catch let error as DecodingError {
} catch let error as JSONUtilities.DecodingError {
print("Parsing spec failed: \(error.description)")
return
} catch {