stackotter / swift-bundler

An Xcodeproj-less tool for creating cross-platform Swift apps.
https://swiftbundler.dev
Apache License 2.0
303 stars 14 forks source link

Linux build support #7

Open stackotter opened 2 years ago

stackotter commented 2 years ago

A major goal of this project is to eventually support building apps for Linux. There are many competing file formats that can be used to bundle binaries and resources into a single executable/installable file for distribution. Two major ones are deb and AppImage.

To add Linux build support you'll have to create a LinuxBundler type implementing the Bundler protocol. The architecture of this project is very much based off the functional programming paradigm, so it may take a little getting used to writing relatively pure functions (in this case static methods) and using Result instead of try and throw. The functional style of programming generally has a lot of benefits for build systems and related tools.

I believe that the first format to be implemented should be AppImage as it's generally more cross platform than deb. However there are other formats such as flatpak (which take a bit more setup), so I'm definitely open to discuss the options further! Feel free to choose either deb or AppImage if you're more familiar with one or the other.

Modify this line in Bundler.swift to return LinuxBundler.self once you've created the LinuxBundler type, and you should be able to test out your implementation simply by building a simple test project (which can be created using swift bundler create MyApp).

As always, I'm very happy to help out contributors, do don't hesitate to contact me on Discord (@stackotter), Twitter (@stackotter, or via email (stackotter@stackotter.dev).

tannerdsilva commented 1 year ago

I might be able to move the ball forward on this. Certainly, it would be nice to have this for some projects I have on my horizon for next year.

Would you be opposed to me building some of this source into the solution? Or did you have another way in mind?

stackotter commented 1 year ago

I might be able to move the ball forward on this.

Awesome!

Would you be opposed to me building some of this source into the solution? Or did you have another way in mind?

That’s basically what I was planning too. I’d be fine if that tool was just considered a dependency for now (and we simply use Process to interface with it). But if you can turn the source into a form that can be built as a swiftpm library target, then all the better 👌