-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Avoid applying compiler plugin to unsupported native targets #3657
base: master
Are you sure you want to change the base?
Conversation
Hi team, in addition to the change above, I'd be interested in adding targets - even among those that are supported - and NOT enable compose for them. Currently this is not possible because of the error above, and the root issue is that compiler plugin application and dependencies are intentionally out of sync, one is done by the plugin, the other by the user. This can be a source of problems for some. How could we enable this scenario? Some ideas:
Note: if I implement any of the above, it would be in another PR and only after your feedback. So feel free to merge this. |
|
||
import org.jetbrains.kotlin.konan.target.KonanTarget | ||
|
||
internal val SUPPORTED_NATIVE_TARGETS = setOf( |
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.
Actually, Compose Compiler plugin supports more k/native targets than listed here. Compose Compile plugin can support any kotlin target which has compose-runtime compiled for it. Here is a list of compose-runtime targets: https://github.com/JetBrains/compose-multiplatform-core/blob/jb-main/compose/runtime/runtime/build.gradle#L75
private val SUPPORTED_NATIVE_TARGETS = setOf(
- this is a recent change. I'll ask my team if linux,watchos and others were intentiomally excluded here.
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.
I see, please let me know. I can make the list match the list you linked, and add a comment there to remind that new targets should be added to this set.
I'm wondering in what case you see This erros probably means that you applied the compose plugin but didn't add |
To reproduce, you can just add one of the androidNative() targets. Which don't have a runtime available. In fact, now that coroutines have androidNative support, Compose Multiplatform could support these too, but that's a separate issue. |
Nice. We'll consider that. Besides coroutines, we need atomic-fu as well. Let me ask more details about your intentions. So you have multiple targets in your module and you apply compose gradle plugin to that module. Right? We didn't consider a use case with mixing supported and not supported targets within one module. You mentioned |
Yeah, they are available too. All kotlinx libraries are AFAIK.
Right!
Both. KMP is smart enough to let me choose when to add the dependency:
So I'd like the same level of flexibility from the plugin application. Could be solved in many ways I think -- downgrade |
Thank you @natario1 |
Thanks guys. @eymar let me just add something which came to mind, maybe it will simplify things. If a target is supported by compose (say So if we had the
Edit: I take that back, Kotin/Native does not support compileOnly. Using compileOnly results in a warning and the dep is added as implementation anyway. |
Otherwise, we get:
e: Compilation failed: Cannot find the Composer class in the classpath