From bbcfad0758ee076a159f49b47f814e05cd045fca Mon Sep 17 00:00:00 2001 From: Yang Song Date: Mon, 15 Oct 2018 10:21:39 -0700 Subject: [PATCH] README: Add instructions on using opencensus_proto with Bazel. (#140) * README: Add instructions on using opencensus_proto with Bazel. * Add git_repository instruction. --- README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/README.md b/README.md index de09bd6..372f5f5 100644 --- a/README.md +++ b/README.md @@ -44,3 +44,37 @@ compile 'io.opencensus:opencensus-proto:0.0.2' [travis-url]: https://travis-ci.org/census-instrumentation/opencensus-proto [maven-image]: https://maven-badges.herokuapp.com/maven-central/io.opencensus/opencensus-proto/badge.svg [maven-url]: https://maven-badges.herokuapp.com/maven-central/io.opencensus/opencensus-proto + +### Add the dependencies to Bazel project + +In WORKSPACE, add: +``` +git_repository( + name = "io_opencensus_proto", + strip_prefix = "src", + tag = "v0.0.2", # CURRENT_OPENCENSUS_PROTO_VERSION + remote = "https://github.com/census-instrumentation/opencensus-proto", +) +``` +or + +``` +http_archive( + name = "io_opencensus_proto", + strip_prefix = "opencensus-proto-master/src", + urls = ["https://github.com/census-instrumentation/opencensus-proto/archive/master.zip"], +) +``` + +In BUILD.bazel: +```bazel +proto_library( + name = "foo_proto", + srcs = ["foo.proto"], + deps = [ + "@io_opencensus_proto//opencensus/proto/metrics/v1:metrics_proto", + "@io_opencensus_proto//opencensus/proto/trace/v1:trace_proto", + # etc. + ], +) +```