Skip to content

Commit 53d8b3b

Browse files
authored
Require Swift 5.7 or later (#424)
1 parent 62b0262 commit 53d8b3b

File tree

13 files changed

+7
-170
lines changed

13 files changed

+7
-170
lines changed

.github/workflows/bazel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
Linux:
4242
strategy:
4343
matrix:
44-
tag: ['5.4', '5.5', '5.6', '5.7', '5.8', '5.9', '5.10']
44+
tag: ['5.7', '5.8', '5.9', '5.10']
4545
runs-on: ubuntu-latest
4646
container:
4747
image: swift:${{ matrix.tag }}-focal

.github/workflows/cmake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
name: macOS with Xcode ${{ matrix.xcode_version }}
3131
strategy:
3232
matrix:
33-
xcode_version: ['15.0', '15.1', '15.2', '15.3', '15.4']
33+
xcode_version: ['15.0', '15.4']
3434
runs-on: macos-14
3535
env:
3636
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app

.github/workflows/swiftpm.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,6 @@ concurrency:
2828
cancel-in-progress: true
2929

3030
jobs:
31-
Xcode_Monterey:
32-
name: macOS 12 with Xcode ${{ matrix.xcode_version }}
33-
strategy:
34-
matrix:
35-
xcode_version: ['13.3.1', '13.4', '14.0.1', '14.1', '14.2']
36-
runs-on: macos-12
37-
env:
38-
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app
39-
steps:
40-
- uses: actions/checkout@v4
41-
- run: swift -version
42-
- run: YAMS_DEFAULT_ENCODING=UTF16 swift test --parallel
43-
- run: YAMS_DEFAULT_ENCODING=UTF8 swift test --parallel
44-
4531
Xcode_Ventura:
4632
name: macOS 13 with Xcode ${{ matrix.xcode_version }}
4733
strategy:

.github/workflows/xcodebuild.yml

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -26,39 +26,6 @@ concurrency:
2626
cancel-in-progress: true
2727

2828
jobs:
29-
xcodebuild_Monterey:
30-
name: macOS 12 with Xcode ${{ matrix.xcode_version }}
31-
strategy:
32-
matrix:
33-
xcode_version: ['13.3.1', '13.4', '14.0.1', '14.2']
34-
xcode_flags: ['-scheme Yams -project Yams.xcodeproj']
35-
runs-on: macos-12
36-
env:
37-
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app
38-
steps:
39-
- uses: actions/checkout@v4
40-
- run: xcodebuild -version
41-
- name: macOS with UTF16
42-
if: always()
43-
run: set -o pipefail && YAMS_DEFAULT_ENCODING=UTF16 xcodebuild ${{ matrix.xcode_flags }} test | xcbeautify --renderer github-actions
44-
shell: bash
45-
- name: macOS with UTF8
46-
if: always()
47-
run: set -o pipefail && YAMS_DEFAULT_ENCODING=UTF8 xcodebuild ${{ matrix.xcode_flags }} test | xcbeautify --renderer github-actions
48-
shell: bash
49-
- name: iPhone Simulator
50-
if: always()
51-
run: set -o pipefail && xcodebuild ${{ matrix.xcode_flags }} test -sdk iphonesimulator -destination "name=iPhone 8" | xcbeautify --renderer github-actions
52-
shell: bash
53-
- name: Apple TV Simulator
54-
if: always()
55-
run: set -o pipefail && xcodebuild ${{ matrix.xcode_flags }} test -sdk appletvsimulator -destination "name=Apple TV 4K (2nd generation)" | xcbeautify --renderer github-actions
56-
shell: bash
57-
- name: watchOS Simulator
58-
if: always()
59-
run: set -o pipefail && xcodebuild ${{ matrix.xcode_flags }} build -sdk watchsimulator | xcbeautify --renderer github-actions
60-
shell: bash
61-
6229
xcodebuild_Ventura:
6330
name: macOS 13 with Xcode ${{ matrix.xcode_version }}
6431
strategy:

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
##### Breaking
44

5-
* None.
5+
* Swift 5.7 or later is now required to build Yams.
6+
[JP Simard](https://github.com/jpsim)
67

78
##### Enhancements
89

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.4
1+
// swift-tools-version:5.7
22
import PackageDescription
33

44
let package = Package(

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ A sweet and swifty [YAML](http://yaml.org/) parser built on
1313

1414
## Installation
1515

16-
Building Yams requires Xcode 12.5+ or a Swift 5.4+ toolchain with the
16+
Building Yams requires Xcode 14.0+ or a Swift 5.7+ toolchain with the
1717
Swift Package Manager or CMake and Ninja.
1818

1919
### CMake

Sources/Yams/Encoder.swift

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -226,30 +226,18 @@ extension _Encoder: SingleValueEncodingContainer {
226226
func encode<T>(_ value: T) throws where T: YAMLEncodable {
227227
assertCanEncodeNewValue()
228228
node = value.box()
229-
#if swift(>=5.7)
230229
if let stringValue = value as? (any StringProtocol), stringValue.contains("\n") {
231230
node.scalar?.style = newlineScalarStyle
232231
}
233-
#else
234-
if let stringValue = value as? String, stringValue.contains("\n") {
235-
node.scalar?.style = newlineScalarStyle
236-
}
237-
#endif
238232
}
239233

240234
func encode<T>(_ value: T) throws where T: Encodable {
241235
assertCanEncodeNewValue()
242236
if let encodable = value as? YAMLEncodable {
243237
node = encodable.box()
244-
#if swift(>=5.7)
245238
if let stringValue = value as? (any StringProtocol), stringValue.contains("\n") {
246239
node.scalar?.style = newlineScalarStyle
247240
}
248-
#else
249-
if let stringValue = value as? String, stringValue.contains("\n") {
250-
node.scalar?.style = newlineScalarStyle
251-
}
252-
#endif
253241
} else {
254242
try value.encode(to: self)
255243
}

Tests/YamsTests/ConstructorTests.swift

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -526,25 +526,6 @@ class ConstructorTests: XCTestCase { // swiftlint:disable:this type_body_length
526526

527527
extension ConstructorTests {
528528
static var allTests: [(String, (ConstructorTests) -> () throws -> Void)] {
529-
#if os(Windows) && swift(<5.6)
530-
return [
531-
("testBinary", testBinary),
532-
("testBool", testBool),
533-
// ("testFloat", testFloat),
534-
// ("testInt", testInt),
535-
("testMap", testMap),
536-
// ("testMerge", testMerge),
537-
("testNull", testNull),
538-
// ("testOmap", testOmap),
539-
("testPairs", testPairs),
540-
("testQuotationMark", testQuotationMark),
541-
("testSet", testSet),
542-
("testSeq", testSeq),
543-
("testTimestamp", testTimestamp),
544-
("testTimestampWithNanosecond", testTimestampWithNanosecond)
545-
// ("testValue", testValue)
546-
]
547-
#else
548529
return [
549530
("testBinary", testBinary),
550531
("testBool", testBool),
@@ -562,6 +543,5 @@ extension ConstructorTests {
562543
("testTimestampWithNanosecond", testTimestampWithNanosecond),
563544
("testValue", testValue)
564545
]
565-
#endif
566546
}
567547
} // swiftlint:disable:this file_length

Tests/YamsTests/EncoderTests.swift

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,38 +1149,6 @@ private struct Unkeyed: Codable, Equatable {
11491149

11501150
extension EncoderTests {
11511151
static var allTests: [(String, (EncoderTests) -> () throws -> Void)] {
1152-
#if os(Windows) && swift(<5.6)
1153-
return [
1154-
("testEncodingTopLevelEmptyStruct", testEncodingTopLevelEmptyStruct),
1155-
("testEncodingTopLevelEmptyClass", testEncodingTopLevelEmptyClass),
1156-
("testEncodingTopLevelSingleValueEnum", testEncodingTopLevelSingleValueEnum),
1157-
("testEncodingTopLevelSingleValueStruct", testEncodingTopLevelSingleValueStruct),
1158-
// ("testEncodingTopLevelSingleValueClass", testEncodingTopLevelSingleValueClass),
1159-
// ("testEncodingTopLevelStructuredStruct", testEncodingTopLevelStructuredStruct),
1160-
("testEncodingTopLevelStructuredClass", testEncodingTopLevelStructuredClass),
1161-
// ("testEncodingTopLevelStructuredSingleStruct", testEncodingTopLevelStructuredSingleStruct),
1162-
("testEncodingTopLevelStructuredSingleClass", testEncodingTopLevelStructuredSingleClass),
1163-
// ("testEncodingTopLevelDeepStructuredType", testEncodingTopLevelDeepStructuredType),
1164-
// ("testEncodingClassWhichSharesEncoderWithSuper", testEncodingClassWhichSharesEncoderWithSuper),
1165-
("testEncodingTopLevelNullableType", testEncodingTopLevelNullableType),
1166-
("testEncodingDate", testEncodingDate),
1167-
("testEncodingDateMillisecondsSince1970", testEncodingDateMillisecondsSince1970),
1168-
("testEncodingBase64Data", testEncodingBase64Data),
1169-
// ("testNestedContainerCodingPaths", testNestedContainerCodingPaths),
1170-
// ("testSuperEncoderCodingPaths", testSuperEncoderCodingPaths),
1171-
("testInterceptDecimal", testInterceptDecimal),
1172-
("testInterceptURL", testInterceptURL),
1173-
// ("testValuesInSingleValueContainer", testValuesInSingleValueContainer),
1174-
// ("testValuesInKeyedContainer", testValuesInKeyedContainer),
1175-
// ("testValuesInUnkeyedContainer", testValuesInUnkeyedContainer),
1176-
("testDictionary", testDictionary),
1177-
("testNodeTypeMismatch", testNodeTypeMismatch),
1178-
// ("testDecodingConcreteTypeParameter", testDecodingConcreteTypeParameter),
1179-
("testDecodingAnchors", testDecodingAnchors),
1180-
("test_null_yml", test_null_yml),
1181-
("testEncodingDateWithNanosecondGreaterThan999499977", testEncodingDateWithNanosecondGreaterThan999499977)
1182-
]
1183-
#else
11841152
return [
11851153
("testEncodingTopLevelEmptyStruct", testEncodingTopLevelEmptyStruct),
11861154
("testEncodingTopLevelEmptyClass", testEncodingTopLevelEmptyClass),
@@ -1212,6 +1180,5 @@ extension EncoderTests {
12121180
("testEncodingDateWithNanosecondGreaterThan999499977", testEncodingDateWithNanosecondGreaterThan999499977),
12131181
("testDecoderMark", testDecoderMark)
12141182
]
1215-
#endif
12161183
}
12171184
} // swiftlint:disable:this file_length

0 commit comments

Comments
 (0)