summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2019-05-16 11:38:51 -0700
committerJoshua Haberman <jhaberman@gmail.com>2019-05-16 11:38:51 -0700
commitd16bf99ac4658793748cda3251226059892b3b7b (patch)
tree3289398e090efb9266a71462654d113abc840cee
parent5611ff267b7f11615516fd6efe8373b730999a0d (diff)
Updated README.md and examples/bazel directory.
-rw-r--r--README.md17
-rw-r--r--examples/bazel/BUILD2
-rw-r--r--examples/bazel/WORKSPACE2
3 files changed, 13 insertions, 8 deletions
diff --git a/README.md b/README.md
index 1e9d9e6..39ab475 100644
--- a/README.md
+++ b/README.md
@@ -61,16 +61,21 @@ but full CMake support is an eventual goal).
To use upb in your Bazel project, first add upb to your `WORKSPACE` file,
either as a `git_repository()` or as a `new_local_repository()` with a
-Git Submodule:
+Git Submodule. (For an example, see `examples/bazel/ in this repo).
```python
# Add this to your WORKSPACE file.
+load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
+
git_repository(
name = "upb",
remote = "https://github.com/protocolbuffers/upb.git",
- # You may want to substitute a more recent commit here.
commit = "d5af87d06bbe3abad66970ce9c7ae0a7de8bb3c6",
)
+
+load("@upb//bazel:workspace_deps.bzl", "upb_deps")
+
+upb_deps()
```
Then in your BUILD file you can add `upb_proto_library()` rules that
@@ -79,7 +84,7 @@ example:
```python
# Add this to your BUILD file.
-load(":upb_proto_library.bzl", "upb_proto_library")
+load("@upb//bazel:upb_proto_library.bzl", "upb_proto_library")
proto_library(
name = "foo_proto",
@@ -91,9 +96,9 @@ upb_proto_library(
deps = [":foo_proto"],
)
-cc_library(
- name = "lib_that_uses_protos",
- srcs = ["lib_that_uses_protos.cc"],
+cc_binary(
+ name = "test_binary",
+ srcs = ["test_binary.c"],
deps = [":foo_upbproto"],
)
```
diff --git a/examples/bazel/BUILD b/examples/bazel/BUILD
index 2e94d46..94bcfe6 100644
--- a/examples/bazel/BUILD
+++ b/examples/bazel/BUILD
@@ -1,5 +1,5 @@
-load("@upb//:upb_proto_library.bzl", "upb_proto_library")
+load("@upb//bazel:upb_proto_library.bzl", "upb_proto_library")
proto_library(
name = "foo_proto",
diff --git a/examples/bazel/WORKSPACE b/examples/bazel/WORKSPACE
index ea03c0a..42af477 100644
--- a/examples/bazel/WORKSPACE
+++ b/examples/bazel/WORKSPACE
@@ -9,6 +9,6 @@ git_repository(
commit = "d5af87d06bbe3abad66970ce9c7ae0a7de8bb3c6",
)
-load("@upb//:workspace_deps.bzl", "upb_deps")
+load("@upb//bazel:workspace_deps.bzl", "upb_deps")
upb_deps()
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback