From 62a310217160b31819ae24b2e587715fc26078e4 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Thu, 8 Dec 2022 09:10:23 -0800 Subject: [PATCH] Rollback swift version to 5.5 (#123) --- .github/workflows/ci.yml | 10 ++-- Package.resolved | 4 +- Package.swift | 10 ++-- Source/AwsCommonRuntimeKit/crt/CStruct.swift | 51 +++++++++---------- .../AwsCommonRuntimeKit/io/HostResolver.swift | 2 +- .../AwsCommonRuntimeKit/io/TLSContext.swift | 2 +- .../sdkutils/ProfileCollection.swift | 2 +- 7 files changed, 42 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 06ee922be..bdf5ab8fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,7 @@ on: pull_request: env: - BUILDER_VERSION: v0.9.23 + BUILDER_VERSION: v0.9.28 BUILDER_SOURCE: releases BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net PACKAGE_NAME: aws-crt-swift @@ -38,9 +38,9 @@ jobs: aws s3 cp --debug s3://aws-crt-test-stuff/ci/${{ env.BUILDER_VERSION }}/linux-container-ci.sh ./linux-container-ci.sh && chmod a+x ./linux-container-ci.sh ./linux-container-ci.sh ${{ env.BUILDER_VERSION }} aws-crt-swift-5-${{ matrix.image }} build -p ${{ env.PACKAGE_NAME }} osx: - runs-on: macos-12 + runs-on: macos-11 env: - DEVELOPER_DIR: /Applications/Xcode.app + DEVELOPER_DIR: /Applications/Xcode_13.2.1.app steps: - name: Build ${{ env.PACKAGE_NAME }} + consumers run: | @@ -48,9 +48,9 @@ jobs: chmod a+x builder ./builder build -p ${{ env.PACKAGE_NAME }} devices: - runs-on: macos-12 + runs-on: macos-11 env: - DEVELOPER_DIR: /Applications/Xcode.app + DEVELOPER_DIR: /Applications/Xcode_13.2.1.app strategy: fail-fast: false matrix: diff --git a/Package.resolved b/Package.resolved index 6d120da24..dfb674d69 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/apple/swift-collections", "state": { "branch": null, - "revision": "48254824bb4248676bf7ce56014ff57b142b77eb", - "version": "1.0.2" + "revision": "f504716c27d2e5d4144fa4794b12129301d17729", + "version": "1.0.3" } } ] diff --git a/Package.swift b/Package.swift index 3349951d5..31408ff57 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.7 +// swift-tools-version:5.5 import PackageDescription let excludesFromAll = ["tests", "cmake", "CONTRIBUTING.md", @@ -54,7 +54,9 @@ calDependencies.append("LibCrypto") // aws-c-common config var awsCCommonPlatformExcludes = ["source/windows", "source/android", "AWSCRTAndroidTestRunner", "docker-images", "verification", - "include/aws/common/", "sanitizer-blacklist.txt"] + excludesFromAll + "include/aws/common/", "sanitizer-blacklist.txt", + "scripts/appverifier_ctest.py", + "scripts/appverifier_xml.py"] + excludesFromAll #if arch(i386) || arch(x86_64) awsCCommonPlatformExcludes.append("source/arch/arm") @@ -99,7 +101,9 @@ var awsCCalPlatformExcludes = [ "bin", "include/aws/cal/private", "CODE_OF_CONDUCT.md", - "sanitizer-blacklist.txt"] + excludesFromAll + "sanitizer-blacklist.txt", + "ecdsa-fuzz-corpus/windows/p256_sig_corpus.txt", + "ecdsa-fuzz-corpus/darwin/p256_sig_corpus.txt"] + excludesFromAll #if os(macOS) awsCCalPlatformExcludes.append("source/windows") diff --git a/Source/AwsCommonRuntimeKit/crt/CStruct.swift b/Source/AwsCommonRuntimeKit/crt/CStruct.swift index 7cc02fa2e..9ecabefb7 100644 --- a/Source/AwsCommonRuntimeKit/crt/CStruct.swift +++ b/Source/AwsCommonRuntimeKit/crt/CStruct.swift @@ -5,7 +5,7 @@ import AwsCCommon // This file defines the protocols & helper functions for C Structs. // Instances implementing this protocol should define RawType as their C Struct. -protocol CStruct { +protocol CStruct { associatedtype RawType func withCStruct(_ body: (RawType) -> Result) -> Result } @@ -58,13 +58,12 @@ extension CStructWithUserData { } } -// swiftlint:disable force_cast -func withOptionalCStructPointer( - to arg1: (any CStruct)?, _ body: (UnsafePointer?) -> Result +func withOptionalCStructPointer( + to arg1: T?, _ body: (UnsafePointer?) -> Result ) -> Result { if let arg1 = arg1 { return arg1.withCStruct { cStruct in - return withUnsafePointer(to: cStruct as! T) { structPointer in + return withUnsafePointer(to: cStruct) { structPointer in body(structPointer) } } @@ -72,13 +71,13 @@ func withOptionalCStructPointer( return body(nil) } -func withOptionalCStructPointer( - _ arg1: (any CStruct)?, - _ arg2: (any CStruct)?, - _ body: (UnsafePointer?, - UnsafePointer?) -> Result + _ arg1: Arg1Type?, + _ arg2: Arg2Type?, + _ body: (UnsafePointer?, + UnsafePointer?) -> Result ) -> Result { return withOptionalCStructPointer(to: arg1) { arg1Pointer in return withOptionalCStructPointer(to: arg2) { arg2Pointer in @@ -87,22 +86,22 @@ func withOptionalCStructPointer( - _ arg1: (any CStruct)?, - _ arg2: (any CStruct)?, - _ arg3: (any CStruct)?, - _ arg4: (any CStruct)?, - _ arg5: (any CStruct)?, - _ body: (UnsafePointer?, - UnsafePointer?, - UnsafePointer?, - UnsafePointer?, - UnsafePointer?) -> Result + _ arg1: Arg1Type?, + _ arg2: Arg2Type?, + _ arg3: Arg3Type?, + _ arg4: Arg4Type?, + _ arg5: Arg5Type?, + _ body: (UnsafePointer?, + UnsafePointer?, + UnsafePointer?, + UnsafePointer?, + UnsafePointer?) -> Result ) -> Result { return withOptionalCStructPointer(arg1, arg2) { arg1Pointer, arg2Pointer in return withOptionalCStructPointer(arg3, arg4) { arg3Pointer, arg4Pointer in diff --git a/Source/AwsCommonRuntimeKit/io/HostResolver.swift b/Source/AwsCommonRuntimeKit/io/HostResolver.swift index 47b9e5941..6d8ab3bed 100644 --- a/Source/AwsCommonRuntimeKit/io/HostResolver.swift +++ b/Source/AwsCommonRuntimeKit/io/HostResolver.swift @@ -91,7 +91,7 @@ private func onHostResolved(_ resolver: UnsafeMutablePointer? // Success let length = aws_array_list_length(hostAddresses!) - let addresses = (0.. HostAddress in var address: UnsafeMutableRawPointer! = nil aws_array_list_get_at_ptr(hostAddresses!, &address, index) let hostAddressCType = address.bindMemory(to: aws_host_address.self, capacity: 1).pointee diff --git a/Source/AwsCommonRuntimeKit/io/TLSContext.swift b/Source/AwsCommonRuntimeKit/io/TLSContext.swift index 0f92d3c92..04c941af9 100644 --- a/Source/AwsCommonRuntimeKit/io/TLSContext.swift +++ b/Source/AwsCommonRuntimeKit/io/TLSContext.swift @@ -7,7 +7,7 @@ public class TLSContext { var rawValue: UnsafeMutablePointer public init(options: TLSContextOptions, mode: TLSMode, allocator: Allocator = defaultAllocator) throws { - guard let rawValue = (options.withCPointer { optionsPointer in + guard let rawValue = (options.withCPointer { optionsPointer -> UnsafeMutablePointer? in switch mode { case .client: return aws_tls_client_ctx_new(allocator.rawValue, optionsPointer) diff --git a/Source/AwsCommonRuntimeKit/sdkutils/ProfileCollection.swift b/Source/AwsCommonRuntimeKit/sdkutils/ProfileCollection.swift index fc2282fbb..c40ae6f7b 100644 --- a/Source/AwsCommonRuntimeKit/sdkutils/ProfileCollection.swift +++ b/Source/AwsCommonRuntimeKit/sdkutils/ProfileCollection.swift @@ -32,7 +32,7 @@ public class ProfileCollection { source: ProfileSourceType, allocator: Allocator = defaultAllocator) throws { let byteCount = data.count - guard let rawValue = (data.withUnsafeBytes { rawBufferPointer in + guard let rawValue = (data.withUnsafeBytes { rawBufferPointer -> OpaquePointer? in var byteBuf = aws_byte_buf_from_array(rawBufferPointer.baseAddress, byteCount) return aws_profile_collection_new_from_buffer(allocator.rawValue, &byteBuf,