Skip to content

Commit

Permalink
Require Swift 5.7 or later (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsim authored Jul 10, 2024
1 parent 62b0262 commit 53d8b3b
Show file tree
Hide file tree
Showing 13 changed files with 7 additions and 170 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
Linux:
strategy:
matrix:
tag: ['5.4', '5.5', '5.6', '5.7', '5.8', '5.9', '5.10']
tag: ['5.7', '5.8', '5.9', '5.10']
runs-on: ubuntu-latest
container:
image: swift:${{ matrix.tag }}-focal
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
name: macOS with Xcode ${{ matrix.xcode_version }}
strategy:
matrix:
xcode_version: ['15.0', '15.1', '15.2', '15.3', '15.4']
xcode_version: ['15.0', '15.4']
runs-on: macos-14
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app
Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/swiftpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,6 @@ concurrency:
cancel-in-progress: true

jobs:
Xcode_Monterey:
name: macOS 12 with Xcode ${{ matrix.xcode_version }}
strategy:
matrix:
xcode_version: ['13.3.1', '13.4', '14.0.1', '14.1', '14.2']
runs-on: macos-12
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app
steps:
- uses: actions/checkout@v4
- run: swift -version
- run: YAMS_DEFAULT_ENCODING=UTF16 swift test --parallel
- run: YAMS_DEFAULT_ENCODING=UTF8 swift test --parallel

Xcode_Ventura:
name: macOS 13 with Xcode ${{ matrix.xcode_version }}
strategy:
Expand Down
33 changes: 0 additions & 33 deletions .github/workflows/xcodebuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,6 @@ concurrency:
cancel-in-progress: true

jobs:
xcodebuild_Monterey:
name: macOS 12 with Xcode ${{ matrix.xcode_version }}
strategy:
matrix:
xcode_version: ['13.3.1', '13.4', '14.0.1', '14.2']
xcode_flags: ['-scheme Yams -project Yams.xcodeproj']
runs-on: macos-12
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app
steps:
- uses: actions/checkout@v4
- run: xcodebuild -version
- name: macOS with UTF16
if: always()
run: set -o pipefail && YAMS_DEFAULT_ENCODING=UTF16 xcodebuild ${{ matrix.xcode_flags }} test | xcbeautify --renderer github-actions
shell: bash
- name: macOS with UTF8
if: always()
run: set -o pipefail && YAMS_DEFAULT_ENCODING=UTF8 xcodebuild ${{ matrix.xcode_flags }} test | xcbeautify --renderer github-actions
shell: bash
- name: iPhone Simulator
if: always()
run: set -o pipefail && xcodebuild ${{ matrix.xcode_flags }} test -sdk iphonesimulator -destination "name=iPhone 8" | xcbeautify --renderer github-actions
shell: bash
- name: Apple TV Simulator
if: always()
run: set -o pipefail && xcodebuild ${{ matrix.xcode_flags }} test -sdk appletvsimulator -destination "name=Apple TV 4K (2nd generation)" | xcbeautify --renderer github-actions
shell: bash
- name: watchOS Simulator
if: always()
run: set -o pipefail && xcodebuild ${{ matrix.xcode_flags }} build -sdk watchsimulator | xcbeautify --renderer github-actions
shell: bash

xcodebuild_Ventura:
name: macOS 13 with Xcode ${{ matrix.xcode_version }}
strategy:
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

##### Breaking

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

##### Enhancements

Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.4
// swift-tools-version:5.7
import PackageDescription

let package = Package(
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A sweet and swifty [YAML](http://yaml.org/) parser built on

## Installation

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

### CMake
Expand Down
12 changes: 0 additions & 12 deletions Sources/Yams/Encoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -226,30 +226,18 @@ extension _Encoder: SingleValueEncodingContainer {
func encode<T>(_ value: T) throws where T: YAMLEncodable {
assertCanEncodeNewValue()
node = value.box()
#if swift(>=5.7)
if let stringValue = value as? (any StringProtocol), stringValue.contains("\n") {
node.scalar?.style = newlineScalarStyle
}
#else
if let stringValue = value as? String, stringValue.contains("\n") {
node.scalar?.style = newlineScalarStyle
}
#endif
}

func encode<T>(_ value: T) throws where T: Encodable {
assertCanEncodeNewValue()
if let encodable = value as? YAMLEncodable {
node = encodable.box()
#if swift(>=5.7)
if let stringValue = value as? (any StringProtocol), stringValue.contains("\n") {
node.scalar?.style = newlineScalarStyle
}
#else
if let stringValue = value as? String, stringValue.contains("\n") {
node.scalar?.style = newlineScalarStyle
}
#endif
} else {
try value.encode(to: self)
}
Expand Down
20 changes: 0 additions & 20 deletions Tests/YamsTests/ConstructorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -526,25 +526,6 @@ class ConstructorTests: XCTestCase { // swiftlint:disable:this type_body_length

extension ConstructorTests {
static var allTests: [(String, (ConstructorTests) -> () throws -> Void)] {
#if os(Windows) && swift(<5.6)
return [
("testBinary", testBinary),
("testBool", testBool),
// ("testFloat", testFloat),
// ("testInt", testInt),
("testMap", testMap),
// ("testMerge", testMerge),
("testNull", testNull),
// ("testOmap", testOmap),
("testPairs", testPairs),
("testQuotationMark", testQuotationMark),
("testSet", testSet),
("testSeq", testSeq),
("testTimestamp", testTimestamp),
("testTimestampWithNanosecond", testTimestampWithNanosecond)
// ("testValue", testValue)
]
#else
return [
("testBinary", testBinary),
("testBool", testBool),
Expand All @@ -562,6 +543,5 @@ extension ConstructorTests {
("testTimestampWithNanosecond", testTimestampWithNanosecond),
("testValue", testValue)
]
#endif
}
} // swiftlint:disable:this file_length
33 changes: 0 additions & 33 deletions Tests/YamsTests/EncoderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1149,38 +1149,6 @@ private struct Unkeyed: Codable, Equatable {

extension EncoderTests {
static var allTests: [(String, (EncoderTests) -> () throws -> Void)] {
#if os(Windows) && swift(<5.6)
return [
("testEncodingTopLevelEmptyStruct", testEncodingTopLevelEmptyStruct),
("testEncodingTopLevelEmptyClass", testEncodingTopLevelEmptyClass),
("testEncodingTopLevelSingleValueEnum", testEncodingTopLevelSingleValueEnum),
("testEncodingTopLevelSingleValueStruct", testEncodingTopLevelSingleValueStruct),
// ("testEncodingTopLevelSingleValueClass", testEncodingTopLevelSingleValueClass),
// ("testEncodingTopLevelStructuredStruct", testEncodingTopLevelStructuredStruct),
("testEncodingTopLevelStructuredClass", testEncodingTopLevelStructuredClass),
// ("testEncodingTopLevelStructuredSingleStruct", testEncodingTopLevelStructuredSingleStruct),
("testEncodingTopLevelStructuredSingleClass", testEncodingTopLevelStructuredSingleClass),
// ("testEncodingTopLevelDeepStructuredType", testEncodingTopLevelDeepStructuredType),
// ("testEncodingClassWhichSharesEncoderWithSuper", testEncodingClassWhichSharesEncoderWithSuper),
("testEncodingTopLevelNullableType", testEncodingTopLevelNullableType),
("testEncodingDate", testEncodingDate),
("testEncodingDateMillisecondsSince1970", testEncodingDateMillisecondsSince1970),
("testEncodingBase64Data", testEncodingBase64Data),
// ("testNestedContainerCodingPaths", testNestedContainerCodingPaths),
// ("testSuperEncoderCodingPaths", testSuperEncoderCodingPaths),
("testInterceptDecimal", testInterceptDecimal),
("testInterceptURL", testInterceptURL),
// ("testValuesInSingleValueContainer", testValuesInSingleValueContainer),
// ("testValuesInKeyedContainer", testValuesInKeyedContainer),
// ("testValuesInUnkeyedContainer", testValuesInUnkeyedContainer),
("testDictionary", testDictionary),
("testNodeTypeMismatch", testNodeTypeMismatch),
// ("testDecodingConcreteTypeParameter", testDecodingConcreteTypeParameter),
("testDecodingAnchors", testDecodingAnchors),
("test_null_yml", test_null_yml),
("testEncodingDateWithNanosecondGreaterThan999499977", testEncodingDateWithNanosecondGreaterThan999499977)
]
#else
return [
("testEncodingTopLevelEmptyStruct", testEncodingTopLevelEmptyStruct),
("testEncodingTopLevelEmptyClass", testEncodingTopLevelEmptyClass),
Expand Down Expand Up @@ -1212,6 +1180,5 @@ extension EncoderTests {
("testEncodingDateWithNanosecondGreaterThan999499977", testEncodingDateWithNanosecondGreaterThan999499977),
("testDecoderMark", testDecoderMark)
]
#endif
}
} // swiftlint:disable:this file_length
18 changes: 0 additions & 18 deletions Tests/YamsTests/NodeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,23 +206,6 @@ class NodeTests: XCTestCase {

extension NodeTests {
static var allTests: [(String, (NodeTests) -> () throws -> Void)] {
#if os(Windows) && swift(<5.6)
return [
("testExpressibleByArrayLiteral", testExpressibleByArrayLiteral),
("testExpressibleByDictionaryLiteral", testExpressibleByDictionaryLiteral),
("testExpressibleByFloatLiteral", testExpressibleByFloatLiteral),
("testExpressibleByIntegerLiteral", testExpressibleByIntegerLiteral),
("testExpressibleByStringLiteral", testExpressibleByStringLiteral),
// ("testTypedAccessorProperties", testTypedAccessorProperties),
// ("testArray", testArray),
("testSubscriptMapping", testSubscriptMapping),
// ("testSubscriptSequence", testSubscriptSequence),
("testSubscriptWithNonDefaultResolver", testSubscriptWithNonDefaultResolver),
("testMappingBehavesLikeADictionary", testMappingBehavesLikeADictionary),
("testSequenceBehavesLikeAnArray", testSequenceBehavesLikeAnArray),
("testScalar", testScalar)
]
#else
return [
("testExpressibleByArrayLiteral", testExpressibleByArrayLiteral),
("testExpressibleByDictionaryLiteral", testExpressibleByDictionaryLiteral),
Expand All @@ -238,6 +221,5 @@ extension NodeTests {
("testSequenceBehavesLikeAnArray", testSequenceBehavesLikeAnArray),
("testScalar", testScalar)
]
#endif
}
}
34 changes: 0 additions & 34 deletions Tests/YamsTests/SpecTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -916,39 +916,6 @@ class SpecTests: XCTestCase { // swiftlint:disable:this type_body_length

extension SpecTests {
static var allTests: [(String, (SpecTests) -> () throws -> Void)] {
#if os(Windows) && swift(<5.6)
return [
("testEmptyString", testEmptyString),
("testMultibyteCharacters", testMultibyteCharacters),
// ("testSpecExample2_1_SequenceOfScalars", testSpecExample2_1_SequenceOfScalars),
// ("testSpecExample2_2_MappingScalarsToScalars", testSpecExample2_2_MappingScalarsToScalars),
("testSpecExample2_3_MappingScalarsToSequences", testSpecExample2_3_MappingScalarsToSequences),
// ("testSpecExample2_4_SequenceOfMappings", testSpecExample2_4_SequenceOfMappings),
// ("testSpecExample2_5_SequenceOfSequences", testSpecExample2_5_SequenceOfSequences),
// ("testSpecExample2_6_MappingOfMappings", testSpecExample2_6_MappingOfMappings),
("testSpecExample2_7_TwoDocumentsInAStream", testSpecExample2_7_TwoDocumentsInAStream),
// ("testSpecExample2_8_PlayByPlayFeedFromAGame", testSpecExample2_8_PlayByPlayFeedFromAGame),
("testSpecExample2_9_SingleDocumentWithTwoComments", testSpecExample2_9_SingleDocumentWithTwoComments),
("testSpecExample2_10_NodeForSammySosaAppearsTwiceInThisDocument",
testSpecExample2_10_NodeForSammySosaAppearsTwiceInThisDocument),
("testSpecExample2_11_MappingBetweenSequences", testSpecExample2_11_MappingBetweenSequences),
// ("testSpecExample2_12_CompactNestedMapping", testSpecExample2_12_CompactNestedMapping),
("testSpecExample2_13_Inliterals_NewlinesArePreserved",
testSpecExample2_13_Inliterals_NewlinesArePreserved),
("testSpecExample2_14_InTheFoldedScalars_NewlinesBecomeSpaces",
testSpecExample2_14_InTheFoldedScalars_NewlinesBecomeSpaces),
("testSpecExample2_15_InTheFoldedScalars_NewlinesBecomeSpaces",
testSpecExample2_15_InTheFoldedScalars_NewlinesBecomeSpaces),
("testSpecExample2_16_IndentationDeterminesScope", testSpecExample2_16_IndentationDeterminesScope),
("testSpecExample2_17_QuotedScalars", testSpecExample2_17_QuotedScalars),
("testSpecExample2_18_MultiLineFlowScalars", testSpecExample2_18_MultiLineFlowScalars),
// ("testSpecExample2_19_Integers", testSpecExample2_19_Integers),
("testSpecExample2_20_FloatingPoint", testSpecExample2_20_FloatingPoint),
("testSpecExample2_23_VariousExplicitTags", testSpecExample2_23_VariousExplicitTags)
// ("testSpecExample2_27_Invoice", testSpecExample2_27_Invoice),
// ("testSpecExample2_28_LogFile", testSpecExample2_28_LogFile)
]
#else
return [
("testEmptyString", testEmptyString),
("testMultibyteCharacters", testMultibyteCharacters),
Expand Down Expand Up @@ -980,6 +947,5 @@ extension SpecTests {
("testSpecExample2_27_Invoice", testSpecExample2_27_Invoice),
("testSpecExample2_28_LogFile", testSpecExample2_28_LogFile)
]
#endif
}
} // swiftlint:disable:this file_length
2 changes: 1 addition & 1 deletion Yams.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Pod::Spec.new do |s|
s.authors = { 'JP Simard' => '[email protected]',
'Norio Nomura' => '[email protected]' }
s.source_files = 'Sources/**/*.{h,c,swift}'
s.swift_versions = ['5.4', '5.5', '5.6', '5.7', '5.8', '5.9', '5.10']
s.swift_versions = ['5.7', '5.8', '5.9', '5.10']
s.pod_target_xcconfig = { 'APPLICATION_EXTENSION_API_ONLY' => 'YES' }
s.ios.deployment_target = '11.0'
s.osx.deployment_target = '10.13'
Expand Down

0 comments on commit 53d8b3b

Please sign in to comment.