diff --git a/scripts/cmake-build/utils/utils.sh b/scripts/cmake-build/utils/utils.sh index 99fa6ff8..8b3264eb 100755 --- a/scripts/cmake-build/utils/utils.sh +++ b/scripts/cmake-build/utils/utils.sh @@ -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 diff --git a/scripts/whl/utils/utils.sh b/scripts/whl/utils/utils.sh index 4bc2e2aa..0eee9a92 100755 --- a/scripts/whl/utils/utils.sh +++ b/scripts/whl/utils/utils.sh @@ -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=""