Related to this ticket Parameters for annotation processors are disabled and undocumented
How do we use annotation_processors
and annotation_processor_deps
?
Im using realm in a sample Android app and without the annotations (for @RealmClass and @RealmMoudule) the app crashes when built via buck (works normally if built via gradle).
In case anyone stumbles on this, the way to use annotation processors with buckbuild is:
annotation_processors
is a immutable list of processor class. You can identify this by the package name used in META-INF/services/javax.annotation.processing.Processor file, example: Realm Processor annotation_processor_deps
is a immutable list of Rules (generally prebuilt_jar
or android_prebuilt_aar
) holding the annotation processorA sample buck build file of a project that uses Realm Java
prebuilt_jar(
name = 'realm',
binary_jar = 'libs/realm-android-0.82.2.jar'
)
android_library(
name = 'main-lib',
srcs = glob(['app/src/main/java/com/yourcompany/project/**/*.java']),
deps = [
':supportv4',
':all-jars',
':build-config',
':res',
],
annotation_processors = ['io.realm.processor.RealmProcessor'],
annotation_processor_deps = [':realm']
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With