Skip to content

Commit b67c14e

Browse files
sportlabsMikepaulofaria
authored andcommitted
Update to swift3.1 (#19)
* Update to build on Swift 3.1 * Integrate build script steps in .travis.yml rather than having separate script * Remove noise from .travis.yml script * Removed unused travisBuild.sh * Re-add codecov script to .travis.yml * Consolidate code where NSRegularExpression is used, no need to differentiate between osx and linux * Remove SWIFT_VERSION env variable frmo .travis.yml and rely on .swift-version file * Revert .travis.yml changes except xcode8.1 -> xcode8.3 * So, don’t use https://raw.githubusercontent.com/lgaches/swifttravisci/master/travisci as it overrides SWIFT_VERSION to 3.0.1
1 parent 86ec849 commit b67c14e

File tree

5 files changed

+23
-26
lines changed

5 files changed

+23
-26
lines changed

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0
1+
3.1

.travis.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
notifications:
22
slack: zewo:VjyVCCQvTOw9yrbzQysZezD1
3-
os:
4-
- linux
5-
- osx
63
language: generic
7-
sudo: required
8-
dist: trusty
9-
osx_image: xcode8.1
4+
matrix:
5+
include:
6+
- os: osx
7+
env: JOB=SwiftPM_OSX
8+
osx_image: xcode8.3
9+
- os: linux
10+
env: JOB=SwiftPM_linux
11+
dist: trusty
12+
sudo: required
13+
install:
14+
- travis_retry eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
1015
script:
11-
- eval "$(curl -sL https://raw.githubusercontent.com/lgaches/swifttravisci/master/travisci)"
12-
- eval "$(curl -sL https://raw.githubusercontent.com/lgaches/swifttravisci/master/codecov)"
16+
- swift build -c release
17+
- swift build
18+
- swift test
19+
- eval "$(curl -sL https://raw.githubusercontent.com/lgaches/swifttravisci/master/codecov)"
20+

Sources/GraphQL/Error/SyntaxError.swift

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,9 @@ func highlightSourceAtLocation(source: Source, location: SourceLocation) -> Stri
4949
}
5050

5151
func splitLines(string: String) -> [String] {
52-
#if os(macOS)
53-
let nsstring = string as NSString
54-
let regex = try! NSRegularExpression(pattern: "\r\n|[\n\r]", options: [])
55-
#else
56-
let nsstring = NSString(string: string)
57-
let regex = try! RegularExpression(pattern: "\r\n|[\n\r]", options: [])
58-
#endif
52+
53+
let nsstring = NSString(string: string)
54+
let regex = try! NSRegularExpression(pattern: "\r\n|[\n\r]", options: [])
5955

6056
var lines: [String] = []
6157
var location = 0

Sources/GraphQL/Language/Location.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ func getLocation(source: Source, position: Int) -> SourceLocation {
1010
var line = 1
1111
var column = position + 1
1212

13-
#if os(macOS)
14-
let regex = try! NSRegularExpression(pattern: "\r\n|[\n\r]", options: [])
15-
#else
16-
let regex = try! RegularExpression(pattern: "\r\n|[\n\r]", options: [])
17-
#endif
13+
let regex = try! NSRegularExpression(pattern: "\r\n|[\n\r]", options: [])
1814

1915
let matches = regex.matches(in: source.body, options: [], range: NSRange(0..<source.body.utf16.count))
2016

Sources/GraphQL/Utilities/AssertValidName.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@ public enum InvalidNameError : Error, CustomStringConvertible {
1212
}
1313

1414
func assertValid(name: String) throws {
15-
#if os(macOS)
16-
let regex = try NSRegularExpression(pattern: "^[_a-zA-Z][_a-zA-Z0-9]*$", options: [])
17-
#else
18-
let regex = try RegularExpression(pattern: "^[_a-zA-Z][_a-zA-Z0-9]*$", options: [])
19-
#endif
15+
16+
let regex = try NSRegularExpression(pattern: "^[_a-zA-Z][_a-zA-Z0-9]*$", options: [])
2017

2118
let range = regex.rangeOfFirstMatch(in: name, options: [], range: NSRange(0..<name.utf16.count))
2219

0 commit comments

Comments
 (0)