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 /farmhash.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 'farmhash.BUILD')
-rw-r--r-- | farmhash.BUILD | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/farmhash.BUILD b/farmhash.BUILD index fe19e14430..8111cd61f9 100644 --- a/farmhash.BUILD +++ b/farmhash.BUILD @@ -1,21 +1,9 @@ -package(default_visibility = ["//visibility:public"]) - -prefix_dir = "farmhash-34c13ddfab0e35422f4c3979f360635a8c050260" - -genrule( - name = "configure", - srcs = glob( - ["**/*"], - exclude = [prefix_dir + "/config.h"], - ), - outs = [prefix_dir + "/config.h"], - cmd = "pushd external/farmhash_archive/%s; workdir=$$(mktemp -d -t tmp.XXXXXXXXXX); cp -a * $$workdir; pushd $$workdir; ./configure; popd; popd; cp $$workdir/config.h $(@D); rm -rf $$workdir;" % prefix_dir, -) +licenses(["notice"]) # MIT cc_library( name = "farmhash", - srcs = [prefix_dir + "/src/farmhash.cc"], - hdrs = [prefix_dir + "/src/farmhash.h"] + [":configure"], - includes = [prefix_dir], - visibility = ["//visibility:public"] + srcs = ["farmhash.cc"], + hdrs = ["farmhash.h"], + includes = ["."], + visibility = ["//visibility:public"], ) |