Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

import PackageDescription

let defaultSwiftSettings: [SwiftSetting] =
[
.swiftLanguageMode(.v6)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swift language v6 is on by default if you select a 6.0 or later toolchain, so this isn't needed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worthwhile keeping this to enable some of the other optional features like ExistentialAny, MemberImportVisibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started working on this because Fabian suggested to use

.enableExperimentalFeature(
            "AvailabilityMacro=LambdaSwift 2.0:macOS 15.0"
        )

on Swift 6.1

I will probably expand this PR scope

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adam-fowler Do you think it's OK to use the new @availability macro in 6.1 and keep the old .platform[.macOS(.v15)] in 6.0 ?

Package-6.0.swift :

    platforms: [.macOS(.v15)],

Package.swift

        .enableExperimentalFeature(
            "AvailabilityMacro=LambdaSwift 2.0:macOS 15.0"
        )

And in the code,

#if swift(>=6.1)
@available(LambdaSwift 2.0, *)
#endif

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adam-fowler

swift language v6 is on by default if you select a 6.0 or later toolchain, so this isn't needed

This was inspired from Valkey and gRPC projects.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adam-fowler

swift language v6 is on by default if you select a 6.0 or later toolchain, so this isn't needed

This was inspired from Valkey and gRPC projects.

haha yeah I guess so. Leave it, remove it doesn't really matter. Maybe I missed something.
I think you can leave the platform requirement in. It's not like a project will include the swift-aws-lambda-runtime package and not use it. It is more likely to happen for client libraries (like valkey) where the library might be set to be available based on the existence of a trait.

// .enableExperimentalFeature(
// "AvailabilityMacro=LambdaSwift 2.0:macOS 15.0"
// ),
//
// then, in code, use
// @available(LambdaSwift 2.0, *)
]

let package = Package(
name: "swift-aws-lambda-runtime",
platforms: [.macOS(.v15)],
Expand Down Expand Up @@ -43,7 +54,8 @@ let package = Package(
package: "swift-service-lifecycle",
condition: .when(traits: ["ServiceLifecycleSupport"])
),
]
],
swiftSettings: defaultSwiftSettings
),
.plugin(
name: "AWSLambdaPackager",
Expand All @@ -67,8 +79,10 @@ let package = Package(
.byName(name: "AWSLambdaRuntime"),
.product(name: "NIOTestUtils", package: "swift-nio"),
.product(name: "NIOFoundationCompat", package: "swift-nio"),
]
],
swiftSettings: defaultSwiftSettings
),

// for perf testing
.executableTarget(
name: "MockServer",
Expand All @@ -77,7 +91,8 @@ let package = Package(
.product(name: "NIOHTTP1", package: "swift-nio"),
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOPosix", package: "swift-nio"),
]
],
swiftSettings: defaultSwiftSettings
),
]
)
19 changes: 9 additions & 10 deletions [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

import PackageDescription

let defaultSwiftSettings: [SwiftSetting] = [
.define("FoundationJSONSupport"),
.define("ServiceLifecycleSupport"),
.define("LocalServerSupport"),
.swiftLanguageMode(.v6),
]

let package = Package(
name: "swift-aws-lambda-runtime",
platforms: [.macOS(.v15)],
Expand All @@ -28,11 +35,7 @@ let package = Package(
.product(name: "NIOPosix", package: "swift-nio"),
.product(name: "ServiceLifecycle", package: "swift-service-lifecycle"),
],
swiftSettings: [
.define("FoundationJSONSupport"),
.define("ServiceLifecycleSupport"),
.define("LocalServerSupport"),
]
swiftSettings: defaultSwiftSettings
),
.plugin(
name: "AWSLambdaPackager",
Expand All @@ -57,11 +60,7 @@ let package = Package(
.product(name: "NIOTestUtils", package: "swift-nio"),
.product(name: "NIOFoundationCompat", package: "swift-nio"),
],
swiftSettings: [
.define("FoundationJSONSupport"),
.define("ServiceLifecycleSupport"),
.define("LocalServerSupport"),
]
swiftSettings: defaultSwiftSettings
),
// for perf testing
.executableTarget(
Expand Down