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

Incremental compilation breaks when modifying constructor properties #754

Closed
Laimiux opened this issue Oct 6, 2023 · 1 comment
Closed

Comments

@Laimiux
Copy link

Laimiux commented Oct 6, 2023

What

Incremental builds consistently fail to compile after adding or removing constructor parameters to a class marked with @ContributesBinding. I was able to reproduce it with some slight modifications to the sample within the Anvil repo

  • Checkout the branch or copy code over link.
  • First run ./gradlew :sample:assembleDebug
  • Add or remove a parameter within RealParents class
  • Run ./gradlew :sample:assembleDebug again
  • You should see an error
/Users/laimonasturauskas/android/anvil/sample/app/build/tmp/kapt3/stubs/debug/com/squareup/anvil/sample/AppComponent.java:7: error: [Dagger/MissingBinding] com.squareup.anvil.sample.Parents cannot be provided without an @Provides-annotated method.
public abstract interface AppComponent extends com.squareup.anvil.sample.RandomComponent, com.squareup.anvil.sample.DescriptionComponent {
                ^
  
  Missing binding usage:
      com.squareup.anvil.sample.Parents is requested at
          com.squareup.anvil.sample.DescriptionComponent.parents()

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sample:app:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
   > java.lang.reflect.InvocationTargetException (no error message)

The issue goes away when running ./gradlew :sample:asDebug --rerun-tasks. One potential hint is that the library/build/anvil/src-gen-main/ folder to be empty after incremental build compilation.

@JoelWilcox
Copy link
Member

Closing this as a duplicate since it looks like the root issue is the same as #693. Feel free to reopen/add more details if you think this is caused by a separate issue.

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

Successfully merging a pull request may close this issue.

2 participants