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

Build sometimes fail in kotlin code generation mode #209

Closed
Rajin9601 opened this issue Dec 3, 2020 · 1 comment
Closed

Build sometimes fail in kotlin code generation mode #209

Rajin9601 opened this issue Dec 3, 2020 · 1 comment

Comments

@Rajin9601
Copy link

Rajin9601 commented Dec 3, 2020

Library version: 0.3.4

Builds from Android Studio sometimes break because of the motif generated file.
The stacktrace was similar to #188.
While debugging why this happens, I found the repro steps.

Repro Steps

Execute the following commands in motif repo's current master branch. (f95ecde)

./gradlew clean
./gradlew samples:sample-kotlin:assembleDebug
./gradlew samples:sample-kotlin:assembleDebug --rerun-tasks

Second assemble command will fail with the following error

> Task :samples:sample-kotlin:compileDebugKotlin FAILED
e: ..../motif/samples/sample-kotlin/src/main/java/motif/sample/MainActivity.kt: (24, 40): Unresolved reference: MainScopeImpl

FAILURE: Build failed with an exception.

Reason why build fails

When the first build finishes, MainScopeImpl.kt is generated.
When the second build is triggered, kapt generates stub for kotlin files including the generated kotlin files.
(You can find the stub file after the second build fails)

This makes motif compiler think that MainScopeImpl is already generated and skip the code generation for MainScopeImpl when there will be no MainScopeImpl since kapt will erase the previous generated files.

This issue doesn't happen when motif.mode is changed to java.

@idanakav
Copy link
Contributor

idanakav commented Jul 1, 2021

@Rajin9601 thank you for reporting the issue.
kapt was recently updated along with kotlin and the issue is no longer reproducible.

@idanakav idanakav closed this as completed Jul 1, 2021
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

2 participants