diff --git a/.github/deploy b/.github/deploy index 63010b2..05c30d5 100755 --- a/.github/deploy +++ b/.github/deploy @@ -114,8 +114,10 @@ var defaultSwiftVersion: String { func podspec(repo: Repo, user: User, pkg: Package) -> (Substring, String) { let (owner, name) = { ($0[0], $0[1]) }(slug.split(separator: "/")) - let swiftVersion = pkg.swiftLanguageVersions.max() ?? defaultSwiftVersion - let sources = pkg.targets.filter{ $0.type == .regular }.compactMap{ $0.path }.first! + let swiftVersion = pkg.swiftLanguageVersions.min() ?? defaultSwiftVersion + let targets = pkg.targets.filter{ $0.type == .regular } + guard targets.count == 1 else { fatal(message: "Too many targets for this script!") } + guard let sources = targets[0].path else { fatal(message: "Target has no path!") } return (name, """ Pod::Spec.new do |s| s.name = '\(name)' diff --git a/Package.swift b/Package.swift index 61a9867..4c2a937 100644 --- a/Package.swift +++ b/Package.swift @@ -1,7 +1,7 @@ // swift-tools-version:4.2 import PackageDescription -let package = Package( +let pkg = Package( name: "Path.swift", products: [ .library(name: "Path", targets: ["Path"]), @@ -11,3 +11,9 @@ let package = Package( .testTarget(name: "PathTests", dependencies: ["Path"]), ] ) + +pkg.swiftLanguageVersions = [.v4_2] + +#if swift(>=5) +pkg.swiftLanguageVersions.append(.v5) +#endif diff --git a/Package@swift-5.0.swift b/Package@swift-5.0.swift deleted file mode 100644 index c404245..0000000 --- a/Package@swift-5.0.swift +++ /dev/null @@ -1,17 +0,0 @@ -// swift-tools-version:5.0 -import PackageDescription - -let pkg = Package( - name: "Path.swift", - products: [ - .library(name: "Path", targets: ["Path"]), - ], - targets: [ - .target(name: "Path", path: "Sources"), - .testTarget(name: "PathTests", dependencies: ["Path"]), - ] -) - -pkg.swiftLanguageVersions = [ - .v4_2, .v5 -] diff --git a/Package@swift-5.0.swift b/Package@swift-5.0.swift new file mode 120000 index 0000000..c73cf0c --- /dev/null +++ b/Package@swift-5.0.swift @@ -0,0 +1 @@ +Package.swift \ No newline at end of file