[chore](thirdparty) Support cleaning extracted data before building them (#15458)
Currently, we may fail to build the third-party libraries if we keep the outdated extracted data. Considering the following scenario, Bob added patches to some libraries and Alice updates the codebase and builds the third-party libraries. If Alice kept the outdated extracted data, she should fail to build the third-party libraries because the patches are not applied due to the outdated `patched_marks`. This PR introduces a way to clean the outdated data before building the third-party libraries.
This commit is contained in:
14
thirdparty/build-thirdparty.sh
vendored
14
thirdparty/build-thirdparty.sh
vendored
@ -49,6 +49,7 @@ usage() {
|
||||
Usage: $0 <options>
|
||||
Optional options:
|
||||
-j build thirdparty parallel
|
||||
--clean clean the extracted data
|
||||
"
|
||||
exit 1
|
||||
}
|
||||
@ -58,6 +59,7 @@ if ! OPTS="$(getopt \
|
||||
-o '' \
|
||||
-o 'h' \
|
||||
-l 'help' \
|
||||
-l 'clean' \
|
||||
-o 'j:' \
|
||||
-- "$@")"; then
|
||||
usage
|
||||
@ -88,6 +90,10 @@ if [[ "$#" -ne 1 ]]; then
|
||||
HELP=1
|
||||
shift
|
||||
;;
|
||||
--clean)
|
||||
CLEAN=1
|
||||
shift
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
@ -102,11 +108,11 @@ fi
|
||||
|
||||
if [[ "${HELP}" -eq 1 ]]; then
|
||||
usage
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "Get params:
|
||||
PARALLEL -- ${PARALLEL}
|
||||
CLEAN -- ${CLEAN}
|
||||
"
|
||||
|
||||
if [[ ! -f "${TP_DIR}/download-thirdparty.sh" ]]; then
|
||||
@ -123,6 +129,12 @@ fi
|
||||
|
||||
cd "${TP_DIR}"
|
||||
|
||||
if [[ "${CLEAN}" -eq 1 ]] && [[ -d "${TP_SOURCE_DIR}" ]]; then
|
||||
echo 'Clean the extracted data ...'
|
||||
find "${TP_SOURCE_DIR}" -mindepth 1 -maxdepth 1 -type d -exec rm -rf {} \;
|
||||
echo 'Success!'
|
||||
fi
|
||||
|
||||
# Download thirdparties.
|
||||
"${TP_DIR}/download-thirdparty.sh"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user