Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 4cba802

Browse files
Update to swift 5.2.1 (#40)
* Update to swift 5.2.1 * Fix PostgreSQLDemo * Fix PostgreSQLDemo with column result * Fix PostgreSQLDemo outfile.json
1 parent c88b0c2 commit 4cba802

File tree

13 files changed

+93
-19
lines changed

13 files changed

+93
-19
lines changed

Examples/HTTPSRequest/.devcontainer/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM nio-swift:5.1.5
1+
FROM nio-swift:5.2.1
22

33
# Or your actual UID, GID on Linux if not the default 1000
44
ARG USERNAME=vscode

Examples/HTTPSRequest/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# HTTPSRequest
22

3-
[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/)
3+
[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/) [![Swift 5.2.1](https://img.shields.io/badge/Swift-5.2.1-blue.svg)](https://swift.org/download/)
44

55
This example shows the usage of the [LambdaSwiftSprinter](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-core) framework and the plugin [LambdaSwiftSprinterNioPlugin](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-nio-plugin) to build a lambda capable to perform an HTTPS request.
66

Examples/HelloWorld/.devcontainer/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM nio-swift:5.1.5
1+
FROM nio-swift:5.2.1
22

33
# Or your actual UID, GID on Linux if not the default 1000
44
ARG USERNAME=vscode

Examples/HelloWorld/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# HelloWorld
22

3-
[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/)
3+
[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/) [![Swift 5.2.1](https://img.shields.io/badge/Swift-5.2.1-blue.svg)](https://swift.org/download/)
44

55
This example shows the usage of the [LambdaSwiftSprinter](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-core) framework to build a simple lambda.
66

Examples/PostgreSQLDemo/Package.swift

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ import PackageDescription
55

66
let package = Package(
77
name: "PostgreSQLDemo",
8+
platforms: [
9+
.macOS(.v10_15)
10+
],
811
dependencies: [
912
// Dependencies declare other packages that this package depends on.
1013
// .package(url: /* package url */, from: "1.0.0"),
1114
.package(url: "https://github.com/swift-sprinter/aws-lambda-swift-sprinter-nio-plugin", from: "1.0.0"),
12-
.package(url: "https://github.com/vapor/postgres-nio.git", from: "1.0.0-alpha.1.6"),
15+
.package(url: "https://github.com/vapor/postgres-nio.git", from: "1.0.0-rc.2"),
1316
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
1417
],
1518
targets: [

Examples/PostgreSQLDemo/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PostgreSQLDemo
22

3-
[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/)
3+
[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/) [![Swift 5.2.1](https://img.shields.io/badge/Swift-5.2.1-blue.svg)](https://swift.org/download/)
44

55
This example shows the usage of the [LambdaSwiftSprinter](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-core) framework and the plugin [LambdaSwiftSprinterNioPlugin](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-nio-plugin) to build a lambda capable to perform an Postgres query using
66
[PostgresNIO](https://github.com/vapor/postgres-nio.git).

Examples/PostgreSQLDemo/Sources/PostgreSQLDemo/main.swift

+6-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ do {
5959

6060
let syncCodableNIOLambda: SyncCodableNIOLambda<Event, Response> = { (event, context) throws -> EventLoopFuture<Response> in
6161

62-
let future = connection.query(event.query).map { (rows) -> Response in
63-
return Response(value: "\(rows)")
62+
let future = connection.query(event.query).map { (result) -> Response in
63+
64+
guard let value = result.rows[0].column("result")?.string else {
65+
return Response(value: "")
66+
}
67+
return Response(value: "\(value)")
6468

6569
}
6670
return future

Examples/PostgreSQLDemo/outfile.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"value":"[[\"result\": 2]]"}
1+
{"value":"2"}

Examples/RedisDemo/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# RedisDemo
22

3-
[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/)
3+
[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/) [![Swift 5.2.1](https://img.shields.io/badge/Swift-5.2.1-blue.svg)](https://swift.org/download/)
44

55
This example shows the usage of the [LambdaSwiftSprinter](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-core) framework and the plugin [LambdaSwiftSprinterNioPlugin](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-nio-plugin) to build a lambda capable to perform an Redis request using
66
[RediStack](https://gitlab.com/mordil/swift-redi-stack.git).

Makefile

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
# Use this tag to build a customized local image
33

4-
SWIFT_VERSION?=5.1.5
5-
LAYER_VERSION?=5-1-5
6-
# SWIFT_VERSION=5.0.3
7-
# LAYER_VERSION=5-0-3
4+
SWIFT_VERSION?=5.2.1
5+
LAYER_VERSION?=5-2-1
6+
# SWIFT_VERSION=5.1.5
7+
# LAYER_VERSION=5-1-5
88
DOCKER_TAG=nio-swift:$(SWIFT_VERSION)
99
SWIFT_DOCKER_IMAGE=$(DOCKER_TAG)
1010
SWIFT_LAMBDA_LIBRARY=nio-swift-lambda-runtime-$(LAYER_VERSION)
@@ -109,7 +109,7 @@ extract_libraries:
109109
--volume "$(MOUNT_ROOT)/:/src" \
110110
--workdir "/src/$(DOCKER_PROJECT_PATH)" \
111111
$(SWIFT_DOCKER_IMAGE) \
112-
/bin/bash -c "ldd .build/$(SWIFT_CONFIGURATION)/$(SWIFT_EXECUTABLE) | grep so | sed -e '/^[^\t]/ d' | sed -e 's/\t//' | sed -e 's/(0.*)//'"
112+
/bin/bash -c "ldd .build/$(SWIFT_CONFIGURATION)/$(SWIFT_EXECUTABLE) | grep so | sed -e '/^[^\t]/ d' | sed -e 's/\t//' | sed -e 's/(0.*)//' | sort"
113113

114114
build_lambda:
115115
docker run \
@@ -123,7 +123,7 @@ test_package:
123123
docker run \
124124
--rm \
125125
--volume "$(MOUNT_ROOT)/:/src" \
126-
--workdir "/src/" \
126+
--workdir "/src/$(DOCKER_PROJECT_PATH)" \
127127
$(SWIFT_DOCKER_IMAGE) \
128128
swift test
129129

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# aws-lambda-swift-sprinter
22

3-
[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/) ![](https://img.shields.io/badge/version-1.0.0-green) ![](https://travis-ci.com/swift-sprinter/aws-lambda-swift-sprinter.svg?branch=master) ![](https://img.shields.io/badge/@AWS-Open-orange.svg)
3+
[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/) [![Swift 5.2.1](https://img.shields.io/badge/Swift-5.2.1-blue.svg)](https://swift.org/download/) ![](https://img.shields.io/badge/version-1.0.0-green) ![](https://travis-ci.com/swift-sprinter/aws-lambda-swift-sprinter.svg?branch=master) ![](https://img.shields.io/badge/@AWS-Open-orange.svg)
44

55
![](./images/aws-lambda-swift-sprinter.png)
66

@@ -175,8 +175,8 @@ make invoke_lambda \
175175
| AWS_PROFILE | An AWS AIM profile you create to authenticate to your account. | default |
176176
| IAM_ROLE_NAME | The execution role created that will be assumed by the Lambda. | lambda_sprinter_basic_execution |
177177
| AWS_BUCKET | The AWS S3 bucket where the layer and lambdas zip files get uploaded. | aws-lambda-swift-sprinter |
178-
| SWIFT_VERSION | Version of Swift used / Matches Dockerfile location too from `docker/` folder. | 5.1.5 |
179-
| LAYER_VERSION | Version of the Swift layer that will be created and uploaded for the Lambda to run on. | 5-1-5 |
178+
| SWIFT_VERSION | Version of Swift used / Matches Dockerfile location too from `docker/` folder. | 5.2.1 |
179+
| LAYER_VERSION | Version of the Swift layer that will be created and uploaded for the Lambda to run on. | 5-2-1 |
180180
| SWIFT_EXECUTABLE | Name of the binary file. | HelloWorld |
181181
| SWIFT_PROJECT_PATH | Path to your Swift project. | Examples/HelloWorld |
182182
| LAMBDA_FUNCTION_NAME | Display name of your Lambda in AWS. | HelloWorld |

docker/5.2.1/Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM swift:5.2.1 as builder
2+
3+
RUN apt-get -qq update && apt-get -q -y install \
4+
libssl-dev libicu-dev
+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/lib/x86_64-linux-gnu/libbsd.so.0
2+
/lib/x86_64-linux-gnu/libc.so.6
3+
/lib/x86_64-linux-gnu/libcom_err.so.2
4+
/lib/x86_64-linux-gnu/libcrypt.so.1
5+
/lib/x86_64-linux-gnu/libdl.so.2
6+
/lib/x86_64-linux-gnu/libgcc_s.so.1
7+
/lib/x86_64-linux-gnu/libkeyutils.so.1
8+
/lib/x86_64-linux-gnu/liblzma.so.5
9+
/lib/x86_64-linux-gnu/libm.so.6
10+
/lib/x86_64-linux-gnu/libpthread.so.0
11+
/lib/x86_64-linux-gnu/libresolv.so.2
12+
/lib/x86_64-linux-gnu/librt.so.1
13+
/lib/x86_64-linux-gnu/libutil.so.1
14+
/lib/x86_64-linux-gnu/libz.so.1
15+
/usr/lib/swift/linux/libBlocksRuntime.so
16+
/usr/lib/swift/linux/libFoundation.so
17+
/usr/lib/swift/linux/libFoundationNetworking.so
18+
/usr/lib/swift/linux/libFoundationXML.so
19+
/usr/lib/swift/linux/libdispatch.so
20+
/usr/lib/swift/linux/libicudataswift.so.65
21+
/usr/lib/swift/linux/libicui18nswift.so.65
22+
/usr/lib/swift/linux/libicuucswift.so.65
23+
/usr/lib/swift/linux/libswiftCore.so
24+
/usr/lib/swift/linux/libswiftDispatch.so
25+
/usr/lib/swift/linux/libswiftGlibc.so
26+
/usr/lib/swift/linux/libswiftSwiftOnoneSupport.so
27+
/usr/lib/x86_64-linux-gnu/libasn1.so.8
28+
/usr/lib/x86_64-linux-gnu/libatomic.so.1
29+
/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
30+
/usr/lib/x86_64-linux-gnu/libcurl.so.4
31+
/usr/lib/x86_64-linux-gnu/libffi.so.6
32+
/usr/lib/x86_64-linux-gnu/libgmp.so.10
33+
/usr/lib/x86_64-linux-gnu/libgnutls.so.30
34+
/usr/lib/x86_64-linux-gnu/libgssapi.so.3
35+
/usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2
36+
/usr/lib/x86_64-linux-gnu/libhcrypto.so.4
37+
/usr/lib/x86_64-linux-gnu/libheimbase.so.1
38+
/usr/lib/x86_64-linux-gnu/libheimntlm.so.0
39+
/usr/lib/x86_64-linux-gnu/libhogweed.so.4
40+
/usr/lib/x86_64-linux-gnu/libhx509.so.5
41+
/usr/lib/x86_64-linux-gnu/libicudata.so.60
42+
/usr/lib/x86_64-linux-gnu/libicuuc.so.60
43+
/usr/lib/x86_64-linux-gnu/libidn2.so.0
44+
/usr/lib/x86_64-linux-gnu/libk5crypto.so.3
45+
/usr/lib/x86_64-linux-gnu/libkrb5.so.26
46+
/usr/lib/x86_64-linux-gnu/libkrb5.so.3
47+
/usr/lib/x86_64-linux-gnu/libkrb5support.so.0
48+
/usr/lib/x86_64-linux-gnu/liblber-2.4.so.2
49+
/usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2
50+
/usr/lib/x86_64-linux-gnu/libnettle.so.6
51+
/usr/lib/x86_64-linux-gnu/libnghttp2.so.14
52+
/usr/lib/x86_64-linux-gnu/libp11-kit.so.0
53+
/usr/lib/x86_64-linux-gnu/libpsl.so.5
54+
/usr/lib/x86_64-linux-gnu/libroken.so.18
55+
/usr/lib/x86_64-linux-gnu/librtmp.so.1
56+
/usr/lib/x86_64-linux-gnu/libsasl2.so.2
57+
/usr/lib/x86_64-linux-gnu/libsqlite3.so.0
58+
/usr/lib/x86_64-linux-gnu/libssl.so.1.1
59+
/usr/lib/x86_64-linux-gnu/libstdc++.so.6
60+
/usr/lib/x86_64-linux-gnu/libtasn1.so.6
61+
/usr/lib/x86_64-linux-gnu/libunistring.so.2
62+
/usr/lib/x86_64-linux-gnu/libwind.so.0
63+
/usr/lib/x86_64-linux-gnu/libxml2.so.2

0 commit comments

Comments
 (0)