I have a multi-OS swift program which I want to deploy to Linux targets. For space reasons, I'm using a Docker Image, and I'm building it with this command line:
docker run --privileged --tty --rm --workdir /root/...workdir --volume $PWD:/root/...workdir --name ubuntu-focal-amd64 swift:5.7.2-focal swift build -c release --static-swift-stdlib
Some of this is undoubtedly unneeded, but that's not my main question. What I want to know is how to have this build be executed by Xcode, considering that I've started this as a Package, rather than an Xcode specific project. In other works, how do it get this build line into the Package.swift file?
It seems like SPM plugins would be great for this, has anyone already worked this out?
Can you check Building Swift Packages in VSCode - Tim Condon - Do iOS 2022 (English) - YouTube ?
@0xTim demonstrates how to run your app in a vscode dev container. That allows you to develop on macOS but run, test, and debug your apps on Linux.
Sorry, I didn't make this at all clear: I'm building in the Docker container, not deploying to it.
I want to work in Xcode, use it to make the executable in a Docker container running the x86_64/amd64 Swift compiler, and then deploy it to my Ubuntu server running in a cloud.
I want to debug on the local machine, an M1 Mac.
I also might want to deploy on a Raspberry Pi, if and when that works so easily.
You can't (easily) cross compile and debug on Xcode for other environments. It will need to be VSCode (or similar) which works fine on macOS and provides pretty much the same experience as Xcode