Skip to content

Conversation

@wmontwe
Copy link
Member

@wmontwe wmontwe commented May 16, 2025

Resolves #9178

This provides a first Kotlin Multiplatform project setup and converts the modules under core to Kotlin Multiplatform. Modules under core:android and core:ui have been skipped due to complexity of the change.

As a side effect the namespace has been changed to net.thunderbird.

Modules related to folder handling have been moved to feature to clean up core from feature specific modules.

@wmontwe wmontwe changed the title Add kotlin multiplatform support Add Kotlin Multiplatform support May 16, 2025
@kewisch
Copy link
Member

kewisch commented May 19, 2025

Would you like me to take a look at this, or wait until Rafael is back?

@wmontwe
Copy link
Member Author

wmontwe commented May 19, 2025

Would you like me to take a look at this, or wait until Rafael is back?

Please have a look, besides introducing Kotlin Multiplatform (KMP), this is mainly organizing the project and changing namespaces.

The modules, that have been changed to KMP, where already prepared to work with KMP, I just didn't change them officially yet.

@wmontwe wmontwe force-pushed the add-kotlin-multiplatform-support branch from 32ddde8 to 0e0cd19 Compare May 20, 2025 10:42
Copy link
Member

@kewisch kewisch left a comment

Choose a reason for hiding this comment

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

This looks good to me from a high level perspective. As noted I think we should add some documentation on our KMP approach so people getting started with namespacing know what to expect.

Final review should be up to @rafaeltonholo


android {
namespace = "net.thunderbird.core.contact"
namespace = "net.thunderbird.core.android.contact"
Copy link
Member

Choose a reason for hiding this comment

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

So this means this is an android-specific module example? I think we need to have some documentation on when to use android in the package name, and at what level. Otherwise I guess we'll have a mix of some namespaces being with android and some being without.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it contains only android specific code, hence the package name. I'm preparing a documentation for the overall structure.

Copy link
Member

Choose a reason for hiding this comment

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

I want to understand more about this. Does that mean all the modules with android will be Android only and won't go to KMP? Or is it just to identify that the modules with android in their package are still not KMP compatible?

Copy link
Member Author

@wmontwe wmontwe May 27, 2025

Choose a reason for hiding this comment

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

The modules under core:android are using Android in some way, hence they have been moved there to separate them from pure JVM modules.

The JVM modules are easily convertible to KMP, while the Android ones require further work to either establish an expect/actual setup or adding proper interfaces for platform agnostic code. This has not be done yet, but should be done at some point in the future.

So it should help to identify them as not KMP compatible yet.


android {
namespace = "net.thunderbird.core.contact"
namespace = "net.thunderbird.core.android.contact"
Copy link
Member

Choose a reason for hiding this comment

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

I want to understand more about this. Does that mean all the modules with android will be Android only and won't go to KMP? Or is it just to identify that the modules with android in their package are still not KMP compatible?

Copy link
Member

Choose a reason for hiding this comment

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

nice!

@rafaeltonholo
Copy link
Member

We also need to create a root detektAll task. The ./gradlew detekt command runs it without type resolution, keeping KMP projects out of the execution and running only the android ones. See Enabling on a KMP project and detekt/detekt#3663

@wmontwe wmontwe force-pushed the add-kotlin-multiplatform-support branch from 0e0cd19 to f3436f0 Compare May 27, 2025 16:21
@wmontwe
Copy link
Member Author

wmontwe commented May 27, 2025

We also need to create a root detektAll task. The ./gradlew detekt command runs it without type resolution, keeping KMP projects out of the execution and running only the android ones. See Enabling on a KMP project and detekt/detekt#3663

Thanks, I'll think this could be a separate task. I'll check Spotless, too.

Copy link
Member

@rafaeltonholo rafaeltonholo left a comment

Choose a reason for hiding this comment

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

Great work on this PR! I'm excited to see KMP in our project!

@wmontwe wmontwe merged commit b752a00 into thunderbird:main May 27, 2025
3 checks passed
@wmontwe wmontwe deleted the add-kotlin-multiplatform-support branch May 27, 2025 20:30
@thunderbird-botmobile thunderbird-botmobile bot added this to the Thunderbird 12 milestone May 27, 2025
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.

Add Kotlin Multiplatform support

3 participants