You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/02/18 03:48:18 UTC

[incubator-doris-flink-connector] branch master updated: [chore] Modify the build.sh script (#5)

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-flink-connector.git


The following commit(s) were added to refs/heads/master by this push:
     new 875dd68  [chore] Modify the build.sh script (#5)
875dd68 is described below

commit 875dd6863626dbae676bec24bce7933e6f454adb
Author: Mingyu Chen <mo...@gmail.com>
AuthorDate: Fri Feb 18 11:48:12 2022 +0800

    [chore] Modify the build.sh script (#5)
    
    Add "--tag" option so that when we can build from a tag.
    Because in tag, the flink and scala version is deterministic and does not need to be specified.
---
 .github/workflows/build-extension.yml |  6 ++--
 flink-doris-connector/build.sh        | 54 ++++++++++++++++++++++++++---------
 2 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/.github/workflows/build-extension.yml b/.github/workflows/build-extension.yml
index c3363e3..940af34 100644
--- a/.github/workflows/build-extension.yml
+++ b/.github/workflows/build-extension.yml
@@ -48,13 +48,13 @@ jobs:
 
     - name: Build flink connector 1.11
       run: |
-        cd flink-doris-connector/ && /bin/bash build.sh 1.11.6 2.12
+        cd flink-doris-connector/ && /bin/bash build.sh --flink 1.11.6 --scala 2.12
 
     - name: Build flink connector 1.12
       run: |
-        cd flink-doris-connector/ && /bin/bash build.sh 1.12.7 2.12
+        cd flink-doris-connector/ && /bin/bash build.sh --flink 1.12.7 --scala 2.12
 
     - name: Build flink connector 1.13
       run: |
-        cd flink-doris-connector/ && /bin/bash build.sh 1.13.5 2.12
+        cd flink-doris-connector/ && /bin/bash build.sh --flink 1.13.5 --scala 2.12
 
diff --git a/flink-doris-connector/build.sh b/flink-doris-connector/build.sh
index e4f8cf7..292eb91 100644
--- a/flink-doris-connector/build.sh
+++ b/flink-doris-connector/build.sh
@@ -25,26 +25,39 @@
 
 set -eo pipefail
 
+ROOT=$(dirname "$0")
+ROOT=$(cd "$ROOT"; pwd)
+
+export DORIS_HOME=${ROOT}/../
+
 usage() {
   echo "
   Usage:
-    $0 flink_version scala_version
+    $0 --flink version --scala version # specify flink and scala version
+    $0 --tag                           # this is a build from tag
   e.g.:
-    $0 1.11.6 2.12
-    $0 1.12.7 2.12
-    $0 1.13.5 2.12
+    $0 --flink 1.11.6 --scala 2.12
+    $0 --flink 1.12.7 --scala 2.12
+    $0 --flink 1.13.5 --scala 2.12
+    $0 --tag
   "
   exit 1
 }
 
-if [ $# -ne 2 ]; then
+OPTS=$(getopt \
+  -n $0 \
+  -o '' \
+  -o 'h' \
+  -l 'flink:' \
+  -l 'scala:' \
+  -l 'tag' \
+  -- "$@")
+
+if [ $# == 0 ] ; then
     usage
 fi
 
-ROOT=$(dirname "$0")
-ROOT=$(cd "$ROOT"; pwd)
-
-export DORIS_HOME=${ROOT}/../
+eval set -- "$OPTS"
 
 . "${DORIS_HOME}"/env.sh
 
@@ -53,11 +66,26 @@ if [[ -f ${DORIS_HOME}/custom_env.sh ]]; then
     . "${DORIS_HOME}"/custom_env.sh
 fi
 
-rm -rf output/
-${MVN_BIN} clean package -Dscala.version=$2 -Dflink.version=$1
+BUILD_FROM_TAG=0
+FLINK_VERSION=0
+SCALA_VERSION=0
+while true; do
+    case "$1" in
+        --flink) FLINK_VERSION=$2 ; shift 2 ;;
+        --scala) SCALA_VERSION=$2 ; shift 2 ;;
+        --tag) BUILD_FROM_TAG=1 ; shift ;;
+        --) shift ;  break ;;
+        *) echo "Internal error" ; exit 1 ;;
+    esac
+done
 
-mkdir -p output/
-cp target/doris-flink-*.jar ./output/
+if [[ ${BUILD_FROM_TAG} -eq 1 ]]; then
+    rm -rf output/
+    ${MVN_BIN} clean package
+else
+    rm -rf output/
+    ${MVN_BIN} clean package -Dscala.version=${SCALA_VERSION} -Dflink.version=${FLINK_VERSION}
+fi
 
 echo "*****************************************"
 echo "Successfully build Flink-Doris-Connector"

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org