From 7a38f9be1c7884435950024edf9ab591aa125e68 Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Sat, 23 Mar 2019 10:44:11 +0800 Subject: [PATCH] Avoid redundant bazel build (#4458) --- .bazelrc | 2 ++ build.sh | 5 +++-- java/test.sh | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.bazelrc b/.bazelrc index 55bcd0242..488b33101 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,2 +1,4 @@ # build config build --compilation_mode=opt +build --action_env=PATH +build --action_env=PYTHON_BIN_PATH diff --git a/build.sh b/build.sh index 08a404288..a67170722 100755 --- a/build.sh +++ b/build.sh @@ -121,14 +121,15 @@ else $PYTHON_EXECUTABLE -m pip install \ --target=$ROOT_DIR/python/ray/pyarrow_files pyarrow==0.12.0.RAY \ --find-links https://s3-us-west-2.amazonaws.com/arrow-wheels/9357dc130789ee42f8181d8724bee1d5d1509060/index.html + export PYTHON_BIN_PATH="$PYTHON_EXECUTABLE" if [ "$RAY_BUILD_JAVA" == "YES" ]; then bazel run //java:bazel_deps -- generate -r $ROOT_DIR -s java/third_party/workspace.bzl -d java/dependencies.yaml - bazel build //java:all --verbose_failures --action_env=PATH + bazel build //java:all --verbose_failures fi if [ "$RAY_BUILD_PYTHON" == "YES" ]; then - bazel build //:ray_pkg --verbose_failures --action_env=PYTHON_BIN_PATH=$PYTHON_EXECUTABLE + bazel build //:ray_pkg --verbose_failures fi fi diff --git a/java/test.sh b/java/test.sh index 2f8dd0164..d6be89b7f 100755 --- a/java/test.sh +++ b/java/test.sh @@ -9,7 +9,9 @@ ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd) pushd $ROOT_DIR/.. echo "Linting Java code with checkstyle." -bazel test //java:all --test_tag_filters="checkstyle" --action_env=PATH +# NOTE(hchen): The `test_tag_filters` option causes bazel to ignore caches. +# Thus, we add the `build_tests_only` option to avoid re-building everything. +bazel test //java:all --test_tag_filters="checkstyle" --build_tests_only echo "Running tests under cluster mode." # TODO(hchen): Ideally, we should use the following bazel command to run Java tests. However, if there're skipped tests,