oppia / oppia-android

A free, online & offline learning platform to make quality education accessible for all.
https://www.oppia.org
Apache License 2.0
322 stars 523 forks source link

Enable experimental IR backend for Kotlin in developer builds [Blocked: #2432] #2434

Open BenHenning opened 3 years ago

BenHenning commented 3 years ago

The Kotlin team is working on introducing a new IR backend for improved compatibility with new compiler frontends including the one used for Jetpack Compose. Given that Compose will require opting into this backend, it'd be nice to test the backend by itself in the app to get an idea for potential compatibility in the future. Given that this backend is in an alpha state, it will not be staged for release in the app.

Also, to ensure that developers are primarily running the same version of the app we plan to ship to end users, we should introduce a separate developer build flavor specifically for this feature OR use a Bazel flag to control it. Note that Bazel doesn't currently support a build-wide way to enable this flag. Instead, we need to set the kotlinc flag for each kt_android_library (per https://kotlinlang.org/docs/reference/whatsnew14.html#new-jvm-ir-backend & https://github.com/bazelbuild/rules_kotlin/blob/404d3b392ffc4845cc2ad62cc11b30b5820dd523/kotlin/internal/jvm/android.bzl#L46).

A configurable attribute seems like the ideal approach (vs. a custom build) since it lets us configure this functionality for any build (even prod builds if we want to stage it for release).

BenHenning commented 6 months ago

Curious about whether this will actually be needed for Compose or if we're inadvertently enabling it by moving to a new rules_kotlin. Do you have any thoughts on this @adhiamboperes?

adhiamboperes commented 6 months ago

@BenHenning, Rules kotlin 5.0 supports the new IR backend, which is now stable and enabled by default starting Kotlin 1.5. Please see Rules Kotlin 1.5.0 release notes and Kotlin 1.5 Release notes. But looking at the source, it is not enabled by default. See https://github.com/lyft/rules_kotlin/blob/4e450d7e50e34df68f7057b3d0b73805d5e5dcef/kotlin/internal/opts.bzl#L30