typealiased / mockingbird

A Swifty mocking framework for Swift and Objective-C.
https://mockingbirdswift.com
MIT License
657 stars 82 forks source link

Support for Linux #295

Open pdesjardins90 opened 2 years ago

pdesjardins90 commented 2 years ago

New Feature Request Checklist

Overview

I'm trying to setup a Swift project on Linux and the setup instructions the documentation provide are not working.

After a brief investigation, I found that the mockingbird generate command relies heavily on macOS utilities like /usr/libexec/PlistBuddy and xcrun.

I managed to skip these utility calls by setting the MKB_VERSION and MKB_NO_VERIFY environment variables but the .build/checkouts/mockingbird/bin/0.20.0/mockingbird binary still fails with the following message:

cannot execute binary file: Exec format error

Is there another way to install and run the package on linux that already exists but is not documented?

If not, what work would be required to add full linux support?

andrewchang-bird commented 2 years ago

I have a pending branch that adds Linux compatibility for the generator here: https://github.com/birdrides/mockingbird/tree/dev/andrewchang-bird/add-linux-compat

Right now it’s only tested on CentOS 8 but it’ll likely work for all distros. The biggest change is swapping out OperationQueue (which isn’t yet supported on all platforms that Foundation targets) with a custom action graph runner that uses GCD directly, although I’ve been contemplating moving to Swift concurrency just for future proofing and performance.

Note that this branch doesn’t add Linux compatibility to the runtime testing framework, although I think the only real change should be gating platform-specific imports. If you have bandwidth to contribute on that front it’d be much appreciated.

I’m targeting the 0.21 or 0.22 release with the generator changes.

pdesjardins90 commented 2 years ago

I'll look into it!

ramonschriks commented 2 years ago

Is this still planned on being released in the near future? Thanks!