Skip to content

Commit 19149b4

Browse files
Merge branch 'feature/swift-aws-lambda-runtime' into develop
2 parents da11902 + 939c499 commit 19149b4

26 files changed

+485
-388
lines changed

Makefile

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
# Use this tag to build a customized local image
1616

17-
SWIFT_VERSION?=nightly-amazonlinux2
18-
LAYER_VERSION?=nightly-amazonlinux2
17+
SWIFT_VERSION?=nightly-master-amazonlinux2
18+
LAYER_VERSION?=nightly-master-amazonlinux2
1919
DOCKER_OS?=amazonlinux2
2020

2121
# SWIFT_VERSION?=5.2.3-bionic
@@ -69,7 +69,16 @@ build_lambda:
6969
--volume "$(MOUNT_ROOT)/:/src" \
7070
--workdir "/src/$(DOCKER_PROJECT_PATH)" \
7171
$(SWIFT_DOCKER_IMAGE) \
72-
/bin/bash -c "swift build --configuration $(SWIFT_CONFIGURATION)"
72+
/bin/bash -c "swift build -c $(SWIFT_CONFIGURATION) -Xswiftc -g"
73+
74+
docker_bash:
75+
docker run \
76+
-it \
77+
--rm \
78+
--volume "$(MOUNT_ROOT):/src" \
79+
--workdir "/src/" \
80+
$(SWIFT_DOCKER_IMAGE) \
81+
/bin/bash
7382

7483
cp_lambda_to_sls_build_local: create_build_directory
7584
docker run \
@@ -90,7 +99,7 @@ package_lambda: create_build_directory build_lambda
9099
package_layer: create_build_directory
91100
$(eval SHARED_LIBRARIES := $(shell cat docker/$(SWIFT_VERSION)/swift-shared-libraries.txt | tr '\n' ' '))
92101
mkdir -p $(SHARED_LIBS_FOLDER)/lib
93-
ifeq '$(DOCKER_OS)' 'xenial'
102+
ifeq '$(DOCKER_OS)' 'bionic'
94103
docker run \
95104
--rm \
96105
--volume "$(shell pwd)/:/src" \

Products/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
/Packages
44
/*.xcodeproj
55
xcuserdata/
6+
.swiftpm
7+
Package.resolved

Products/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Lines changed: 0 additions & 7 deletions
This file was deleted.

Products/Package.resolved

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Products/Package.swift

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
// swift-tools-version:5.1
1+
// swift-tools-version:5.2
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
55

66
let package = Package(
77
name: "swift-rest-api",
8+
platforms: [
9+
.macOS(.v10_13),
10+
],
811
products: [
912
// Products define the executables and libraries produced by a package, and make them visible to other packages.
1013
.executable(name: "Products", targets: ["Products"]),
@@ -14,7 +17,7 @@ let package = Package(
1417
),
1518
],
1619
dependencies: [
17-
.package(url: "https://github.com/swift-sprinter/aws-lambda-swift-sprinter-nio-plugin", from: "1.0.0"),
20+
.package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", from: "0.1.0"),
1821
.package(url: "https://github.com/swift-aws/aws-sdk-swift.git", from: "5.0.0-alpha.3"),
1922
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
2023
],
@@ -25,16 +28,20 @@ let package = Package(
2528
name: "ProductService",
2629
dependencies: [
2730
.product(name: "AWSDynamoDB", package: "aws-sdk-swift"),
28-
"Logging"
31+
.product(name: "Logging", package: "swift-log")
2932
]
3033
),
3134
.target(
3235
name: "Products",
33-
dependencies: ["LambdaSwiftSprinterNioPlugin", "ProductService"]
36+
dependencies: [
37+
.product(name: "AWSLambdaRuntime", package: "swift-aws-lambda-runtime"),
38+
.product(name: "AWSLambdaEvents", package: "swift-aws-lambda-runtime"),
39+
"ProductService"
40+
]
3441
),
3542
.testTarget(
3643
name: "ProductServiceTests",
37-
dependencies: ["ProductService"]
44+
dependencies: ["Products"]
3845
),
3946
]
4047
)

Products/Sources/ProductService/APIGateway.swift

Lines changed: 0 additions & 134 deletions
This file was deleted.

Products/Sources/ProductService/Product+DynamoDB.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 (c) Andrea Scuderi - https://github.com/swift-sprinter
1+
// Copyright 2020 (c) Andrea Scuderi - https://github.com/swift-sprinter
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Products/Sources/ProductService/Product.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 (c) Andrea Scuderi - https://github.com/swift-sprinter
1+
// Copyright 2020 (c) Andrea Scuderi - https://github.com/swift-sprinter
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Products/Sources/ProductService/ProductService.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 (c) Andrea Scuderi - https://github.com/swift-sprinter
1+
// Copyright 2020 (c) Andrea Scuderi - https://github.com/swift-sprinter
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ public enum APIError: Error {
2020
case invalidItem
2121
case tableNameNotFound
2222
case invalidRequest
23+
case handlerNotFound
2324
}
2425

2526
extension Date {

0 commit comments

Comments
 (0)