提交 ec59a5bc 编写于 作者: M Megvii Engine Team

fix(build): fix ninja dry run

GitOrigin-RevId: 89f4db7e77794efd1c8aef6968819d54da134b9d
上级 b18544b4
......@@ -83,16 +83,24 @@ function config_ninja_target_cmd() {
fi
if [ -z "${_NINJA_TARGET}" ]; then
NINJA_CMD="${NINJA_BASE} all -j ${_NINJA_MAX_JOBS}"
elif [[ ${_NINJA_TARGET} =~ "install" ]]; then
NINJA_CMD="${NINJA_BASE} all -j ${_NINJA_MAX_JOBS} && ${NINJA_BASE} ${_NINJA_TARGET}"
else
NINJA_CMD="${NINJA_BASE} ${_NINJA_TARGET} -j ${_NINJA_MAX_JOBS}"
fi
if [ ${_NINJA_DRY_RUN} = "ON" ]; then
if [[ "${NINJA_CMD}" =~ "&" ]]; then
echo "code issue happened!!! base cmd can not include & before ninja explain"
echo "now cmd: ${NINJA_CMD}"
exit -1
fi
NINJA_CMD="${NINJA_CMD} -d explain -n"
else
if [ ${_NINJA_VERBOSE} = "ON" ]; then
if [[ "${NINJA_CMD}" =~ "&" ]]; then
echo "code issue happened!!! base cmd can not include & before ninja explain"
echo "now cmd: ${NINJA_CMD}"
exit -1
fi
NINJA_CMD="${NINJA_CMD} -d explain -v"
fi
if [ ${_BUILD_DEVELOP} = "ON" ]; then
......
......@@ -13,6 +13,7 @@ function config_docker_file() {
}
function ninja_dry_run_and_check_increment() {
echo "into ninja_dry_run_and_check_increment"
if [ $# -eq 3 ]; then
_BUILD_SHELL=$1
_BUILD_FLAGS="$2 -n"
......@@ -26,6 +27,8 @@ function ninja_dry_run_and_check_increment() {
DIRTY_LOG=`cat dry_run.log`
if [[ "${DIRTY_LOG}" =~ ${_INCREMENT_KEY_WORDS} ]]; then
echo "DIRTY_LOG is:"
echo ${DIRTY_LOG}
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "python3 switch increment build failed, some MR make a wrong CMakeLists.txt depends"
echo "or build env can not find default python3 in PATH env"
......@@ -33,6 +36,34 @@ function ninja_dry_run_and_check_increment() {
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
exit -1
fi
CHECK_NINJA_DRY_ISSUE_KEY_WORDS="VerifyGlobs"
if [[ "${DIRTY_LOG}" =~ ${CHECK_NINJA_DRY_ISSUE_KEY_WORDS} ]]; then
echo "DIRTY_LOG is:"
echo ${DIRTY_LOG}
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "python3 switch increment build failed, some MR make a wrong CMakeLists.txt"
echo "for example use GLOB with CONFIGURE_DEPENDS flag may lead to ninja dry run failed"
echo "about CONFIGURE_DEPENDS (please do not use it):"
echo "a: we use scripts/cmake-build/*.sh to trigger rerun cmake, so no need CONFIGURE_DEPENDS"
echo "b: as https://cmake.org/cmake/help/latest/command/file.html Note"
echo " CONFIGURE_DEPENDS do not support for all generators"
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
exit -1
fi
# as python3 change, imperative src need rebuild, force check it!
MUST_INCLUDE_KEY_WORDS="imperative"
if [[ "${DIRTY_LOG}" =~ ${MUST_INCLUDE_KEY_WORDS} ]]; then
echo "valid increment dry run log"
else
echo "DIRTY_LOG is:"
echo ${DIRTY_LOG}
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "python3 switch increment build failed, some MR make a wrong CMakeLists.txt depends"
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
exit -1
fi
}
PYTHON_API_INCLUDES=""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册