This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 109b55e  [Shell] Add build parallel option (#5819)
109b55e is described below

commit 109b55ee5fff45870600a7eecc5ee1f2a86f1e02
Author: Yingchun Lai <[email protected]>
AuthorDate: Wed May 19 09:32:58 2021 +0800

    [Shell] Add build parallel option (#5819)
    
    Add build parallel option then we can build project with a user specified 
parallel not a fixed value.
---
 build.sh                       | 26 +++++++++++-------------
 run-be-ut.sh                   | 11 ++++++++--
 thirdparty/build-thirdparty.sh | 46 ++++++++++++++++++++++++++++++++++++++++++
 thirdparty/vars.sh             |  3 ---
 4 files changed, 67 insertions(+), 19 deletions(-)

diff --git a/build.sh b/build.sh
index 6c99370..b534887 100755
--- a/build.sh
+++ b/build.sh
@@ -35,14 +35,6 @@ export DORIS_HOME=${ROOT}
 
 . ${DORIS_HOME}/env.sh
 
-# build thirdparty libraries if necessary
-if [[ ! -f ${DORIS_THIRDPARTY}/installed/lib/libs2.a ]]; then
-    echo "Thirdparty libraries need to be build ..."
-    ${DORIS_THIRDPARTY}/build-thirdparty.sh
-fi
-
-PARALLEL=$[$(nproc)/4+1]
-
 # Check args
 usage() {
   echo "
@@ -53,6 +45,7 @@ Usage: $0 <options>
      --ui               build Frontend web ui with npm
      --spark-dpp        build Spark DPP application
      --clean            clean and build target
+     -j                 build Backend parallel
 
   Eg.
     $0                                      build all
@@ -75,6 +68,7 @@ OPTS=$(getopt \
   -l 'spark-dpp' \
   -l 'clean' \
   -l 'help' \
+  -o 'j:' \
   -- "$@")
 
 if [ $? != 0 ] ; then
@@ -83,12 +77,12 @@ fi
 
 eval set -- "$OPTS"
 
+PARALLEL=$[$(nproc)/4+1]
 BUILD_BE=
 BUILD_FE=
 BUILD_UI=
 BUILD_SPARK_DPP=
 CLEAN=
-RUN_UT=
 HELP=0
 if [ $# == 1 ] ; then
     # default
@@ -97,14 +91,12 @@ if [ $# == 1 ] ; then
     BUILD_UI=1
     BUILD_SPARK_DPP=1
     CLEAN=0
-    RUN_UT=0
 else
     BUILD_BE=0
     BUILD_FE=0
     BUILD_UI=0
     BUILD_SPARK_DPP=0
     CLEAN=0
-    RUN_UT=0
     while true; do
         case "$1" in
             --be) BUILD_BE=1 ; shift ;;
@@ -112,11 +104,11 @@ else
             --ui) BUILD_UI=1 ; shift ;;
             --spark-dpp) BUILD_SPARK_DPP=1 ; shift ;;
             --clean) CLEAN=1 ; shift ;;
-            --ut) RUN_UT=1   ; shift ;;
             -h) HELP=1; shift ;;
             --help) HELP=1; shift ;;
+            -j) PARALLEL=$2; shift 2 ;;
             --) shift ;  break ;;
-            *) ehco "Internal error" ; exit 1 ;;
+            *) echo "Internal error" ; exit 1 ;;
         esac
     done
 fi
@@ -126,6 +118,12 @@ if [[ ${HELP} -eq 1 ]]; then
     exit
 fi
 
+# build thirdparty libraries if necessary
+if [[ ! -f ${DORIS_THIRDPARTY}/installed/lib/libs2.a ]]; then
+    echo "Thirdparty libraries need to be build ..."
+    ${DORIS_THIRDPARTY}/build-thirdparty.sh -j $PARALLEL
+fi
+
 if [ ${CLEAN} -eq 1 -a ${BUILD_BE} -eq 0 -a ${BUILD_FE} -eq 0 -a 
${BUILD_SPARK_DPP} -eq 0 ]; then
     echo "--clean can not be specified without --fe or --be or --spark-dpp"
     exit 1
@@ -146,8 +144,8 @@ echo "Get params:
     BUILD_FE            -- $BUILD_FE
     BUILD_UI            -- $BUILD_UI
     BUILD_SPARK_DPP     -- $BUILD_SPARK_DPP
