提交 ca7b7104 编写于 作者: X Xiangquan Xiao 提交者: Calvin Miao

Scripts: Auto-config if user didn't do it.

上级 c3768291
...@@ -78,6 +78,10 @@ function apollo_env_setup() { ...@@ -78,6 +78,10 @@ function apollo_env_setup() {
info "${TAB}APOLLO_IN_DOCKER: ${APOLLO_IN_DOCKER}" info "${TAB}APOLLO_IN_DOCKER: ${APOLLO_IN_DOCKER}"
info "${TAB}APOLLO_VERSION: ${APOLLO_VERSION}" info "${TAB}APOLLO_VERSION: ${APOLLO_VERSION}"
info "${TAB}APOLLO_ENV: ${APOLLO_ENV} USE_GPU=${USE_GPU}" info "${TAB}APOLLO_ENV: ${APOLLO_ENV} USE_GPU=${USE_GPU}"
if [ ! -f "${APOLLO_ROOT_DIR}/.apollo.bazelrc" ]; then
env ${APOLLO_ENV} bash "${APOLLO_ROOT_DIR}/scripts/apollo_config.sh" "$@"
fi
} }
#TODO(all): Update node modules #TODO(all): Update node modules
......
...@@ -7,8 +7,6 @@ You could still proceed with the next few steps even if you are missing the Linu ...@@ -7,8 +7,6 @@ You could still proceed with the next few steps even if you are missing the Linu
./apollo.sh ./apollo.sh
# To make sure you start clean # To make sure you start clean
./apollo.sh clean ./apollo.sh clean
# To configure bazel settings
./apollo.sh config
# This will build the full system and requires that you have an nVidia GPU with nVidia drivers loaded # This will build the full system and requires that you have an nVidia GPU with nVidia drivers loaded
bash apollo.sh build bash apollo.sh build
``` ```
......
...@@ -32,6 +32,10 @@ function clean() { ...@@ -32,6 +32,10 @@ function clean() {
bazel clean --async bazel clean --async
popd >/dev/null popd >/dev/null
fi fi
# Remove local bazel config.
bash "${TOP_DIR}/scripts/apollo_config.sh" --clean
success "Done $0 ${stage}." success "Done $0 ${stage}."
} }
......
...@@ -13,33 +13,32 @@ EOF ...@@ -13,33 +13,32 @@ EOF
set -e set -e
BAZEL_CONF="${TOP_DIR}/.apollo.bazelrc"
function config_noninteractive() { function config_noninteractive() {
local bzl_cfg_file="${APOLLO_ROOT_DIR}/.apollo.bazelrc" echo "${STARTUP_TXT}" > "${BAZEL_CONF}"
echo "${STARTUP_TXT}" > "${bzl_cfg_file}"
# determine_gpu_use # determine_gpu_use
# FIXME(all): Disable gpu mode for aarch64 until we are ready. # FIXME(all): Disable gpu mode for aarch64 until we are ready.
if [ "$(uname -m)" = "aarch64" ]; then if [ "$(uname -m)" = "aarch64" ]; then
echo "build --config=cpu" >> "${bzl_cfg_file}" echo "build --config=cpu" >> "${BAZEL_CONF}"
else else
if [ "${USE_GPU}" -eq 1 ]; then if [ "${USE_GPU}" -eq 1 ]; then
echo "build --config=gpu" >> "${bzl_cfg_file}" echo "build --config=gpu" >> "${BAZEL_CONF}"
else else
echo "build --config=cpu" >> "${bzl_cfg_file}" echo "build --config=cpu" >> "${BAZEL_CONF}"
fi fi
fi fi
cat "${TOP_DIR}/tools/apollo.bazelrc.sample" >> "${BAZEL_CONF}"
cat "${APOLLO_ROOT_DIR}/tools/apollo.bazelrc.sample" >> "${bzl_cfg_file}"
} }
function config_interactive() { function config_interactive() {
if [ -z "$PYTHON_BIN_PATH" ]; then if [ -z "$PYTHON_BIN_PATH" ]; then
PYTHON_BIN_PATH=$(which python3 || true) PYTHON_BIN_PATH=$(which python3 || true)
fi fi
local bzl_cfg_file="${APOLLO_ROOT_DIR}/.apollo.bazelrc"
# Set all env variables # Set all env variables
"$PYTHON_BIN_PATH" "${TOP_DIR}/tools/bootstrap.py" "$@" "$PYTHON_BIN_PATH" "${TOP_DIR}/tools/bootstrap.py" "$@"
echo "${STARTUP_TXT}" >> "${bzl_cfg_file}" echo "${STARTUP_TXT}" >> "${BAZEL_CONF}"
} }
function config() { function config() {
...@@ -48,7 +47,9 @@ function config() { ...@@ -48,7 +47,9 @@ function config() {
config_noninteractive config_noninteractive
else else
local mode="$1" ; shift local mode="$1" ; shift
if [[ "${mode}" == "--interactive" || "${mode}" == "-i" ]]; then if [ "${mode}" == "--clean" ]; then
rm -f "${BAZEL_CONF}"
elif [[ "${mode}" == "--interactive" || "${mode}" == "-i" ]]; then
config_interactive "$@" config_interactive "$@"
else else
config_noninteractive config_noninteractive
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册