Skip to content
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

Support the K2 Compiler #733

Open
JoelWilcox opened this issue Jul 28, 2023 · 12 comments
Open

Support the K2 Compiler #733

JoelWilcox opened this issue Jul 28, 2023 · 12 comments
Assignees
Labels
enhancement New feature or request

Comments

@JoelWilcox
Copy link
Member

For now this is just a placeholder to track future K2 support, and to document that Anvil is currently incompatible with K2 as folks start testing it out in projects that may be using Anvil.

@JoelWilcox JoelWilcox added the enhancement New feature or request label Jul 28, 2023
@joshfriend
Copy link
Member

Can the k2 warning be disabled (or shown only once)? It shows up literally thousands of times in build logs when K2 is enabled.

@chrisjenx
Copy link

With 1.9.20 out and 2.0 next, is there an ETA for K2 support, as would love to start testing and sending feedback to the KT team.

@ZacSweers
Copy link
Collaborator

No ETA currently, we more or less have to get #751 and #704 done first

@ZacSweers ZacSweers self-assigned this Apr 22, 2024
@matejdro
Copy link

K2 seems to be out and stable now. As far as I can see, there is no way of disabling it for Kotlin 2.0? So all Anvil projects are stuck at 1.9 for now.

@ZacSweers
Copy link
Collaborator

As far as I can see, there is no way of disabling it for Kotlin 2.0?

You can force language version 1.9 while still using Kotlin 2.0.0.

You can get fairly far with the 2.5.0 betas. I wrote some instructions here: https://www.zacsweers.dev/preparing-for-k2/#anvil. The TL;DR is that yes, projects with component merging will require language version 1.9, but any projects using just factory gen can use KSP instead.

We're working on it, we didn't expect the IR APIs we use to break in 2.0 as they weren't annotated as obsolete in the compiler.

matejdro added a commit to inovait/kotlinova that referenced this issue Jun 3, 2024
Kotlin has not yet been bumped to 2.0, due to square/anvil#733
matejdro added a commit to inovait/android-architecture-playground that referenced this issue Jun 3, 2024
Kotlin has not yet been bumped to 2.0, due to square/anvil#733
@mattinger
Copy link

This is definitely very unfortunate. One of the big boosts to using kotlin 2.0.0 is that the compose compiler is versioned and delivered along with the kotlin compiler. This is going to prevent people from using that new compose compiler alongside of anvil.

Is there any kind of a timeline as to when this support might be available?

@ZacSweers
Copy link
Collaborator

@mattinger did you read the post I linked above?

@mattinger
Copy link

@ZacSweers I did, but it relies on a beta version of the anvil plugin. That's something we generally don't allow in our builds is any beta plugings or runtime dependencies. So i was curious when a release version of anvil will at least support the workaround.

@ZacSweers
Copy link
Collaborator

With all due respect, that just means you're blocked on your internal policy, not anvil.

@mattinger
Copy link

mattinger commented Jun 7, 2024

That is a fair assessment @ZacSweers , which is why i'm asking if there's an ETA on a release version where the workaround will be applicable. It's a beta09 if i remember correctly, so i would think it won't be far off. The again, it is a build tool, and not something we're distributing, so i might be able to get an exception.

@ZacSweers
Copy link
Collaborator

It will be released when it's ready. Out of respect for the many subscribers to this issue and general OSS etiquette, please accept this answer for now. We'll update this thread when there's something to update.

@mattinger
Copy link

I was not implying that anyone should rush anything. I was just asking if you did have an ETA so i can make an informed decision on trying to get usage of the beta version approved. If the answer is that there's no current ETA, that's fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants