Skip to content

Add support for iOS, watchOS and tvOS#120

Closed
conradev wants to merge 1 commit intoajalt:masterfrom
conradev:apple-embedded
Closed

Add support for iOS, watchOS and tvOS#120
conradev wants to merge 1 commit intoajalt:masterfrom
conradev:apple-embedded

Conversation

@conradev
Copy link
Copy Markdown

@conradev conradev commented Sep 10, 2023

This adds support for all known Apple platforms

I was upgrading my iOS/macOS/Android app to Kotlin 1.9.10 in the process of replacing my usage of kotlinx-cli with clikt, I realized that it doesn't have support for iOS. I added support to clikt, and it depends on mordant and thus here I am 😄

This approach works well for kotlin-logging, which I use for logging in my app.

I use command line arguments on iOS to configure the binary for integration testing:

Screenshot 2023-09-09 at 7 35 27 PM

This adds support for all known Apple platforms so that this library
can be used in any Xcode project.
Comment thread mordant/build.gradle.kts
val darwinMain by creating { dependsOn(posixMain) }
darwinTargets.forEach {
getByName("${it.targetName}Main").dependsOn(darwinMain)
getByName("${it.targetName}Test").dependsOn(commonTest)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is dependsOn(commonTest) necessary? I thought commonMain and commonTest were implicit.

@ajalt
Copy link
Copy Markdown
Owner

ajalt commented Sep 10, 2023

Thanks for the PR, and thanks for the use case example; I would have wondered how a CLI could be used on an iphone.

Let add these targets to the github actions tests for the macos runner (or at least all of the targets that can be run from ios).

Do ios, watchos, and tvos have identical syscalls to macos? Otherwise we'll need to write new versions of MppImpl.kt for those targets.

@hick209
Copy link
Copy Markdown

hick209 commented Mar 25, 2024

In case it's easy, while you are at it, would you mind setting things up for Android as well?

Use case

In my company here there are people that are running clikt inside their test flavor of Android app, which they use to validate things in some e2e tests they run.

Because of this, we're currently stuck on clikt pre 4.0 and I'd love to bump to the latest.
Once I get some time I plan on trying to get the code for it into Mordant (and maybe clikt if necessary).

@hick209
Copy link
Copy Markdown

hick209 commented Mar 25, 2024

I've created an issue about this #165 with more details

@ajalt
Copy link
Copy Markdown
Owner

ajalt commented May 5, 2024

I added iOS in #168, watchOS and tvOS are blocked by JetBrains/markdown#159

@ajalt ajalt closed this May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants