Skip to content

Instantly share code, notes, and snippets.

@nfisher
Created September 8, 2016 22:16
Show Gist options
  • Save nfisher/bf610d33c5772e7c8cdaf64edee542f1 to your computer and use it in GitHub Desktop.
Save nfisher/bf610d33c5772e7c8cdaf64edee542f1 to your computer and use it in GitHub Desktop.
BUCK file to generate Java code from an Avro IDL
prebuilt_jar(
name = 'avro',
binary_jar = 'lib/avro-1.8.1.jar',
source_jar = 'lib/avro-1.8.1-sources.jar',
)
prebuilt_jar(
name = 'avro-tools-jar',
binary_jar = 'lib/avro-tools-1.8.1.jar',
)
java_binary(
name = 'avro-tools',
main_class = 'org.apache.avro.tool.Main',
deps = [':avro-tools-jar'],
)
genrule(
name = 'policy-avpr',
srcs = ['src/main/resources/policy.avdl'],
cmd = '$(exe //:avro-tools) idl $SRCS $OUT',
out = 'policy.avpr',
)
# d'oh this generates a Java src package directory structure
genrule(
name = 'policy-java',
srcs = [':policy-avpr'],
cmd = '$(exe //:avro-tools) compile -string protocol $SRCS $OUT',
out = 'com',
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment