Support generating native library
Platform: iOS
Non-Code related feature
Unfortunately, I have to abandon Atrium because of the lack of support for Kotlin native for iOS. Kotlin multiplatform does not just mean Java and Javascript
Thanks for bringing this one up. So far I did not get any feedback that people would like to use Atrium for iOS or another native platform. I will look into it once I have a use case myself (none in the outlook so far though). Please react with :+1: if you would like to see this implemented as well - this might motivate me to look into it even before I have a use case myself -- feel free to sponsor me, that would be a motivation too. And of course, your help would be appreciated.
Please update this with native support. It's a great framework and it really sucks not having the ability to run tests on native.
@Sxtanna thanks for the feedback. In case you have time and would like to contribute, we first need to migrate Atrium to the new MPP plugin in order to be able to provide native targets.
@robstoll I am actually using this in my first ever mpp project, so I'm not too versed in all norms.
But I would be more than happy to prototype migration efforts. I'll give it a try.
@Sxtanna great, I suggest you have a look at https://github.com/robstoll/atrium/issues/744 first. I'll try to help you so that you can do already some part of the migration. Migrating everything at once will probably a bit too much to start with. I'll see how we can do it best and come back to you again.
Alternatively, kotest already has a nice assertion library that supports MPP.
@Sxtanna MPP migration is done. would you like to add further platforms?
@robstoll is iOS/native support available now?
No not yet, do you fancy to contribute it?
Love to. What would that entail?
I see the following things which need to be done for each target platform. I suggest you start only with one of the tier 1 platforms. We can add more later: https://kotlinlang.org/docs/native-target-support.html
- you need to define them in build.gradle.kts -- I suggest you add it after
js=> https://github.com/robstoll/atrium/blob/main/build.gradle.kts#L137 (see https://kotlinlang.org/docs/multiplatform-set-up-targets.html for help) - run ./gradlew build, you will get a few compilation errors because you need to implement
expectdefinitions (I think we only have them in atrium-core) => take a look at JS we have sometimes defined reasonable defaults and I think in some cases we even throw an UnsupportedOperation (so far we never had complaints so I guess those features are not used by JS users) 2b. in case Spek does not support your native target, then you will have to provide a few dummy implementations so that it compiles in the end => see misc/atrium-specs/src/jsMain/kotlin/io.mockk/mock.kt as a guidance, Mockk does not support js and we just faked it for JS to make it run (spek also doesn't support JS) - once it compiles, modify ch.tutteli.atrium.api.fluent.en_GB.samples.AnyExpectationSamples => toEqual, make it fail
- run
./gradlew :atrium-api-fluent-en_GB:xyTestwhere you need to replace xy with your platform name => we want to be sure that the samples are run for the new platform. This way we have at least a minimal test set in case Spek does not support the native target. - in case Spek supports the native target, then modify for instance ch.tutteli.atrium.specs.integration.AnyExpectationsSpec and run again
./gradlew :atrium-api-fluent-en_GB:xyTestto see if it also fails for your native target
I hope this gives you good pointers to start. Maybe also take a look at https://github.com/robstoll/atrium/blob/main/.github/CONTRIBUTING.md#your-first-code-contribution
And in case you get stuck somewhere, create a draft PR and I'll try to help.