Search code examples
javaandroiddaggerannotation-processingbuck

How to use custom Annotation Processors with Buck?


As the title states - I'd like use custom Java Annotation Processors with Buck (e.g. Dagger 1 / 2). Checking out the documentation did not reveal any evident annotation-processing related properties for any Java (or Android) related build rules, and I also couldn't find any examples for this scenario.

I did find this issue thread on GitHub though, without any meaningful recent answers.

Is this something that Buck still does not support? In case not, did anyone find a workaround for this?


Solution

  • Coneko points you to the code in question in that issue. Every build rule in Buck has a Description with an Arg class that describes the arguments the rule takes. In the case of java_library, there is annotation_processor_deps, annotation_pocessor_params, annotation_processors, and annotation_processor_only.

    • annotation_processor_deps - the set of dependencies needed to run the annotation processor
    • annotation_pocessor_params - the list of arguments to pass to the annotation processors
    • annotation_processors - the annotation processors
    • annotation_processor_only - True if this library is only an annotation processor