Closed fitomad closed 1 year ago
Hello @fitomad
The reason why the plugin uses --static-swift-stdlib
is because the Swift binary interface on Linux is not stable. Meaning that the binary executable or library produced is not guaranteed to work with a future Swift version.
What is your use case to generate a .so
instead of an executable ?
More reading about Swift ABI : https://www.swift.org/blog/abi-stability-and-more/ https://github.com/apple/swift/blob/main/docs/ABIStabilityManifesto.md
Hi @sebsto
That was just a PoC to generate libraries that could be included in a Lambda Layer.
Just a test 😜
I've modified the actual archive plugin in order to generate a library from a Swift Package that defines a dynamic library.
There are only three changes
Line 113 - Remove the
--static-swift-stdlib
compilation parameterLine 119 - Create the appropiate library name: lib[Name].so
330 - Change the filter policy,
LibraryProduct
instead ofExecutableProduct
After those changes the archive plugin generates a library
Why an issue instead of a PR?
Because modify or add parameters to the current archive command could affect the developers' generation experience and even current CI/CD flows using this plugin.
I think that could a good idea bring both options to developers, generate an executable Lamba or a library that could be deployed in an AWS Lambda Layer and shared between other Lambdas.
Now we use the following command
Maybe we can add an additional parameter that indicates the type of product we want to deploy. The parameter is optional and if it's not presented the archive command presents the current behavior.
And at last, I don't know if the library generation is under the scope of this project 😀