Leanplum / Leanplum-Android-SDK

Leanplum's integrated solution delivers meaningful engagement across messaging and the in-app experience.
https://www.leanplum.com
Apache License 2.0
46 stars 40 forks source link

Enable support for Kotlin files #451

Closed hborisoff closed 3 years ago

hborisoff commented 3 years ago
What Where/Who
JIRA Issue SDK-377
People Involved @hborisoff

Background

This change adds support for writing Kotlin inside the SDK.

Implementation

The kotlin-android gradle plugin will dynamically add the org.jetbrains.kotlin:kotlin-stdlib dependency. It can be seen in the pom.xml files of the modules, when published. More on the versions of the stdlib here.

There is not need to include androidx.core:core-ktx library at the moment. It provides several improvements to better integrate Android specifics with Kotlin. More about difference between Android X and Android KTX here. Feel free to add it in future.

Testing steps

Our testing framework works fine when writing unit tests in java and referencing Kotlin classes. Tested multiple cases with mock, spy, verify, for both member and static methods. Writing unit tests in Kotlin seems not well supported in current framework. Most stuff works, but there are cases which are not working. Better for now is to use only Java for the testing classes.

Is this change backwards-compatible?

It seems fine to use our SDK (containing Kotlin files) without the need to apply kotlin-android plugin in your app, so backward compatibility should be fine.