Skip to content

[Test] Use bazel remote cache #1305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .kokoro/presubmit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sudo DEBIAN_FRONTEND=noninteractive apt -o Dpkg::Options::="--force-confdef" -o
REPO_DIR="$(realpath "$(dirname "$0")"/..)"
TOOL_DIR="${REPO_DIR}/tools"

"${TOOL_DIR}/buildutils/build_packages.sh"
"${TOOL_DIR}/buildutils/build_packages.sh" -e BAZEL_REMOTE_CACHE=https://storage.googleapis.com/android-cuttlefish-cache

# Add test user to the kokoro group so it has access to the source dir
"${TOOL_DIR}/testutils/prepare_host.sh" -d "${REPO_DIR}" -u testrunner -g kokoro
Expand Down
7 changes: 6 additions & 1 deletion base/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ ifneq ($(strip $(BAZEL_DISK_CACHE_DIR)),)
disk_cache_arg := --disk_cache="$(BAZEL_DISK_CACHE_DIR)"
endif

remote_cache_arg :=
ifneq ($(strip $(BAZEL_REMOTE_CACHE)),)
remote_cache_arg := --google_default_credentials --remote_cache="$(BAZEL_REMOTE_CACHE)"
endif

%:
dh $@ --with=config-package

Expand All @@ -71,7 +76,7 @@ override_dh_installinit:
# the `--workspace_status_command` flag path depends on the current working directory of base/cvd
.PHONY: override_dh_auto_build
override_dh_auto_build:
cd cvd && bazel build ${disk_cache_arg} ${compilation_mode} ${conlyopts} ${copts} ${cxxopts} ${linkopts} 'cuttlefish/package:cvd' --spawn_strategy=local --workspace_status_command=../stamp_helper.sh --build_tag_filters=-clang-tidy
cd cvd && bazel build ${remote_cache_arg} ${disk_cache_arg} ${compilation_mode} ${conlyopts} ${copts} ${cxxopts} ${linkopts} 'cuttlefish/package:cvd' --spawn_strategy=local --workspace_status_command=../stamp_helper.sh --build_tag_filters=-clang-tidy
dh_auto_build

# Only generate optimized DWARF if debug is enabled
Expand Down
5 changes: 3 additions & 2 deletions tools/buildutils/build_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
set -o errexit -o nounset -o pipefail

function print_usage() {
>&2 echo "usage: $0 /path/to/pkgdir"
>&2 echo "usage: $0 /path/to/pkgdir [debuild options]"
}

if [[ $# -eq 0 ]]; then
Expand All @@ -27,10 +27,11 @@ if [[ $# -eq 0 ]]; then
fi

readonly PKGDIR="$1"
shift

pushd "${PKGDIR}"
echo "Installing package dependencies"
sudo mk-build-deps -i -t 'apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y'
echo "Building packages"
debuild --prepend-path /usr/local/bin -i -uc -us -b
debuild $@ --prepend-path /usr/local/bin -i -uc -us -b
popd
4 changes: 2 additions & 2 deletions tools/buildutils/build_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ BUILD_PACKAGE="$(dirname $0)/build_package.sh"
command -v bazel &> /dev/null || sudo "${INSTALL_BAZEL}"
install_debuild_dependencies

"${BUILD_PACKAGE}" "${REPO_DIR}/base"
"${BUILD_PACKAGE}" "${REPO_DIR}/frontend"
"${BUILD_PACKAGE}" "${REPO_DIR}/base" $@
"${BUILD_PACKAGE}" "${REPO_DIR}/frontend" $@
Loading