Skip to content

Commit eb40aca

Browse files
Merge pull request #6 from SavchenkoValeriy/feat/support-for-other-swift-versions
Require Swift 5.6 only for DoCC
2 parents 7523810 + d4f925c commit eb40aca

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

Package.swift

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
// swift-tools-version:5.6
1+
// swift-tools-version:5.2
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: "EmacsSwiftModule",
8-
platforms: [.macOS(.v11)],
8+
platforms: [.macOS(.v10_15)],
99
products: [
10-
// Products define the executables and libraries a package produces, and make them visible to other packages.
1110
.library(
1211
name: "EmacsSwiftModule",
1312
targets: ["EmacsSwiftModule"]),
@@ -16,14 +15,8 @@ let package = Package(
1615
type: .dynamic,
1716
targets: ["TestModule"]),
1817
],
19-
dependencies: [
20-
// Dependencies declare other packages that this package depends on.
21-
// .package(url: /* package url */, from: "1.0.0"),
22-
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0")
23-
],
18+
dependencies: [],
2419
targets: [
25-
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
26-
// Targets can depend on other targets in this package, and on products in packages this package depends on.
2720
.target(
2821
name: "EmacsSwiftModule",
2922
dependencies: ["EmacsModule"],
@@ -42,3 +35,9 @@ let package = Package(
4235
),
4336
]
4437
)
38+
39+
#if swift(>=5.6)
40+
package.dependencies.append(
41+
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0")
42+
)
43+
#endif

Source/Swift/Channel.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,11 @@ public class Channel {
140140

141141
if let data = "\(index)\n".data(using: String.Encoding.utf8) {
142142
do {
143-
try pipe?.write(contentsOf: data)
143+
if #available(macOS 10.15.4, *) {
144+
try pipe?.write(contentsOf: data)
145+
} else {
146+
pipe?.write(data)
147+
}
144148
} catch {
145149
fatalError("Error writing to a pipe")
146150
}

0 commit comments

Comments
 (0)