* Add support for resources when packaging using the SwiftPM plugin.
* Copy the resources directory to the working directory instead of recreating the directroy structure.
* Add resource packaging example.
* Use the bundle's url function to locate the file url.
* Fix year for soundness check.
---------
Co-authored-by: Sébastien Stormacq <sebastien.stormacq@gmail.com>
* add tracing of request events + mention LOG_LEVEL in README
* fix typo
Co-authored-by: Mahdi Bahrami <github@mahdibm.com>
* clarify the use of env variable and the swift cli
Co-authored-by: Mahdi Bahrami <github@mahdibm.com>
* clarify language about HTTP server
Co-authored-by: Mahdi Bahrami <github@mahdibm.com>
* formatting
Co-authored-by: Mahdi Bahrami <github@mahdibm.com>
* factor in additional suggestions from @mahdibm
* combine two logger statement into one and print only for Kb of payload
---------
Co-authored-by: Mahdi Bahrami <github@mahdibm.com>
Motivation:
Provide the flexibility for custom initialization of the HandlerType as this will often be required by higher level frameworks.
Modifications:
* Modify the LambdaRuntime type to accept a closure to provide the handler rather than requiring that it is provided by a static method on the Handler type
* Update downstream code to use HandlerProvider
* Update upstream code to support passing Handler Type of Handler Provider
* Add and update tests
Originally suggested and coded by @tachyonics in https://github.com/swift-server/swift-aws-lambda-runtime/pull/308
motivation: sometimes, you need to use a customized local docker image and `docker pull` don’t have to be called
changes:
* add `--disable-docker-image-update` plugin flag to disable `docker pull` call
motivation: swift 5.9 ships with builtin backtrace support \o/
changes:
* remove the dependency on swift-backtrace when using swift 5.9 or above
* conditionalize the call to Backtrace.install to relevant versions only
motivation: examples can be confusing since they use relative path to the library for CI purposes
changes:
* update examples to use the library URL, expect when env variable is set for CI purposes
* rename docker compose job to test-examples since it is more accurate
Improve archive command documentation
* Show the options that the new `archive` plugin provides to customize the operation behavior.
* Provide an example with the `archive` command taking two parameters
motivation: define stable API in preperation 1.0 release
changes:
* require swift 5.7, remove redundant backwards compatibility code
* make LambdaHandler, EventLoopLambdaHandler, and ByteBufferLambdaHandler disjointed protocols to reduce API surface area
* create coding wrappers for LambdaHandler and EventLoopLambdaHandler to provide bridge to ByteBufferLambdaHandler
* reuse output ByteBuffer to reduce allocations
* add new SimpleLambdaHandler with no-op initializer for simple lambda use cases
* update callsites and tests
* update examples
Co-authored-by: Yim Lee <yim_lee@apple.com>
Co-authored-by: Fabian Fett <fabianfett@apple.com>
* Fix compiler warning
'MyLambda' was identified as an executable target given the presence of a 'main.swift' file. Starting with tools version 5.4.0 executable targets should be declared as 'executableTarget()'
* Fix package dependency for swift-aws-lambda-events
The swift-aws-lambda-events repo has not yet pushed tag 0.1.0 so the build fails, see output from swift build:
Computing version for https://github.com/swift-server/swift-aws-lambda-events.git
error: Dependencies could not be resolved because no versions of 'swift-aws-lambda-events' match the requirement 0.1.0..<1.0.0 and root depends on 'swift-aws-lambda-events' 0.1.0..<1.0.0.
This commit adds the workaround mentioned in the issue for the missing tag https://github.com/swift-server/swift-aws-lambda-events/issues/3
* Fix multiple products and targets build error
motivation: add an easy wasy for lambda users to package their lambda and upload it to AWS
changes:
* add SwiftPM plugin to package the lambda as zipfile, with the verb "archive"
* use docker to build and package the lambda(s) on macOS and non-amazonlinux
* build directly on when on amazonlinux, zip correctly
Co-authored-by: Yim Lee <yim_lee@apple.com>
Co-authored-by: Fabian Fett <fabianfett@apple.com>
motivation: we should not publicly extend types we do not own
change: remove extensions which are largely API sugar that is not directly related to Lambda
motivation: adopt to sendable requirments in swift 5.6
changes:
* define sendable shims for protocols and structs that may be used in async context
* adjust tests
* add a test to make sure no warning are emitted
motivation: make it simpler to register shutdown hooks
changes:
* introduce Terminator helper that allow registering and de-registaring shutdown handlers
* expose the new terminator hanler on the InitializationContext and deprecate ShutdownContext
* deprecate the Handler::shutdown protocol requirment
* update the runtime code to use the new terminator instead of calling shutdown on the handler
* add and adjust tests