Skip to content

Commit

Permalink
Swift 5 (#7)
Browse files Browse the repository at this point in the history
* Swift 5

* Remove #ifs

* Fixes

* Scope XcodeGen requirement to development

* Update .swift-version
  • Loading branch information
stephencelis authored Mar 26, 2019
1 parent 9507a7a commit b5e9f01
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 115 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
jobs:
build:
macos:
xcode: "10.1.0"
xcode: "10.2.0"

steps:
- checkout
Expand Down
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2.1
5.0
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM swift:4.2
FROM norionomura/swift:swift-5.0-branch

WORKDIR /package

Expand Down
16 changes: 16 additions & 0 deletions Gen.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@
PRODUCT_NAME = Gen;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
Expand All @@ -543,6 +544,7 @@
PRODUCT_NAME = Gen;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
};
Expand Down Expand Up @@ -617,6 +619,7 @@
PRODUCT_NAME = Gen;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
VERSIONING_SYSTEM = "apple-generic";
};
Expand All @@ -631,6 +634,7 @@
PRODUCT_NAME = GenTests;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 4;
};
name = Debug;
Expand All @@ -644,6 +648,7 @@
PRODUCT_NAME = GenTests;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 4;
};
name = Release;
Expand All @@ -663,6 +668,7 @@
PRODUCT_NAME = Gen;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
};
Expand All @@ -676,6 +682,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "co.pointfree.GenTests-tvOS";
PRODUCT_NAME = GenTests;
SDKROOT = appletvos;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
};
name = Debug;
Expand All @@ -688,6 +695,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "co.pointfree.GenTests-iOS";
PRODUCT_NAME = GenTests;
SDKROOT = iphoneos;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down Expand Up @@ -768,6 +776,7 @@
PRODUCT_NAME = Gen;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 4;
VERSIONING_SYSTEM = "apple-generic";
};
Expand All @@ -789,6 +798,7 @@
PRODUCT_NAME = Gen;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
Expand All @@ -801,6 +811,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "co.pointfree.GenTests-iOS";
PRODUCT_NAME = GenTests;
SDKROOT = iphoneos;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -814,6 +825,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "co.pointfree.GenTests-macOS";
PRODUCT_NAME = GenTests;
SDKROOT = macosx;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -826,6 +838,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "co.pointfree.GenTests-macOS";
PRODUCT_NAME = GenTests;
SDKROOT = macosx;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -844,6 +857,7 @@
PRODUCT_NAME = Gen;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
VERSIONING_SYSTEM = "apple-generic";
};
Expand All @@ -857,6 +871,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "co.pointfree.GenTests-tvOS";
PRODUCT_NAME = GenTests;
SDKROOT = appletvos;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
};
name = Release;
Expand All @@ -875,6 +890,7 @@
PRODUCT_NAME = Gen;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 4;
VERSIONING_SYSTEM = "apple-generic";
};
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ imports = \
@testable import GenTests;

xcodeproj:
swift run xcodegen
PF_DEVELOP=1 swift run xcodegen

linux-main:
swift test --generate-linuxmain
Expand All @@ -23,7 +23,7 @@ test-ios:
set -o pipefail && \
xcodebuild test \
-scheme Gen_iOS \
-destination platform="iOS Simulator,name=iPhone XR,OS=12.1" \
-destination platform="iOS Simulator,name=iPhone XR,OS=12.2" \
| xcpretty

test-swift:
Expand Down
97 changes: 0 additions & 97 deletions Package.resolved

This file was deleted.

15 changes: 10 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
// swift-tools-version:4.2

// swift-tools-version:5.0
import Foundation
import PackageDescription

let package = Package(
name: "Gen",
products: [
.library(name: "Gen", targets: ["Gen"])
],
dependencies: [
.package(url: "https://github.com/yonaskolb/XcodeGen.git", from: "2.2.0"),
],
targets: [
.target(name: "Gen", dependencies: []),
.testTarget(name: "GenTests", dependencies: ["Gen"]),
]
)

if ProcessInfo.processInfo.environment.keys.contains("PF_DEVELOP") {
package.dependencies.append(
contentsOf: [
.package(url: "https://github.com/yonaskolb/XcodeGen.git", from: "2.3.0"),
]
)
}
2 changes: 1 addition & 1 deletion PointFree-Gen.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Pod::Spec.new do |s|
:tag => s.version
}

s.swift_version = "4.2"
s.swift_version = "5.0"

s.ios.deployment_target = "8.0"
s.osx.deployment_target = "10.9"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 🎱 Gen

[![Swift 4.2](https://img.shields.io/badge/swift-4.2-ED523F.svg?style=flat)](https://swift.org/download/)
[![Swift 5](https://img.shields.io/badge/swift-5-ED523F.svg?style=flat)](https://swift.org/download/)
[![iOS/macOS/tvOS/watchOS CI](https://img.shields.io/circleci/project/github/pointfreeco/swift-gen/master.svg?label=ios/macos)](https://circleci.com/gh/pointfreeco/swift-gen)
[![Linux CI](https://img.shields.io/travis/pointfreeco/swift-gen/master.svg?label=linux)](https://travis-ci.org/pointfreeco/swift-gen)
[![@pointfreeco](https://img.shields.io/badge/contact-@pointfreeco-5AA9E7.svg?style=flat)](https://twitter.com/pointfreeco)
Expand Down
2 changes: 0 additions & 2 deletions Sources/Gen/Gen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,6 @@ extension Gen {
)
}

#if swift(>=5)
/// Produces a new generator of failable values.
///
/// - Returns: A generator of failable values.
Expand All @@ -448,7 +447,6 @@ extension Gen {
(3, self.map(Result.success)) // TODO: Change to use `size` with resizable generators?
)
}
#endif
}

extension Gen where Value: Hashable {
Expand Down
2 changes: 0 additions & 2 deletions Tests/GenTests/GenTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,10 @@ final class GenTests: XCTestCase {
}

func testResult() {
#if swift(>=5.0)
struct Failure: Error, Equatable {}
let gen = Gen.bool.asResult(withFailure: .always(Failure())).array(of: .always(10))
lcrng.seed = 777
XCTAssertEqual([.success(true), .failure(.init()), .success(true), .success(true), .success(true), .success(true), .success(false), .success(false), .success(true), .success(false)], gen.run(using: &lcrng))
#endif
}

func testElementOf() {
Expand Down
8 changes: 6 additions & 2 deletions project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ targets:
Gen:
platform: [macOS, iOS, tvOS, watchOS]
scheme:
testTargets: [GenTests_$platform]
testTargets: ['GenTests_${platform}']
settings:
SWIFT_VERSION: 5.0
sources: [Sources]
type: framework
GenTests:
dependencies: [{target: Gen_$platform}]
dependencies: [{target: 'Gen_${platform}'}]
platform: [macOS, iOS, tvOS, watchOS]
settings:
SWIFT_VERSION: 5.0
sources:
- path: Tests
excludes:
Expand Down

0 comments on commit b5e9f01

Please sign in to comment.