Skip to content

Commit 5b8c695

Browse files
authored
Merge pull request #10 from kevinvandenbreemen/forPullRequests
Updates for build issues with Swift 5.1
2 parents 7aeb867 + d549081 commit 5b8c695

File tree

7 files changed

+41
-259
lines changed

7 files changed

+41
-259
lines changed

Package.resolved

Lines changed: 3 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
// swift-tools-version:3.0.2
1+
// swift-tools-version:5.1
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
55

66
let package = Package(
77
name: "Silica",
8-
targets: [
9-
Target(name: "Silica")
8+
products: [
9+
.library(name: "Silica", targets: ["Silica"])
1010
],
1111
dependencies: [
12-
.Package(url: "https://github.com/PureSwift/Cairo.git", majorVersion: 1)
12+
.package(url: "https://github.com/PureSwift/Cairo.git", .branch("master"))
13+
],
14+
targets: [
15+
.target(name: "Silica", dependencies: ["Cairo"]),
16+
.testTarget(name: "SilicaTests", dependencies: ["Silica"])
1317
]
18+
1419
)

Sources/Silica/CGFont.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public struct CGFont: Equatable, Hashable {
4747
let face = FontFace(fontConfigPattern: fontConfigPattern)
4848

4949
let options = FontOptions()
50-
options.hintMetrics = CAIRO_HINT_METRICS_OFF
50+
options.hintMetrics = .off
5151
options.hintStyle = CAIRO_HINT_STYLE_NONE
5252

5353
self.name = name

Sources/Silica/CGImageSource.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import struct Foundation.Data
1313
public protocol CGImageSource: class, RandomAccessCollection {
1414

1515
associatedtype Index = Int
16-
associatedtype Indices = DefaultRandomAccessIndices<Self>
16+
associatedtype Indices = DefaultIndices<Self>
1717
associatedtype Iterator = IndexingIterator<Self>
1818

1919
static var typeIdentifier: String { get }
@@ -35,9 +35,9 @@ public extension CGImageSource {
3535
return image
3636
}
3737

38-
public subscript(bounds: Range<Self.Index>) -> RandomAccessSlice<Self> {
38+
public subscript(bounds: Range<Self.Index>) -> Slice<Self> {
3939

40-
return RandomAccessSlice<Self>(base: self, bounds: bounds)
40+
return Slice<Self>(base: self, bounds: bounds)
4141
}
4242

4343
/// The start `Index`.

Sources/Silica/CGRect.swift

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

Tests/SilicaTests/FontTests.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,18 @@ final class FontTests: XCTestCase {
1515

1616
func testCreateFont() {
1717

18+
#if os(Linux)
19+
var fontNames = [
20+
("LiberationSerif", "Liberation Serif"),
21+
("LiberationSerif-Bold", "Liberation Serif")
22+
]
23+
24+
#else
1825
var fontNames = [
1926
("TimesNewRoman", "Times New Roman"),
2027
("TimesNewRoman-Bold", "Times New Roman")
2128
]
29+
#endif
2230

2331
#if os(macOS)
2432
fontNames += [("MicrosoftSansSerif", "Microsoft Sans Serif"),

Tests/SilicaTests/Utilities/HTTP/HTTPClient.swift

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,21 @@
77
//
88

99
import Foundation
10+
11+
#if canImport(FoundationNetworking)
12+
import FoundationNetworking
13+
#endif
14+
1015
import Dispatch
1116

17+
#if canImport(FoundationNetworking)
18+
typealias FoundationURLRequest = FoundationNetworking.URLRequest
19+
typealias FoundationURLResponse = FoundationNetworking.URLResponse
20+
#else
21+
typealias FoundationURLRequest = Foundation.URLRequest
22+
typealias FoundationURLResponse = Foundation.URLResponse
23+
#endif
24+
1225
// Dot notation syntax for class
1326
public extension HTTP {
1427

@@ -45,7 +58,7 @@ public extension HTTP {
4558

4659
// build request...
4760

48-
guard let urlRequest = Foundation.URLRequest(request: request)
61+
guard let urlRequest = FoundationURLRequest(request: request)
4962
else { throw Error.BadRequest }
5063

5164
// execute request
@@ -58,11 +71,11 @@ public extension HTTP {
5871

5972
var urlResponse: HTTPURLResponse?
6073

61-
dataTask = self.session.dataTask(with: urlRequest) { (data: Foundation.Data?, response: Foundation.URLResponse?, responseError: Swift.Error?) -> () in
74+
dataTask = self.session.dataTask(with: urlRequest) { (data: Foundation.Data?, response: FoundationURLResponse?, responseError: Swift.Error?) -> () in
6275

6376
responseData = data
6477

65-
urlResponse = response as? Foundation.HTTPURLResponse
78+
urlResponse = response as? HTTPURLResponse
6679

6780
error = responseError
6881

@@ -105,7 +118,7 @@ public extension HTTP.Client {
105118
}
106119
}
107120

108-
public extension Foundation.URLRequest {
121+
public extension FoundationURLRequest {
109122

110123
init?(request: HTTP.Request) {
111124

0 commit comments

Comments
 (0)