提交 9aa3792f 编写于 作者: S storypku

Scripts: add indendent buildify.sh

上级 cff728d4
......@@ -94,36 +94,6 @@ function apollo_env_setup() {
info "${TAB}STAGE: ${STAGE}"
}
function run_buildifier() {
local buildifier_cmd="$(command -v buildifier)"
if [ -z "${buildifier_cmd}" ]; then
local download_link="https://github.com/bazelbuild/buildtools/releases"
error "Command buildifier not found. You can download and install" \
"(or build) it from:"
error "${TAB}${download_link}"
exit 1
fi
buildifier_cmd="${buildifier_cmd} -mode=fix"
local build_dirs="cyber third_party tools external"
if [ "${STAGE}" == "dev" ]; then
build_dirs="modules ${build_dirs}"
fi
build_dirs=$(printf "${APOLLO_ROOT_DIR}/%s " $build_dirs)
find ${build_dirs} -name "*BUILD" -or -name "*.bzl" -exec \
${buildifier_cmd} {} +
success "buildifier run finished successfully."
if [ -f "${APOLLO_ROOT_DIR}/BUILD" ]; then
${buildifier_cmd} "${APOLLO_ROOT_DIR}/BUILD"
fi
if [ -f "${APOLLO_ROOT_DIR}/WORKSPACE.in" ]; then
${buildifier_cmd} "${APOLLO_ROOT_DIR}/WORKSPACE.in"
fi
}
function run_cleanup() {
if ! "${APOLLO_IN_DOCKER}" ; then
error "The clean operation must be run from within docker container"
......@@ -155,7 +125,7 @@ function main() {
${APOLLO_ROOT_DIR}/scripts/apollo_docs.sh "$@"
;;
buildify)
run_buildifier
${APOLLO_ROOT_DIR}/scripts/apollo_buildify.sh "$@"
;;
clean)
run_cleanup
......
#! /usr/bin/env bash
set -e
TOPDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
source "${TOPDIR}/scripts/apollo.bashrc"
function buildify() {
local stage="${1:-dev}"
local buildifier_cmd="$(command -v buildifier)"
if [ -z "${buildifier_cmd}" ]; then
local download_link="https://github.com/bazelbuild/buildtools/releases"
error "Command buildifier not found. You can download and install" \
"(or build) it from:"
error "${TAB}${download_link}"
exit 1
fi
buildifier_cmd="${buildifier_cmd} -mode=fix"
local build_dirs="cyber third_party tools external"
if [ "${STAGE}" == "dev" ]; then
build_dirs="modules ${build_dirs}"
fi
build_dirs=$(printf "${APOLLO_ROOT_DIR}/%s " $build_dirs)
run find ${build_dirs} -name "*BUILD" -or -name "*.bzl" -exec \
${buildifier_cmd} {} +
success "buildifier run finished successfully."
if [ -f "${APOLLO_ROOT_DIR}/BUILD" ]; then
${buildifier_cmd} "${APOLLO_ROOT_DIR}/BUILD"
fi
if [ -f "${APOLLO_ROOT_DIR}/WORKSPACE.in" ]; then
${buildifier_cmd} "${APOLLO_ROOT_DIR}/WORKSPACE.in"
fi
}
function main() {
buildify "$@"
}
main "$@"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册