Skip to content

Commit b5e9f01

Browse files
authored
Swift 5 (#7)
* Swift 5 * Remove #ifs * Fixes * Scope XcodeGen requirement to development * Update .swift-version
1 parent 9507a7a commit b5e9f01

File tree

12 files changed

+39
-115
lines changed

12 files changed

+39
-115
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2
33
jobs:
44
build:
55
macos:
6-
xcode: "10.1.0"
6+
xcode: "10.2.0"
77

88
steps:
99
- checkout

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.2.1
1+
5.0

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM swift:4.2
1+
FROM norionomura/swift:swift-5.0-branch
22

33
WORKDIR /package
44

Gen.xcodeproj/project.pbxproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@
524524
PRODUCT_NAME = Gen;
525525
SDKROOT = macosx;
526526
SKIP_INSTALL = YES;
527+
SWIFT_VERSION = 5.0;
527528
VERSIONING_SYSTEM = "apple-generic";
528529
};
529530
name = Release;
@@ -543,6 +544,7 @@
543544
PRODUCT_NAME = Gen;
544545
SDKROOT = iphoneos;
545546
SKIP_INSTALL = YES;
547+
SWIFT_VERSION = 5.0;
546548
TARGETED_DEVICE_FAMILY = "1,2";
547549
VERSIONING_SYSTEM = "apple-generic";
548550
};
@@ -617,6 +619,7 @@
617619
PRODUCT_NAME = Gen;
618620
SDKROOT = appletvos;
619621
SKIP_INSTALL = YES;
622+
SWIFT_VERSION = 5.0;
620623
TARGETED_DEVICE_FAMILY = 3;
621624
VERSIONING_SYSTEM = "apple-generic";
622625
};
@@ -631,6 +634,7 @@
631634
PRODUCT_NAME = GenTests;
632635
SDKROOT = watchos;
633636
SKIP_INSTALL = YES;
637+
SWIFT_VERSION = 5.0;
634638
TARGETED_DEVICE_FAMILY = 4;
635639
};
636640
name = Debug;
@@ -644,6 +648,7 @@
644648
PRODUCT_NAME = GenTests;
645649
SDKROOT = watchos;
646650
SKIP_INSTALL = YES;
651+
SWIFT_VERSION = 5.0;
647652
TARGETED_DEVICE_FAMILY = 4;
648653
};
649654
name = Release;
@@ -663,6 +668,7 @@
663668
PRODUCT_NAME = Gen;
664669
SDKROOT = iphoneos;
665670
SKIP_INSTALL = YES;
671+
SWIFT_VERSION = 5.0;
666672
TARGETED_DEVICE_FAMILY = "1,2";
667673
VERSIONING_SYSTEM = "apple-generic";
668674
};
@@ -676,6 +682,7 @@
676682
PRODUCT_BUNDLE_IDENTIFIER = "co.pointfree.GenTests-tvOS";
677683
PRODUCT_NAME = GenTests;
678684
SDKROOT = appletvos;
685+
SWIFT_VERSION = 5.0;
679686
TARGETED_DEVICE_FAMILY = 3;
680687
};
681688
name = Debug;
@@ -688,6 +695,7 @@
688695
PRODUCT_BUNDLE_IDENTIFIER = "co.pointfree.GenTests-iOS";
689696
PRODUCT_NAME = GenTests;
690697
SDKROOT = iphoneos;
698+
SWIFT_VERSION = 5.0;
691699
TARGETED_DEVICE_FAMILY = "1,2";
692700
};
693701
name = Release;
@@ -768,6 +776,7 @@
768776
PRODUCT_NAME = Gen;
769777
SDKROOT = watchos;
770778
SKIP_INSTALL = YES;
779+
SWIFT_VERSION = 5.0;
771780
TARGETED_DEVICE_FAMILY = 4;
772781
VERSIONING_SYSTEM = "apple-generic";
773782
};
@@ -789,6 +798,7 @@
789798
PRODUCT_NAME = Gen;
790799
SDKROOT = macosx;
791800
SKIP_INSTALL = YES;
801+
SWIFT_VERSION = 5.0;
792802
VERSIONING_SYSTEM = "apple-generic";
793803
};
794804
name = Debug;
@@ -801,6 +811,7 @@
801811
PRODUCT_BUNDLE_IDENTIFIER = "co.pointfree.GenTests-iOS";
802812
PRODUCT_NAME = GenTests;
803813
SDKROOT = iphoneos;
814+
SWIFT_VERSION = 5.0;
804815
TARGETED_DEVICE_FAMILY = "1,2";
805816
};
806817
name = Debug;
@@ -814,6 +825,7 @@
814825
PRODUCT_BUNDLE_IDENTIFIER = "co.pointfree.GenTests-macOS";
815826
PRODUCT_NAME = GenTests;
816827
SDKROOT = macosx;
828+
SWIFT_VERSION = 5.0;
817829
};
818830
name = Release;
819831
};
@@ -826,6 +838,7 @@
826838
PRODUCT_BUNDLE_IDENTIFIER = "co.pointfree.GenTests-macOS";
827839
PRODUCT_NAME = GenTests;
828840
SDKROOT = macosx;
841+
SWIFT_VERSION = 5.0;
829842
};
830843
name = Debug;
831844
};
@@ -844,6 +857,7 @@
844857
PRODUCT_NAME = Gen;
845858
SDKROOT = appletvos;
846859
SKIP_INSTALL = YES;
860+
SWIFT_VERSION = 5.0;
847861
TARGETED_DEVICE_FAMILY = 3;
848862
VERSIONING_SYSTEM = "apple-generic";
849863
};
@@ -857,6 +871,7 @@
857871
PRODUCT_BUNDLE_IDENTIFIER = "co.pointfree.GenTests-tvOS";
858872
PRODUCT_NAME = GenTests;
859873
SDKROOT = appletvos;
874+
SWIFT_VERSION = 5.0;
860875
TARGETED_DEVICE_FAMILY = 3;
861876
};
862877
name = Release;
@@ -875,6 +890,7 @@
875890
PRODUCT_NAME = Gen;
876891
SDKROOT = watchos;
877892
SKIP_INSTALL = YES;
893+
SWIFT_VERSION = 5.0;
878894
TARGETED_DEVICE_FAMILY = 4;
879895
VERSIONING_SYSTEM = "apple-generic";
880896
};

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ imports = \
22
@testable import GenTests;
33

