It was mentioned in #857 that kapt isn't supported. Opening this new issue to track support for it.
cc @dsyang
It seems like kapt3 in 1.0.6-eap77 ships with an APT_ONLY mode
https://github.com/JetBrains/kotlin/blob/8afac55a908c80feb7dd7bf7105e0557d34cacce/plugins/kapt3/src/org/jetbrains/kotlin/kapt3/Kapt3Plugin.kt#L88
https://github.com/JetBrains/kotlin/commit/95d12103171315bc2cb71d1a51a564234f0b5477
This means any build system can call kotlinc with this option and pass in kotlin source files to generate the java stubs required for the javac annoation processor round and compilation
Is there anything actually blocking this or does it just need someone to work on it now?
I don't think there's anything blocking it.
I filed this with the jetbrains team: https://youtrack.jetbrains.com/issue/KT-18072
Otherwise figuring out how to do this will require examining the source code of the gradle kapt plugin and seeing how it works.
I have some preliminary support for annotation processors in #1358. For example a kotlin class with an @Inject constructor seems to work fine when injected in to a java class. I haven't explored which parts of annotation processors aren't working.
I'll probably take a stab at this soon. I've been taking a look at how this is done in gradle land. This is how it is done in kotlin 1.1.3.
There's 4 steps.
plugin:org.jetbrains.kotlin.kapt3:aptMode=stubsplugin:org.jetbrains.kotlin.kapt3:aptMode=apt-proc:none and pass the generated sources from step 2.These steps are slightly different with each minor version of kotlin so this will be interesting. It seems there are 3 steps in kotlin 1.1.2:
plugin:org.jetbrains.kotlin.kapt3:aptOnly=true-proc:none and pass the generated sources from step 1.I figured these out by running a gradle build on a small kotlin module with --debug.
@runningcode any progress on this? It would be awesome to be able to use kapt.
@elihart It is still a work in progress. Hoping to have something together in the coming weeks.
Great to hear :) Thanks!
Hi, Is there any progress in this feature? Currently, this is the only thing holding us back from using
buck in our android projects.
@BharathMG sorry, progress has been slow. I haven't had much time to look at it. Step 1 outlined by @runningcode above seems to be failing even with the exact same arguments that Gradle uses. This leads me to believe there is some sort of Step 0 or my arguments are somehow incorrect. I haven't been able to prove either.
@cwoodwar6 Thanks for the update!
@runningcode Hello :) Here is some additional information (I think you have already seen this though).
Please ping me if you want to know something more about kapt.
Hey folks, any news on this thread? Setting up buck in my company, but this is a blocker as of now, if I can do anything to help :)
I haven't had very much time to look into this since I've posted the preliminary PR. Anyone who wants to pick up where I left off is more than welcome. I'm going to try my best to find time in the near future to work on it.
@thalescm sounds like you just volunteered 馃槃
Yeah, I've just forked buck and I'm reading the PR, getting the changes and stuff and will try to see if I get it working :D
I'll let you know if I get to anything before @cwoodwar6 does
If you guys can take a look on #1584. It should work now :)
Finally merged, I think it's safe to close the issue now. Please test it folks :)
Most helpful comment
Finally merged, I think it's safe to close the issue now. Please test it folks :)