Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support generating native library #450

Open
dalewking opened this issue Apr 17, 2020 · 11 comments
Open

Support generating native library #450

dalewking opened this issue Apr 17, 2020 · 11 comments
Labels
needs votes otherwise it will be ignored

Comments

@dalewking
Copy link

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

@robstoll robstoll added the needs votes otherwise it will be ignored label Apr 17, 2020
@robstoll
Copy link
Owner

robstoll commented Apr 17, 2020

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 👍 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.

@Sxtanna
Copy link

Sxtanna commented Apr 18, 2021

Please update this with native support. It's a great framework and it really sucks not having the ability to run tests on native.

@robstoll
Copy link
Owner

@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.

@Sxtanna
Copy link

Sxtanna commented Apr 18, 2021

@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.

@robstoll
Copy link
Owner

@Sxtanna great, I suggest you have a look at #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.

@dalewking
Copy link
Author

Alternatively, kotest already has a nice assertion library that supports MPP.

@robstoll
Copy link
Owner

robstoll commented Mar 16, 2023

@Sxtanna MPP migration is done. would you like to add further platforms?

@vivek-mittal
Copy link

@robstoll is iOS/native support available now?

@robstoll
Copy link
Owner

No not yet, do you fancy to contribute it?

@vivek-mittal
Copy link

Love to. What would that entail?

@robstoll
Copy link
Owner

robstoll commented May 22, 2023

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

  1. 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)
  2. run ./gradlew build, you will get a few compilation errors because you need to implement expect definitions (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)
  3. once it compiles, modify ch.tutteli.atrium.api.fluent.en_GB.samples.AnyExpectationSamples => toEqual, make it fail
  4. run ./gradlew :atrium-api-fluent-en_GB:xyTest where 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.
  5. 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:xyTest to 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs votes otherwise it will be ignored
Projects
None yet
Development

No branches or pull requests

4 participants