44
xcodeproj:
5-
swift run xcodegen
5+
PF_DEVELOP=1 swift run xcodegen
66

77
linux-main:
88
swift test --generate-linuxmain
@@ -23,7 +23,7 @@ test-ios:
2323
set -o pipefail && \
2424
xcodebuild test \
2525
-scheme Gen_iOS \
26-
-destination platform="iOS Simulator,name=iPhone XR,OS=12.1" \
26+
-destination platform="iOS Simulator,name=iPhone XR,OS=12.2" \
2727
| xcpretty
2828

2929
test-swift:

Package.resolved

Lines changed: 0 additions & 97 deletions
This file was deleted.

Package.swift

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
1-
// swift-tools-version:4.2
2-
1+
// swift-tools-version:5.0
2+
import Foundation
33
import PackageDescription
44

55
let package = Package(
66
name: "Gen",
77
products: [
88
.library(name: "Gen", targets: ["Gen"])
99
],
10-
dependencies: [
11-
.package(url: "https://github.com/yonaskolb/XcodeGen.git", from: "2.2.0"),
12-
],
1310
targets: [
1411
.target(name: "Gen", dependencies: []),
1512
.testTarget(name: "GenTests", dependencies: ["Gen"]),
1613
]
1714
)
15+
16+
if ProcessInfo.processInfo.environment.keys.contains("PF_DEVELOP") {
17+
package.dependencies.append(
18+
contentsOf: [
19+
.package(url: "https://github.com/yonaskolb/XcodeGen.git", from: "2.3.0"),
20+
]
21+
)
22+
}

PointFree-Gen.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Pod::Spec.new do |s|
3333
:tag => s.version
3434
}
3535

36-
s.swift_version = "4.2"
36+
s.swift_version = "5.0"
3737

3838
s.ios.deployment_target = "8.0"
3939
s.osx.deployment_target = "10.9"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 🎱 Gen
22

3-
[![Swift 4.2](https://img.shields.io/badge/swift-4.2-ED523F.svg?style=flat)](https://swift.org/download/)
3+
[![Swift 5](https://img.shields.io/badge/swift-5-ED523F.svg?style=flat)](https://swift.org/download/)
44
[![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)
55
[![Linux CI](https://img.shields.io/travis/pointfreeco/swift-gen/master.svg?label=linux)](https://travis-ci.org/pointfreeco/swift-gen)
66
[![@pointfreeco](https://img.shields.io/badge/contact-@pointfreeco-5AA9E7.svg?style=flat)](https://twitter.com/pointfreeco)

Sources/Gen/Gen.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,6 @@ extension Gen {
437437
)
438438
}
439439

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

454452
extension Gen where Value: Hashable {

Tests/GenTests/GenTests.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,10 @@ final class GenTests: XCTestCase {
5757
}
5858

5959
func testResult() {
60-
#if swift(>=5.0)
6160
struct Failure: Error, Equatable {}
6261
let gen = Gen.bool.asResult(withFailure: .always(Failure())).array(of: .always(10))
6362
lcrng.seed = 777
6463
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))
65-
#endif
6664
}
6765

6866
func testElementOf() {

project.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@ targets:
1313
Gen:
1414
platform: [macOS, iOS, tvOS, watchOS]
1515
scheme:
16-
testTargets: [GenTests_$platform]
16+
testTargets: ['GenTests_${platform}']
17+
settings:
18+
SWIFT_VERSION: 5.0
1719
sources: [Sources]
1820
type: framework
1921
GenTests:
20-
dependencies: [{target: Gen_$platform}]
22+
dependencies: [{target: 'Gen_${platform}'}]
2123
platform: [macOS, iOS, tvOS, watchOS]
24+
settings:
25+
SWIFT_VERSION: 5.0
2226
sources:
2327
- path: Tests
2428
excludes:

0 commit comments

Comments
 (0)