diff options
author | Justine Tunney <jart@google.com> | 2016-09-21 16:08:11 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-09-21 17:16:04 -0700 |
commit | 65038b084059cf934df50fa86dba5b0e765f9d65 (patch) | |
tree | c6498985a80d44e81825325057e4746fe4173c05 /grpc.BUILD | |
parent | e16dd877f5a784eb31ac44c98267aa8757385fc2 (diff) |
Optimize Bazel external dependencies
This change does the following:
- Always use {,new_}http_archive rather than git_repository
- Make liberal use of strip_prefix
- Clarify licenses() in BUILD files
- On POSIX include headers like a normal C/C++ program
This change accomplishes the following:
- Reduce download size >100MB: The biggest culprit is grpc which has
tens of thousands of commits in its GitHub repository.
- Reduce disk size >200MB: On disk, grpc takes up 250MB when cloned even
though the tarball of the git repo is 3.2MB. By never using git
externals, we save on network.
- Consume less cpu: Cloning git repositories is much slower than
downloading and extracting a tarball.
Change: 133895791
Diffstat (limited to 'grpc.BUILD')
-rw-r--r-- | grpc.BUILD | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/grpc.BUILD b/grpc.BUILD index c1404b54fb..14e8daff5e 100644 --- a/grpc.BUILD +++ b/grpc.BUILD @@ -3,6 +3,7 @@ # ...with small modifications to fix the build rules for :grpc++_unsecure. # # TODO(mrry): Upstream these fixes back to the gRPC repository. +# TODO(jart): Fix nanopb's BUILD file. Fix grpc BUILD file. # GRPC Bazel BUILD file. # This currently builds C, C++ and Objective-C code. @@ -44,9 +45,26 @@ licenses(["notice"]) # 3-clause BSD package(default_visibility = ["//visibility:public"]) +genrule( + name = "pb_h", + outs = ["third_party/nanopb/pb.h"], + cmd = "echo '#include <pb.h>' >$@", + visibility = ["//visibility:private"], +) +genrule( + name = "pb_decode_h", + outs = ["third_party/nanopb/pb_decode.h"], + cmd = "echo '#include <pb_decode.h>' >$@", + visibility = ["//visibility:private"], +) - +genrule( + name = "pb_encode_h", + outs = ["third_party/nanopb/pb_encode.h"], + cmd = "echo '#include <pb_encode.h>' >$@", + visibility = ["//visibility:private"], +) cc_library( name = "gpr", @@ -499,6 +517,9 @@ cc_library( "src/core/ext/census/placeholders.c", "src/core/ext/census/tracing.c", "src/core/plugin_registry/grpc_plugin_registry.c", + "third_party/nanopb/pb.h", + "third_party/nanopb/pb_decode.h", + "third_party/nanopb/pb_encode.h", ], hdrs = [ "include/grpc/byte_buffer.h", @@ -856,6 +877,9 @@ cc_library( "src/core/lib/tsi/ssl_transport_security.c", "src/core/lib/tsi/transport_security.c", "src/core/plugin_registry/grpc_cronet_plugin_registry.c", + "third_party/nanopb/pb.h", + "third_party/nanopb/pb_decode.h", + "third_party/nanopb/pb_encode.h", ], hdrs = [ "include/grpc/byte_buffer.h", @@ -1185,6 +1209,9 @@ cc_library( "src/core/ext/census/placeholders.c", "src/core/ext/census/tracing.c", "src/core/plugin_registry/grpc_unsecure_plugin_registry.c", + "third_party/nanopb/pb.h", + "third_party/nanopb/pb_decode.h", + "third_party/nanopb/pb_encode.h", ], hdrs = [ "include/grpc/byte_buffer.h", @@ -2313,6 +2340,9 @@ objc_library( "src/core/ext/census/grpc_filter.h", "src/core/ext/census/mlog.h", "src/core/ext/census/rpc_metric_id.h", + "third_party/nanopb/pb.h", + "third_party/nanopb/pb_decode.h", + "third_party/nanopb/pb_encode.h", ], includes = [ "include", |