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

KMP version of Dagger? #3916

Open
Zeyad-37 opened this issue Jun 21, 2023 · 10 comments
Open

KMP version of Dagger? #3916

Zeyad-37 opened this issue Jun 21, 2023 · 10 comments

Comments

@Zeyad-37
Copy link

Dagger is the king of DI on Android. With the rise of KMP & KMM only service locator libs are available. It would be great if Dagger can become a multiplatform DI framework to avoid all these runtime crashes

@Chang-Eric
Copy link
Member

In order to do KMP we would have to finish KSP work (#2349). KMP is also a very large project as we would have to rewrite all of our generated code to be in Kotlin. We also still have to consider users who only use Java, so it would probably mean having two modes, which is a lot of extra work. Basically this is all to say, this is a lot of work and probably won't happen for a while given we aren't done with KSP yet.

@shalva97

This comment was marked as off-topic.

@natros
Copy link

natros commented Jul 17, 2023 via email

@shalva97
Copy link

Okay, my bad. At first I though it would be a good joke, but now when I read it, it looks weird

@robercoding
Copy link

robercoding commented Apr 24, 2024

Hey folks, so it's been almost a year since the discussion started and Hilt has already made its transition to ksp.
Got me thinking, any chance we might see Hilt jumping on the KMP train in 2025-26? Any buzz or plans floating around?
That'd be awesome!

@Shusek
Copy link

Shusek commented Apr 29, 2024

Hey folks, so it's been almost a year since the discussion started and Hilt has already made its transition to ksp. Got me thinking, any chance we might see Hilt jumping on the KMP train in 2025-26? Any buzz or plans floating around? That'd be awesome!

Not all issues related to KSP are closed:
area: ksp

@ryanw-mobile
Copy link

Dagger(/Hilt) on Android is popular, as we see people prefer it over other available options.
When extending Android projects to KMP, Dagger(/Hilt) would still be my first preference if had a choice. I know many others share the same thoughts when they have to consider other options on KMP for DI.

I understand the effort is significant, but I hope the team can at least agree there is a plan to support KMP, even if the timeline does not exist yet? Thank you.

@Chang-Eric
Copy link
Member

Currently, there aren’t plans to work on a KMP version of Dagger or Hilt right now. Our team has discussed this but it isn’t in our current roadmap. KSP is also still in alpha since there are still a number of edge cases we’re working on, so it is a bit premature for us start on KMP. Also, while KSP was a large project, KMP support might somehow be even larger in that we’d have to support generating Kotlin as well as Java (there are still Java users out there who may not want Kotlin generated) and we already know of some tough compatibility issues we’d have to deal with there. This isn't ruling out KMP support, but also just want to set realistic expectations.

@juliocbcotta
Copy link

Hey @Chang-Eric , is ksp in alpha? From their versioning scheme it doesn't seem to be the case.
Do you keep a list of issues that are considered blockers ?(if you could share those, I would like to follow them)

@Chang-Eric
Copy link
Member

@juliocbcotta Sorry if that was confusing, I meant to say Dagger's support of KSP is still in alpha.

Most of what we're trying to resolve as blockers before moving our support from alpha to stable is performance and getting internal projects on to Dagger KSP successfully. There's some performance stuff discussed in #4180, but also there are a number of issues we've run into internally while trying to switch projects at Google over to KSP from KAPT. Some of those issues are internal only and some of them have publicly filed issues, but I don't really want to list them out here since I don't really want to drive traffic to them. We already work pretty closely with the KSP team internally and they know about the issues we're hitting, so I don't want to add pressure from people since they already know it is a priority.

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

No branches or pull requests

8 participants