-
Notifications
You must be signed in to change notification settings - Fork 0
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
FileAlreadyExistsException after adding a KSP processor to a Gradle module with anvil-utils plugin enabled #4
Comments
@arkivanov could you please give me a bit more context? |
Sure! Kotlin: 1.9.24 After further investigation it appears that the error happens when the component depends on a class that's generated by another KSP processor. @MyAnnotation // This annotation generates MyGeneratedClass under the same package
interface MyComponent {
fun interface Factory {
operator fun invoke(): MyComponent
}
}
@ContributesAssistedFactory(UserScope::class, MyComponent.Factory::class)
class DefaultMyComponent @AssistedInject constructor(
myGeneratedClass: MyGeneratedClass, // If I remove this dependency then the error disappears
) : MyComponent I'm not sure, but it looks like anvil-utils is being executed second time (which may happen) and it tries to generate the same file second time. |
Thanks! |
Also this error happens if the component's class contains a dependency from an unresolved import. import unresolved.package.name.MyClass
@ContributesAssistedFactory(UserScope::class, MyComponent.Factory::class)
class DefaultMyComponent @AssistedInject constructor(
myClass: MyClass,
) : MyComponent |
@arkivanov please test with this release and let me know if the issue is resolved |
I tried the new version, it looks like the issue with passing an unresolved dependency is now fixed, however the original issue still happens. Here is the new stack trace:
|
@arkivanov thanks, I will take a look! |
@arkivanov Unfortunately, I'm struggling to reproduce the issue 😅 I think I'm missing something 🙂 |
No problem. I migrated my decompose-dagger-sample to Anvil and anvil-utils. And uploaded a reproducer for this issue to a separate branch. Just run |
@arkivanov Thanks for the reproducer! Let me know if there's something else left |
The anvil-utils plugin throws
FileAlreadyExistsException
when I add a KSP processor to a Gradle module with the plugin enabled.The text was updated successfully, but these errors were encountered: