Skip to content

Commit

Permalink
Bump minimum Bazel version to 0.14.0 and activate caches
Browse files Browse the repository at this point in the history
During migration from Buck to Bazel we lost action caches activation per
default. For one, local action cache wasn't implemented in Bazel, for
another, there was no option to specify HOME directory. I fixed both
problems and starting with Bazel 0.14.0 both features are included in
released Bazel version: [1], [2].

There is still one not implemented option, limit the cache directory
with max size: [3]. But for now the advantage to activate the caches per
default far outweigh the disadvantage of unlimited growth of size of
cache directory beyound imaginary max size of say 10 GB. In meantime we
add a warning to watch the size of the directory cache and periodically
clean cache directory:

  $ rm -rf ~/.gerritcodereview/bazel-cache/cas/*

[1] https://bazel-review.googlesource.com/#/c/bazel/+/16810
[2] bazelbuild/bazel#4852
[3] bazelbuild/bazel#5139

Change-Id: I42e8f6fb9770a5976751ffef286c0fe80b75cf93
  • Loading branch information
davido authored and David Ostrovsky committed Jun 4, 2018
1 parent 1492e86 commit 2bf355d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
12 changes: 12 additions & 0 deletions Documentation/dev-bazel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,18 @@ To consume the JGit dependency from the development tree, edit
`lib/jgit/jgit.bzl` setting LOCAL_JGIT_REPO to a directory holding a
JGit repository.

[[bazel-local-caches]]

To accelerate builds, number of caches are activated per default:

* ~/.gerritcodereview/bazel-cache/downloaded-artifacts
* ~/.gerritcodereview/bazel-cache/repository
* ~/.gerritcodereview/bazel-cache/cas

All these caches currently don't have max. size limit,
link:https://github.com/bazelbuild/bazel/issues/5139[see this pending issue],
The users should watch their size and clean them manually if needed.

GERRIT
------
Part of link:index.html[Gerrit Code Review]
Expand Down
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ http_file(

load("@bazel_skylib//:lib.bzl", "versions")

versions.check(minimum_bazel_version = "0.7.0")
versions.check(minimum_bazel_version = "0.14.0")

load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories")

Expand Down
3 changes: 3 additions & 0 deletions tools/bazel.rc
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
build --workspace_status_command=./tools/workspace-status.sh --strategy=Closure=worker
build --disk_cache=~/.gerritcodereview/bazel-cache/cas
build --repository_cache=~/.gerritcodereview/bazel-cache/repository
build --experimental_strict_action_env
test --build_tests_only

0 comments on commit 2bf355d

Please sign in to comment.