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
17# This script is a wrapper to run any build inside the docker container
18# when running ci_build.sh. It's purpose is to automate the call of ./configure.
19# Yes, this script is a workaround of a workaround.
20#
21# Usage: configured <CONTAINER_TYPE> [--disable-gcp] <COMMAND>
22#
23# The optional flag --disable-gcp disabled support for Google Cloud Platform
24# (GCP) in the builds.
25
26set -e
27
28CONTAINER_TYPE=$( echo "$1" | tr '[:upper:]' '[:lower:]' )
29shift 1
30
31COMMAND=("$@")
32
33export CI_BUILD_PYTHON="${CI_BUILD_PYTHON:-python}"
34export PYTHON_BIN_PATH="${PYTHON_BIN_PATH:-$(which ${CI_BUILD_PYTHON})}"
35# XLA currently does not build under Android, so disable it for now.
36if [[ "${CONTAINER_TYPE}" == 'android' ]]; then
37  export TF_ENABLE_XLA=0
38fi
39
40pushd "${CI_TENSORFLOW_SUBMODULE_PATH:-.}"
41yes "" | $PYTHON_BIN_PATH configure.py
42popd
43
44# Gather and print build information
45SCRIPT_DIR=$( cd ${0%/*} && pwd -P )
46${SCRIPT_DIR}/print_build_info.sh ${CONTAINER_TYPE} ${COMMAND[@]}
47
48${COMMAND[@]}
49