-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Incremental annotation processing for Kotlin #626
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 annotation processing for Kotlin #626
Conversation
d8308c2
to
f020557
Compare
👀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Commented a few but basically LGTM:D
I'd like to test a bit carefully before release.
|
||
private fun createWithPermissionCheckFun(rpe: RuntimePermissionsElement, method: ExecutableElement): FunSpec { | ||
val builder = FunSpec.builder(withPermissionCheckMethodName(method)) | ||
.addOriginatingElement(rpe.element) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to add an original element for every spec builder?👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might work if we set an origin element for just one spec that's guaranteed to be present in the file. But I think it's better to be safe and explicit and set origin element for every top-level spec we produce.
KotlinPoet 1.3.0+ deduplicates origin elements before passing them to Filer so kapt will see only one origin element.
// FIXME: weirdly under kaptKotlin files is not recognized as source file on AS or IntelliJ | ||
// so as a workaround we generate .kt file in generated/source/kapt/$sourceSetName | ||
// ref: https://github.com/hotchemi/PermissionsDispatcher/issues/320#issuecomment-316175775 | ||
val kaptGeneratedDirPath = processingEnv.options[KAPT_KOTLIN_GENERATED_OPTION_NAME]?.replace("kaptKotlin", "kapt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure the issue has been already resolved or not👀
https://youtrack.jetbrains.com/issue/KT-20269
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that was fixed.
f020557
to
c4a6478
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I'll test on my local and gonna release new ver soon😄
Depends on #625, permissions-dispatcher/kompile-testing#13
Will add some tests later.