diff --git a/Package.swift b/Package.swift index 1aac45ce..73b40487 100644 --- a/Package.swift +++ b/Package.swift @@ -1,17 +1,26 @@ // swift-tools-version:5.7 import PackageDescription -let excludesFromAll = ["tests", "cmake", "CONTRIBUTING.md", - "LICENSE", "format-check.py", "NOTICE", "builder.json", - "CMakeLists.txt", "README.md"] +let excludesFromAll = [ + "tests", "cmake", "CONTRIBUTING.md", + "LICENSE", "format-check.py", "NOTICE", "builder.json", + "CMakeLists.txt", "README.md", +] var packageTargets: [Target] = [] - -var package = Package(name: "aws-crt-swift", - platforms: [.iOS(.v13), .macOS(.v10_15), .tvOS(.v13), .watchOS(.v6)], - products: [ - .library(name: "AwsCommonRuntimeKit", targets: ["AwsCommonRuntimeKit"]), - .executable(name: "Elasticurl", targets: ["Elasticurl"]) - ] +packageTargets.append( + .target( + name: "AwsCPlatformConfig", + path: "aws-common-runtime/config", + publicHeadersPath: ".", + cSettings: cSettings + )) +var package = Package( + name: "aws-crt-swift", + platforms: [.iOS(.v13), .macOS(.v10_15), .tvOS(.v13), .watchOS(.v6)], + products: [ + .library(name: "AwsCommonRuntimeKit", targets: ["AwsCommonRuntimeKit"]), + .executable(name: "Elasticurl", targets: ["Elasticurl"]), + ] ) let cSettings: [CSetting] = [ @@ -28,23 +37,26 @@ let cSettings: [CSetting] = [ /// We are also not using any architecture based conditionals due to lack of proper cross compilation support. /// Configure aws-c-common ////////////////////////////////////////////////////////////////////// -var awsCCommonPlatformExcludes = ["source/android", - "AWSCRTAndroidTestRunner", "verification", - "include/aws/common/", - "scripts/appverifier_ctest.py", - "scripts/appverifier_xml.py", - "source/linux/system_info.c", - "bin/"] + excludesFromAll +var awsCCommonPlatformExcludes = + [ + "source/android", + "AWSCRTAndroidTestRunner", "verification", + "include/aws/common/", + "scripts/appverifier_ctest.py", + "scripts/appverifier_xml.py", + "source/linux/system_info.c", + "bin/", + ] + excludesFromAll // includes arch/generic because the SwiftPM doesn't like the necessary compiler flags. awsCCommonPlatformExcludes.append("source/arch/intel") awsCCommonPlatformExcludes.append("source/arch/arm") #if !os(Windows) -awsCCommonPlatformExcludes.append("source/windows") + awsCCommonPlatformExcludes.append("source/windows") #endif let cSettingsCommon: [CSetting] = [ .headerSearchPath("source/external/libcbor"), - .define("DEBUG_BUILD", .when(configuration: .debug)) + .define("DEBUG_BUILD", .when(configuration: .debug)), ] ////////////////////////////////////////////////////////////////////// @@ -52,86 +64,101 @@ let cSettingsCommon: [CSetting] = [ ////////////////////////////////////////////////////////////////////// var calDependencies: [Target.Dependency] = ["AwsCCommon"] #if os(Linux) -packageTargets.append( .systemLibrary( - name: "LibCrypto", - pkgConfig: "libcrypto", - providers: [ - .apt(["openssl libssl-dev"]), - .yum(["openssl openssl-devel"]) - ] -)) -calDependencies.append("LibCrypto") + packageTargets.append( + .systemLibrary( + name: "LibCrypto", + pkgConfig: "libcrypto", + providers: [ + .apt(["openssl libssl-dev"]), + .yum(["openssl openssl-devel"]), + ] + )) + calDependencies.append("LibCrypto") #endif -var awsCCalPlatformExcludes = [ - "bin", - "include/aws/cal/private", - "CODE_OF_CONDUCT.md", - "ecdsa-fuzz-corpus/windows/p256_sig_corpus.txt", - "ecdsa-fuzz-corpus/darwin/p256_sig_corpus.txt"] + excludesFromAll +var awsCCalPlatformExcludes = + [ + "bin", + "include/aws/cal/private", + "CODE_OF_CONDUCT.md", + "ecdsa-fuzz-corpus/windows/p256_sig_corpus.txt", + "ecdsa-fuzz-corpus/darwin/p256_sig_corpus.txt", + ] + excludesFromAll #if os(Windows) -awsCCalPlatformExcludes.append("source/darwin") -awsCCalPlatformExcludes.append("source/unix") + awsCCalPlatformExcludes.append("source/darwin") + awsCCalPlatformExcludes.append("source/unix") #elseif os(Linux) -awsCCalPlatformExcludes.append("source/windows") -awsCCalPlatformExcludes.append("source/darwin") + awsCCalPlatformExcludes.append("source/windows") + awsCCalPlatformExcludes.append("source/darwin") #else // macOS, iOS, watchOS, tvOS -awsCCalPlatformExcludes.append("source/windows") -awsCCalPlatformExcludes.append("source/unix") + awsCCalPlatformExcludes.append("source/windows") + awsCCalPlatformExcludes.append("source/unix") #endif ////////////////////////////////////////////////////////////////////// /// s2n-tls ////////////////////////////////////////////////////////////////////// #if os(Linux) -let s2nExcludes = ["bin", "codebuild", "coverage", "docker-images", - "docs", "lib", - "libcrypto-build", "scram", - "s2n.mk", "Makefile", "stuffer/Makefile", "crypto/Makefile", - "tls/Makefile", "utils/Makefile", "error/Makefile", "tls/extensions/Makefile", - "scripts/", "codebuild", "bindings/rust", "VERSIONING.rst", "tests", - "cmake/s2n-config.cmake", "CMakeLists.txt", "README.md", "cmake", "NOTICE", "LICENSE"] -packageTargets.append(.target( - name: "S2N_TLS", - dependencies: ["LibCrypto"], - path: "aws-common-runtime/s2n", - exclude: s2nExcludes, - publicHeadersPath: "api", - cSettings: [ - .headerSearchPath("./"), - .define("POSIX_C_SOURCE=200809L"), - .define("S2N_NO_PQ") + let s2nExcludes = [ + "bin", "codebuild", "coverage", "docker-images", + "docs", "lib", + "libcrypto-build", "scram", + "s2n.mk", "Makefile", "stuffer/Makefile", "crypto/Makefile", + "tls/Makefile", "utils/Makefile", "error/Makefile", "tls/extensions/Makefile", + "scripts/", "codebuild", "bindings/rust", "VERSIONING.rst", "tests", + "cmake/s2n-config.cmake", "CMakeLists.txt", "README.md", "cmake", "NOTICE", "LICENSE", ] -)) + packageTargets.append( + .target( + name: "S2N_TLS", + dependencies: ["LibCrypto"], + path: "aws-common-runtime/s2n", + exclude: s2nExcludes, + publicHeadersPath: "api", + cSettings: [ + .headerSearchPath("./"), + .define("S2N_NO_PQ"), + // This is a hack to get around the fact that S2N uses the compiler option `-include` + // to include `s2n_prelude.h` in all .c files. Since SwiftPM doesn't support compiler flags, + // we manually define the macros from `s2n_prelude.h`. + .define("_S2N_PRELUDE_INCLUDED"), + .define("S2N_BUILD_RELEASE"), + .define("_FORTIFY_SOURCE", to: "2"), + .define("POSIX_C_SOURCE", to: "200809L"), + ] + )) #endif ////////////////////////////////////////////////////////////////////// /// aws-c-io ////////////////////////////////////////////////////////////////////// var ioDependencies: [Target.Dependency] = ["AwsCCommon", "AwsCCal"] -var awsCIoPlatformExcludes = ["docs", "CODE_OF_CONDUCT.md", "codebuild", "PKCS11.md", - "source/pkcs11/v2.40"] + excludesFromAll +var awsCIoPlatformExcludes = + [ + "docs", "CODE_OF_CONDUCT.md", "codebuild", "PKCS11.md", + "source/pkcs11/v2.40", + ] + excludesFromAll var cSettingsIO = cSettings #if os(Linux) -ioDependencies.append("S2N_TLS") -cSettingsIO.append(.define("USE_S2N")) + ioDependencies.append("S2N_TLS") + cSettingsIO.append(.define("USE_S2N")) #endif #if os(Windows) -awsCIoPlatformExcludes.append("source/posix") -awsCIoPlatformExcludes.append("source/linux") -awsCIoPlatformExcludes.append("source/s2n") -awsCIoPlatformExcludes.append("source/darwin") + awsCIoPlatformExcludes.append("source/posix") + awsCIoPlatformExcludes.append("source/linux") + awsCIoPlatformExcludes.append("source/s2n") + awsCIoPlatformExcludes.append("source/darwin") #elseif os(Linux) -awsCIoPlatformExcludes.append("source/windows") -awsCIoPlatformExcludes.append("source/bsd") -awsCIoPlatformExcludes.append("source/darwin") + awsCIoPlatformExcludes.append("source/windows") + awsCIoPlatformExcludes.append("source/bsd") + awsCIoPlatformExcludes.append("source/darwin") #else // macOS, iOS, watchOS, tvOS -awsCIoPlatformExcludes.append("source/windows") -awsCIoPlatformExcludes.append("source/linux") -awsCIoPlatformExcludes.append("source/s2n") + awsCIoPlatformExcludes.append("source/windows") + awsCIoPlatformExcludes.append("source/linux") + awsCIoPlatformExcludes.append("source/s2n") #endif ////////////////////////////////////////////////////////////////////// @@ -144,7 +171,8 @@ var awsCChecksumsExcludes = [ "builder.json", "README.md", "cmake", - "tests"] + "tests", +] // swift never uses Microsoft Visual C++ compiler awsCChecksumsExcludes.append("source/intel/visualc") @@ -166,18 +194,23 @@ let awsCSdkUtilsPlatformExcludes = ["CODE_OF_CONDUCT.md"] + excludesFromAll ////////////////////////////////////////////////////////////////////// /// aws-c-compression ////////////////////////////////////////////////////////////////////// -var awsCCompressionPlatformExcludes = ["source/huffman_generator/", "CODE_OF_CONDUCT.md", - "codebuild"] + excludesFromAll +var awsCCompressionPlatformExcludes = + [ + "source/huffman_generator/", "CODE_OF_CONDUCT.md", + "codebuild", + ] + excludesFromAll ////////////////////////////////////////////////////////////////////// /// aws-c-http ////////////////////////////////////////////////////////////////////// -var awsCHttpPlatformExcludes = [ - "bin", - "integration-testing", - "include/aws/http/private", - "CODE_OF_CONDUCT.md", - "codebuild/linux-integration-tests.yml"] + excludesFromAll +var awsCHttpPlatformExcludes = + [ + "bin", + "integration-testing", + "include/aws/http/private", + "CODE_OF_CONDUCT.md", + "codebuild/linux-integration-tests.yml", + ] + excludesFromAll ////////////////////////////////////////////////////////////////////// /// aws-c-auth @@ -187,18 +220,20 @@ let awsCAuthPlatformExcludes = ["CODE_OF_CONDUCT.md"] + excludesFromAll ////////////////////////////////////////////////////////////////////// /// aws-c-eventstreams ////////////////////////////////////////////////////////////////////// -let awsCEventStreamExcludes = [ - "bin", - "CODE_OF_CONDUCT.md", - "clang-tidy/run-clang-tidy.sh"] + excludesFromAll +let awsCEventStreamExcludes = + [ + "bin", + "CODE_OF_CONDUCT.md", + "clang-tidy/run-clang-tidy.sh", + ] + excludesFromAll packageTargets.append(contentsOf: [ - .target( - name: "AwsCPlatformConfig", - path: "aws-common-runtime/config", - publicHeadersPath: ".", - cSettings: cSettings - ), + // .target( + // name: "AwsCPlatformConfig", + // path: "aws-common-runtime/config", + // publicHeadersPath: ".", + // cSettings: cSettings + // ), .target( name: "AwsCCommon", dependencies: ["AwsCPlatformConfig"], @@ -243,7 +278,9 @@ packageTargets.append(contentsOf: [ ), .target( name: "AwsCAuth", - dependencies: ["AwsCHttp", "AwsCCompression", "AwsCCal", "AwsCIo", "AwsCSdkUtils", "AwsCCommon"], + dependencies: [ + "AwsCHttp", "AwsCCompression", "AwsCCal", "AwsCIo", "AwsCSdkUtils", "AwsCCommon", + ], path: "aws-common-runtime/aws-c-auth", exclude: awsCAuthPlatformExcludes, cSettings: cSettings @@ -264,14 +301,16 @@ packageTargets.append(contentsOf: [ ), .target( name: "AwsCommonRuntimeKit", - dependencies: [ "AwsCAuth", - "AwsCHttp", - "AwsCCal", - "AwsCCompression", - "AwsCIo", - "AwsCCommon", - "AwsCChecksums", - "AwsCEventStream"], + dependencies: [ + "AwsCAuth", + "AwsCHttp", + "AwsCCal", + "AwsCCompression", + "AwsCIo", + "AwsCCommon", + "AwsCChecksums", + "AwsCEventStream", + ], path: "Source/AwsCommonRuntimeKit", resources: [ .copy("PrivacyInfo.xcprivacy") @@ -289,6 +328,6 @@ packageTargets.append(contentsOf: [ name: "Elasticurl", dependencies: ["AwsCommonRuntimeKit"], path: "Source/Elasticurl" - ) -] ) + ), +]) package.targets = packageTargets diff --git a/aws-common-runtime/aws-c-auth b/aws-common-runtime/aws-c-auth index 48d647bf..3982bd75 160000 --- a/aws-common-runtime/aws-c-auth +++ b/aws-common-runtime/aws-c-auth @@ -1 +1 @@ -Subproject commit 48d647bf43f8872e4dc5ec6343b0c5974195fbdd +Subproject commit 3982bd75fea74efd8f9b462b27fedd4599db4f53 diff --git a/aws-common-runtime/aws-c-cal b/aws-common-runtime/aws-c-cal index 2cb1d2ea..656762ae 160000 --- a/aws-common-runtime/aws-c-cal +++ b/aws-common-runtime/aws-c-cal @@ -1 +1 @@ -Subproject commit 2cb1d2eac925e2dbc45025eb89af82bd790c23a0 +Subproject commit 656762aefbee2bc8f509cb23cd107abff20a72bb diff --git a/aws-common-runtime/aws-c-common b/aws-common-runtime/aws-c-common index faa6c0f0..63187b97 160000 --- a/aws-common-runtime/aws-c-common +++ b/aws-common-runtime/aws-c-common @@ -1 +1 @@ -Subproject commit faa6c0f00802fc861e7252404f65fb1e0617ca8e +Subproject commit 63187b976a482309e23296c5f967fc19c4131746 diff --git a/aws-common-runtime/aws-c-compression b/aws-common-runtime/aws-c-compression index f36d0167..c6c1191e 160000 --- a/aws-common-runtime/aws-c-compression +++ b/aws-common-runtime/aws-c-compression @@ -1 +1 @@ -Subproject commit f36d01672d61e49d96a777870d456f66fa391cd4 +Subproject commit c6c1191e525e5aa6ead9e1afc392e35d3b50331e diff --git a/aws-common-runtime/aws-c-event-stream b/aws-common-runtime/aws-c-event-stream index 1b3825fc..d2dcc934 160000 --- a/aws-common-runtime/aws-c-event-stream +++ b/aws-common-runtime/aws-c-event-stream @@ -1 +1 @@ -Subproject commit 1b3825fc9cae2e9c7ed7479ee5d354d52ebdf7a0 +Subproject commit d2dcc9344dae24de320866045d85166d8a91a0d1 diff --git a/aws-common-runtime/aws-c-http b/aws-common-runtime/aws-c-http index 6068653e..fc3eded2 160000 --- a/aws-common-runtime/aws-c-http +++ b/aws-common-runtime/aws-c-http @@ -1 +1 @@ -Subproject commit 6068653e1d582bd8e7d1c9f81f86beaf10444e3d +Subproject commit fc3eded2465c37d07fd9cc15e9b5b011224c9c9a diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index e3637404..fcb38c80 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit e36374047beadc72a0eb6df14ce3cbc822a789a3 +Subproject commit fcb38c804364dd627c335da752a99a125a88f6e9 diff --git a/aws-common-runtime/aws-c-sdkutils b/aws-common-runtime/aws-c-sdkutils index 4658412a..ce09f797 160000 --- a/aws-common-runtime/aws-c-sdkutils +++ b/aws-common-runtime/aws-c-sdkutils @@ -1 +1 @@ -Subproject commit 4658412a61ad5749db92a8d1e0717cb5e76ada1c +Subproject commit ce09f79768653dbdc810fc14cad8685dd90acba1 diff --git a/aws-common-runtime/aws-checksums b/aws-common-runtime/aws-checksums index ce04ab00..3e4101b9 160000 --- a/aws-common-runtime/aws-checksums +++ b/aws-common-runtime/aws-checksums @@ -1 +1 @@ -Subproject commit ce04ab00b3ecc41912f478bfedca39f8e1919d6b +Subproject commit 3e4101b9f85a2c090774d27ae2131fca1082f522 diff --git a/aws-common-runtime/config/aws/common/config.h b/aws-common-runtime/config/aws/common/config.h index 7d00728c..df0e2d39 100644 --- a/aws-common-runtime/config/aws/common/config.h +++ b/aws-common-runtime/config/aws/common/config.h @@ -5,6 +5,7 @@ #ifndef AWS_COMMON_CONFIG_H #define AWS_COMMON_CONFIG_H + /* * This header exposes compiler feature test results determined during cmake * configure time to inline function implementations. The macros defined here @@ -13,7 +14,7 @@ */ #ifdef __APPLE__ /* This is a trick to skip OpenSSL header on Apple platforms since Swift Package Manager is not smart enough to exclude - * some headers. + * some headers. */ # define AWS_C_CAL_OPENSSLCRYPTO_COMMON_H #endif diff --git a/aws-common-runtime/s2n b/aws-common-runtime/s2n index ffe0bf42..493b7716 160000 --- a/aws-common-runtime/s2n +++ b/aws-common-runtime/s2n @@ -1 +1 @@ -Subproject commit ffe0bf42da8f139eff8fd2237f47fbde40b478fb +Subproject commit 493b77167dc367c394de23cfe78a029298e2a254