Bazel rules for generating java sources and libraries from avro schemas
To use the Avro rules, add the following to your projects WORKSPACE
file
rules_avro_version="4413a57db613a1eba5d5a56ca48d7c6655726bb8" # update this as needed
git_repository(
name = "io_bazel_rules_avro",
commit = rules_avro_version,
remote = "git@github.com:meetup/rules_avro.git",
)
load("@io_bazel_rules_avro//avro:avro.bzl", "avro_repositories")
avro_repositories()
Then in your BUILD
file, just add the following so the rules will be available:
load("@io_bazel_rules_avro//avro:avro.bzl", "avro_gen", "avro_java_library")
avro_gen(name, srcs, strings, encoding)
Generates .srcjar
containing generated .java
source files from a collection of .avsc
schemas
Attributes | |
---|---|
name |
Name, required
A unique name for this rule. |
srcs |
List of labels, required
List of |
strings |
Boolean, optional
use |
encoding |
String, optional
set the encoding of output files. |
avro_java_library(name, srcs, strings, encoding)
Same as above except that the outputs include those provided by java_library
rules.
Meetup 2017