+    PARALLEL            -- $PARALLEL
     CLEAN               -- $CLEAN
-    RUN_UT              -- $RUN_UT
     WITH_MYSQL          -- $WITH_MYSQL
     WITH_LZO            -- $WITH_LZO
     GLIBC_COMPATIBILITY -- $GLIBC_COMPATIBILITY
diff --git a/run-be-ut.sh b/run-be-ut.sh
index 4d25a30..4ca5c27 100755
--- a/run-be-ut.sh
+++ b/run-be-ut.sh
@@ -39,8 +39,6 @@ export DORIS_HOME=${ROOT}
 
 . ${DORIS_HOME}/env.sh
 
-PARALLEL=$[$(nproc)/4+1]
-
 # Check args
 usage() {
   echo "
@@ -49,6 +47,7 @@ Usage: $0 <options>
      --clean    clean and build ut
      --run      build and run all ut
      --run xx   build and run specified ut
+     -j         build parallel
 
   Eg.
     $0                          build ut
@@ -65,6 +64,7 @@ OPTS=$(getopt \
   -o '' \
   -l 'run' \
   -l 'clean' \
+  -o 'j:' \
   -- "$@")
 
 if [ $? != 0 ] ; then
@@ -73,6 +73,7 @@ fi
 
 eval set -- "$OPTS"
 
+PARALLEL=$[$(nproc)/4+1]
 CLEAN=
 RUN=
 if [ $# == 1 ] ; then
@@ -86,6 +87,7 @@ else
         case "$1" in
             --clean) CLEAN=1 ; shift ;;
             --run) RUN=1 ; shift ;;
+            -j) PARALLEL=$2; shift 2 ;;
             --) shift ;  break ;;
             *) echo "Internal error" ; exit 1 ;;
         esac
@@ -94,6 +96,11 @@ fi
 
 CMAKE_BUILD_TYPE=${BUILD_TYPE:-ASAN}
 CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE^^}"
+
+echo "Get params:
+    PARALLEL            -- $PARALLEL
+    CLEAN               -- $CLEAN
+"
 echo "Build Backend UT"
 
 CMAKE_BUILD_DIR=${DORIS_HOME}/be/ut_build_${CMAKE_BUILD_TYPE}
diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh
index fff97b8..49b5868 100755
--- a/thirdparty/build-thirdparty.sh
+++ b/thirdparty/build-thirdparty.sh
@@ -34,6 +34,52 @@ curdir=`cd "$curdir"; pwd`
 export DORIS_HOME=$curdir/..
 export TP_DIR=$curdir
 
+# Check args
+usage() {
+  echo "
+Usage: $0 <options>
+  Optional options:
+     -j                 build thirdparty parallel
+  "
+  exit 1
+}
+
+OPTS=$(getopt \
+  -n $0 \
+  -o '' \
+  -o 'h' \
+  -l 'help' \
+  -o 'j:' \
+  -- "$@")
+
+if [ $? != 0 ] ; then
+    usage
+fi
+
+eval set -- "$OPTS"
+
+PARALLEL=$[$(nproc)/4+1]
+if [[ $# -ne 1 ]] ; then
+    while true; do
+        case "$1" in
+            -j) PARALLEL=$2; shift 2 ;;
+            -h) HELP=1; shift ;;
+            --help) HELP=1; shift ;;
+            --) shift ;  break ;;
+            *) echo "Internal error" ; exit 1 ;;
+        esac
+    done
+fi
+
+if [[ ${HELP} -eq 1 ]]; then
+    usage
+    exit
+fi
+
+echo "Get params:
+    PARALLEL            -- $PARALLEL
+"
+
 # include custom environment variables
 if [[ -f ${DORIS_HOME}/env.sh ]]; then
     . ${DORIS_HOME}/env.sh
diff --git a/thirdparty/vars.sh b/thirdparty/vars.sh
index bb79834..fe88967 100644
--- a/thirdparty/vars.sh
+++ b/thirdparty/vars.sh
@@ -21,9 +21,6 @@
 # which are used for compiling thirdparties and palo itself.
 ############################################################
 
-# --job param for *make*
-PARALLEL=$[$(nproc)/4+1]
-
 ###################################################
 # DO NOT change variables bellow unless you known 
 # what you are doing.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to