-
Notifications
You must be signed in to change notification settings - Fork 32
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
Multiplatform: Port :zoomable module to Compose Multiplatform #10
Conversation
18b3c14
to
202b5e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is amazing. I'm not familiar with publishing of multiplatform libraries at all. Will that automatically work with https://vanniktech.github.io/gradle-maven-publish-plugin?
zoomable/src/commonTest/kotlin/me/saket/telephoto/zoomable/internal/CoerceInsideTest.kt
Outdated
Show resolved
Hide resolved
zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/internal/savedState.kt
Outdated
Show resolved
Hide resolved
buildSrc/src/main/kotlin/kotlin-multiplatform-library-convention.gradle.kts
Show resolved
Hide resolved
zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/internal/haptics.kt
Show resolved
Hide resolved
Kotlin Multiplatform has its own decently robust publishing support. Between that and AGP's recently-good publishing support, I haven't used the vanniktech plugin in a long time. It does say it supports Kotlin Multiplatform fwiw. Can't say for sure, though I can push to mavenLocal and see what happens. |
Regarding publishing: Publishing works after specifying the variant to publish, making that change now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LFG!
@@ -48,6 +53,8 @@ androidx-activity = { module = "androidx.activity:activity-compose", version.ref | |||
androidx-test-ktx = "androidx.test:core-ktx:1.5.0" | |||
androidx-test-rules = "androidx.test:rules:1.5.0" | |||
androidx-test-junit = "androidx.test.ext:junit-ktx:1.1.5" | |||
androidx-compose-compiler = { module = "androidx.compose.compiler:compiler", version.ref = "androidx-compose-compiler" } | |||
# TODO remove compose libs in favor of declaring via jetbrains compose plugin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you share more about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jetbrains Compose has its own version (current latest 1.4.0), and that comes with a "blessed" set of versions for each of the Compose libraries. Those libraries are exposed via special dependency accessors. They look like:
dependencies {
implementation(compose.ui)
implementation(compose.material)
}
While it's totally possible to use arbitrary versions rather than the ones specified by the plugin, I went for the safe option of using the plugin's. Analogous to using the Compose BOM rather than specifying each library version individually.
If Telephoto totally adopts multiplatform, this TODO suggests to remove all the specific Compose library versions, in favor of fully using the plugin to add them as dependencies.
In the meantime, this split means that modules that use multiplatform could be using different versions of Compose libraries from those that use kotlin-android.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks for explaining!
compilerOptions.configure { | ||
freeCompilerArgs.addAll( | ||
"-Xcontext-receivers", | ||
"-Xjvm-default=all", // TODO IDE complains this isn't set (transformableState.kt). is it working? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wanna try out @JakeWharton's recommendation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No change, IDE still complains.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sigh okay. Let's get this PR merged for now. We can continue looking for a fix afterwards.
#9
This adds a convention plugin for modules using Kotlin Multiplatform + Jetbrains Compose, and migrates the :zoomable module to use it.
Things to note:
-Xjvm-default=all
properly.I migrated tests from Truth toNow using assertk.kotlin.test
, but that API is pretty basic.