Open ZacSweers opened 6 years ago
CC @tyvsmith @kageiit
I do see it wired in
And those directories are getting generated, but there's no output in them
After some grep magic, I'm seeing them, but in really random places
If I have a project under /libraries/foundation/modelgen/thrift-utilities
they end up duplicated in several places, and none of them are linked in buck project
./buck-out/gen/libraries/foundation/modelgen/thrifty-utilities/lib__src_main____working_directory/com/uber/thrifty/ThriftFieldJsonAdapter.kt
./buck-out/annotation/libraries/foundation/modelgen/thrifty-utilities/__src_main_kapt_generated__/com/uber/thrifty/ThriftFieldJsonAdapter.kt
./buck-out/bin/libraries/foundation/modelgen/thrifty-utilities/__src_main_gen_sources__/com/uber/thrifty/ThriftFieldJsonAdapter.kt
./build/buildScript/project-build/libraries/foundation/modelgen/thrifty-utilities/build/generated/source/kaptKotlin/main/com/uber/thrifty/ThriftFieldJsonAdapter.kt
./build/buildScript2/project-build/libraries/foundation/modelgen/thrifty-utilities/build/generated/source/kaptKotlin/main/com/uber/thrifty/ThriftFieldJsonAdapter.kt
Does this imply the processor is being invoked multiple times with different output locations?
One of them does appear on the classpath, but not sure how to see which
CC @thalescm
Hey @hzsweers ,
Kapt can pottentially generate stuff in three different directories:
kapt.kotlin.generated
option path, which kotlin APs should point out to.
sources
, which is normally where java APs output appears
classes
, if you're generating class or resources files
Check more out here.
What happens on buck is that kapt has four steps for running (decribed in the link). But you can not know for sure, while on buck, if it will, or will not generate anything.
./buck-out/annotation/libraries/foundation/modelgen/thrifty-utilities/__src_main_kapt_generated__
./buck-out/bin/libraries/foundation/modelgen/thrifty-utilities/__src_main_gen_sources__
./buck-out/gen/libraries/foundation/modelgen/thrifty-utilities/lib__src_main____working_directory
We should probably delete both files at annotation
and bin
directories at the and of the step, would be cleaner. To make IDE see the files generated by buck kapt, you could add a config for gradle that src files contain buck-out/path/to/your/project/gen/kapt
.
The other two paths where they appear are gradle outputs.
Hopefully that cleared how the flow works, but anything else please ask. Answering the final question, that doesn't mean the processor is being called multiple times. But it does indicate you're running kapt both with buck and with gradle.
Agreed on deleting being the best path forward to clear up confusion. Will try the gradle config (I'm a bit worried we'd have to end up pointing somewhere in buck-out), but shouldn't buck project pick this up correctly in native buck?
You mean a buck project in the AS? I don't think so, don't know and I'm not that familiar to how buck will generate the project files. But when implementing kapt I didn't touched on that part, so probably the IDE won't recognize those files for autocomplete and etc... Probably a good idea the create an issue specific for that, if that's the case
Hey - it would be great if someone from the buck team could acknowledge this. It's a major blocker for kotlin-first annotation processors
Trying to use Moshi's new Kotlin code gen feature, it seems that while the processor runs, the code it generates is going into a black hole somewhere.
It uses kapt's
generated
option to know where to generate code. In gradle, this ends up roughly in$buildDir/generated/source/kaptKotlin/main
. For kotlin, this seems to go nowhere. Not sure if the option just isn't being set or what.Option is normally accessed via
processingEnv.options["kapt.kotlin.generated"]
See: https://kotlinlang.org/docs/reference/kapt.html#generating-kotlin-sources