xref: /aosp_15_r20/external/tensorflow/tensorflow/tools/ci_build/builds/android.sh (revision b6fb3261f9314811a0f4371741dbb8839866f948)
1#!/usr/bin/env bash
2# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15# ==============================================================================
16
17set -e
18
19SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
20source "${SCRIPT_DIR}/builds_common.sh"
21configure_android_workspace
22
23# The Bazel builds are intentionally built for x86 and arm64 to maximize build
24# coverage while minimizing compilation time. For full build coverage and
25# exposed binaries, see android_full.sh
26
27echo "========== TensorFlow Basic Build Test =========="
28TARGETS=
29# Building the Eager Runtime ensures compatibility with Android for the
30# benefits of clients like TensorFlow Lite. For now it is enough to build only
31# :execute, which what TF Lite needs. Note that this does *not* build the
32# full set of mobile ops/kernels, as that can be prohibitively expensive.
33TARGETS+=" //tensorflow/core/common_runtime/eager:execute"
34# Enable sandboxing so that zip archives don't get incorrectly packaged
35# in assets/ dir (see https://github.com/bazelbuild/bazel/issues/2334)
36# TODO(gunan): remove extra flags once sandboxing is enabled for all builds.
37bazel --bazelrc=/dev/null build \
38    --compilation_mode=opt --cxxopt=-std=c++17 \
39    --config=android_arm64 --fat_apk_cpu=x86,arm64-v8a \
40    --spawn_strategy=sandboxed --genrule_strategy=sandboxed \
41    --define=grpc_no_ares=true \
42    ${TARGETS}
43
44# TODO(b/122377443): Restore Makefile builds after resolving r18b build issues.
45