Conversation
| .addFunction(createFactory("create", Provider::class.asClassName())) | ||
| // New in Dagger 2.50: factories for dagger.internal.Provider | ||
| .addFunction( | ||
| FunSpec.builder("create") | ||
| .jvmStatic() | ||
| .addTypeVariables(typeParameters) | ||
| .addParameter(DELEGATE_FACTORY_NAME, generatedFactoryTypeName) | ||
| .returns(Provider::class.asClassName().parameterizedBy(baseFactoryTypeName)) | ||
| .addStatement( | ||
| "return %T.create(%T($DELEGATE_FACTORY_NAME))", | ||
| InstanceFactory::class, | ||
| implParameterizedTypeName, | ||
| ) | ||
| .build(), | ||
| createFactory("createFactoryProvider", dagger.internal.Provider::class.asClassName()), |
There was a problem hiding this comment.
Does Dagger always generate both now? Or are they keying off anything to decide on one vs the other? Looks like all the tests passed so it should be fine, but it feels a little surprising
There was a problem hiding this comment.
It always generates both now. The original for backward compatibility, the new one for forward compatibility. They're going to support both going forward
|
errrr I don't know what changed on main that broke this so much? It was green before |
|
Should be fixed up now 👍 |
|
... these pass locally for me. Ugh |
|
nvm found a new issue. I think this is a slight behavior difference between dagger kapt and KSP though, gonna dig in. Weird that these passed before though, curious what changed on main to trigger these in a way that didn't fail previously 🤔 |
|
I'm guessing it's related to the KotlinPoet bump. The |
|
Sure, but I haven't made any changes to |
This updates Dagger to 2.50, which includes two code gen changes.
1. Prohibit extension declarations for
@BindsfunctionsStarting in Dagger 2.48,
@Bindsfunctions can no longer be extension functions.Note that dagger also prohibits these on
@Providesfunctions, but Anvil didn't have any tests or validation for this case. I added some opportunistically.2. Add support for new
dagger.internal.ProviderfactoriesDagger 2.50 introduced a new
Providertype in preparation for its support of jakarta: https://github.com/google/dagger/releases/tag/dagger-2.50. The way this is implemented in AssistedFactory code gen is via a secondcreateFactoryProvider()factory function that returns an instance of this new internal Provider type. This PR updates Dagger and adds support for this new type.I had to also force a newer Guava version as it seems Dagger updated theirs and uses some newer APIs, though surprisingly this isn't exposed transitively on the classpath.