From 65038b084059cf934df50fa86dba5b0e765f9d65 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Wed, 21 Sep 2016 16:08:11 -0800 Subject: 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 --- farmhash.BUILD | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'farmhash.BUILD') 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"], ) -- cgit v1.2.3