swift-server / swift-aws-lambda-runtime

Swift implementation of AWS Lambda Runtime
Apache License 2.0
1.12k stars 100 forks source link

[BUG] Can't compile code with NSFileCoordinator (cannot find in scope) #302

Closed darylteo closed 1 year ago

darylteo commented 1 year ago

Expected behavior

Code with NSFileCoordinator

swift build works in OS X

swift package --disable-sandbox archive should work but does not.

Sorry if I've done something wrong but I can't see it 😅

Actual behavior

swift package --disable-sandbox archive does not work.

Can't seem to build this code that uses NSFileCoordinator. I suspect it is something to do with the amazonlinux2 version of swift.

https://github.com/darylteo/repro-swift-lambda-nsfilecoordinator/blob/main/output.txt

Steps to reproduce

Clone https://github.com/darylteo/repro-swift-lambda-nsfilecoordinator/ swift build works swift package --disable-sandbox archive does not

If possible, minimal yet complete reproducer code (or URL to code)

https://github.com/darylteo/repro-swift-lambda-nsfilecoordinator

What version of this project (swift-aws-lambda-runtime) are you using?

1.0.0-alpha1

Swift version

Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)

Amazon Linux 2 docker image version

ecd94e74c50a

tomerd commented 1 year ago

sounds like NSFileCoordinator is a macOS only API?

darylteo commented 1 year ago

@tomerd Where can I find information about the swift server equivalent for accessing filesystems? 🙏 swift on server isn't really common so all the code samples i see for doing stuff are all for iOS or Mac OS, so apologies if this sounds like a stupid question 😅

Specially I'm trying to zip up a folder and got the code from here https://gist.github.com/algal/2880f79061197cc54d918631f252cd75

darylteo commented 1 year ago

Ok I found a lib that does it with a C wrapper... I must have misunderstood the libs that get included with swift server runtime. Will close :)

(for future internet travellers, I used https://github.com/marmelroy/Zip)