Skip to content

Commit

Permalink
travis: add option to skip building thirdparties (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wu Tao authored and qinzuoyan committed Dec 19, 2018
1 parent 62ad5b7 commit deaba4f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 20 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ before_script:
- wget https://raw.githubusercontent.com/xiaomi/pegasus-common/master/pegasus-thirdparty-prebuild.tar.gz
- tar xf pegasus-thirdparty-prebuild.tar.gz
- rm -rf pegasus-thirdparty-prebuild.tar.gz
- wget https://raw.githubusercontent.com/xiaomi/pegasus-common/master/zookeeper-3.4.10.tar.gz
- mkdir src/
- tar xf zookeeper-3.4.10.tar.gz -C src
- rm -rf zookeeper-3.4.10.tar.gz
- cd ..
- ulimit -c unlimited -S

script:
- ./run.sh test
- ./run.sh test --skip_thirdparty

after_script:
- ./run.sh stop_zk
Expand Down
49 changes: 30 additions & 19 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function usage_build()
echo " --notest build without building unit tests, default no"
echo " --disable_gperf build without gperftools, this flag is mainly used"
echo " to enable valgrind memcheck, default no"
echo " --skip_thirdparty whether to skip building thirdparties, default no"
if [ "$ONLY_BUILD" == "NO" ]; then
echo " -m|--test_module specify modules to test, split by ',',"
echo " e.g., \"dsn.core.tests,dsn.tests\","
Expand All @@ -69,6 +70,7 @@ function run_build()
JOB_NUM=8
BOOST_DIR=""
ENABLE_GCOV=NO
SKIP_THIRDPARTY=NO
RUN_VERBOSE=NO
NO_TEST=NO
TEST_MODULE=""
Expand Down Expand Up @@ -121,6 +123,10 @@ function run_build()
--disable_gperf)
DISABLE_GPERF=YES
;;
--skip_thirdparty)
SKIP_THIRDPARTY=YES
echo "run.sh build: skip building third-parties"
;;
-m|--test_module)
if [ "$ONLY_BUILD" == "YES" ]; then
echo "ERROR: unknown option \"$key\""
Expand All @@ -141,23 +147,25 @@ function run_build()
shift
done

# build thirdparty first
cd thirdparty
if [ "$CLEAR_THIRDPARTY" == "YES" ]; then
echo "Clear thirdparty..."
rm -rf src build output &>/dev/null
CLEAR=YES
fi
./download-thirdparty.sh
exit_if_fail $?
if [ "x"$BOOST_DIR != "x" ]; then
./build-thirdparty.sh -b $BOOST_DIR
exit_if_fail $?
else
./build-thirdparty.sh
if [[ ${SKIP_THIRDPARTY} != "YES" ]]; then
# build thirdparty first
cd thirdparty
if [[ "$CLEAR_THIRDPARTY" == "YES" ]]; then
echo "Clear thirdparty..."
rm -rf src build output &>/dev/null
CLEAR=YES
fi
./download-thirdparty.sh
exit_if_fail $?
if [[ "x"$BOOST_DIR != "x" ]]; then
./build-thirdparty.sh -b $BOOST_DIR
exit_if_fail $?
else
./build-thirdparty.sh
exit_if_fail $?
fi
cd ..
fi
cd ..

if [ "$BUILD_TYPE" != "debug" -a "$BUILD_TYPE" != "release" ]; then
echo "ERROR: invalid build type \"$BUILD_TYPE\""
Expand Down Expand Up @@ -226,10 +234,13 @@ function usage_start_zk()
}
function run_start_zk()
{
# download zk before start zk service
# as zk is a 3rdparty dependency of rdsn project,
# so we simply download the whole thirdparty for simplicity
`pwd`/thirdparty/download-thirdparty.sh
if [[ ! -d `pwd`/thirdparty/src/zookeeper-3.4.10/bin ]]; then
# download zk before starting zk service
# here we simply download all the third-parties
`pwd`/thirdparty/download-thirdparty.sh
else
echo "skip download zookeeper"
fi
exit_if_fail $?

DOWNLOADED_DIR=`pwd`/thirdparty/src
Expand Down

0 comments on commit deaba4f

Please sign in to comment.