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

jiafengzheng 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 3b159a9  support doriswriter build in macos (#8330)
3b159a9 is described below

commit 3b159a98202a94599e659c9fa0b2ba4d568c52b4
Author: wunan1210 <wunan1...@gmail.com>
AuthorDate: Mon Mar 7 09:53:16 2022 +0800

    support doriswriter build in macos (#8330)
    
    support doriswriter build in macos (#8330)
---
 extension/DataX/init-env.sh | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/extension/DataX/init-env.sh b/extension/DataX/init-env.sh
index b43756f..83eeb8e 100755
--- a/extension/DataX/init-env.sh
+++ b/extension/DataX/init-env.sh
@@ -35,6 +35,15 @@ DATAX_POM=$DATAX_EXTENSION_HOME/DataX/pom.xml
 DATAX_PACKAGE=$DATAX_EXTENSION_HOME/DataX/package.xml
 DATAX_CORE_POM=$DATAX_EXTENSION_HOME/DataX/core/pom.xml
 
+
+USE_MACOS=0
+# check OS type
+if [[ ! -z "$OSTYPE" ]]; then
+    if [[ ${OSTYPE:0:6} == "darwin" ]]; then
+        USE_MACOS=1
+    fi
+fi
+
 if [ ! -d $DATAX_GIT_DIR ]; then
     echo "Clone DataX from $DATAX_GITHUB"
     git clone $DATAX_GITHUB $DATAX_GIT_DIR
@@ -50,24 +59,37 @@ fi
 
 if [ `grep -c "doriswriter" $DATAX_POM` -eq 0 ]; then
     echo "No doriswriter module in $DATAX_POM, add it"
-    cp $DATAX_POM ${DATAX_POM}.orig
-    sed -i "s/<\/modules>/    <module>doriswriter<\/module>\n    
<\/modules>/g"  $DATAX_POM 
+    if [[ USE_MACOS -eq 0 ]];then
+        cp $DATAX_POM ${DATAX_POM}.orig
+        sed -i "s/<\/modules>/    <module>doriswriter<\/module>\n    
<\/modules>/g"  $DATAX_POM
+    else
+        sed -i '.orig' "s/<\/modules>/    <module>doriswriter<\/module>\n    
<\/modules>/g"  $DATAX_POM
+    fi
 else
     echo "doriswriter module exists in $DATAX_POM"  
 fi
 
 if [ `grep -c "doriswriter" $DATAX_PACKAGE` -eq 0 ]; then
     echo "No doriswriter module in $DATAX_PACKAGE, add it"
-    cp $DATAX_PACKAGE ${DATAX_PACKAGE}.orig
-    sed -i "s/<\/fileSets>/    <fileSet>\n            
<directory>doriswriter\/target\/datax\/<\/directory>\n            <includes>\n  
              <include>**\/*.*<\/include>\n            <\/includes>\n           
 <outputDirectory>datax<\/outputDirectory>\n        <\/fileSet>\n    
<\/fileSets>/g"  $DATAX_PACKAGE
+    if [[ USE_MACOS -eq 0 ]];then
+        cp $DATAX_PACKAGE ${DATAX_PACKAGE}.orig
+        sed -i "s/<\/fileSets>/    <fileSet>\n            
<directory>doriswriter\/target\/datax\/<\/directory>\n            <includes>\n  
              <include>**\/*.*<\/include>\n            <\/includes>\n           
 <outputDirectory>datax<\/outputDirectory>\n        <\/fileSet>\n    
<\/fileSets>/g"  $DATAX_PACKAGE
+    else
+        sed -i '.orig' "s/<\/fileSets>/    <fileSet>\n            
<directory>doriswriter\/target\/datax\/<\/directory>\n            <includes>\n  
              <include>**\/*.*<\/include>\n            <\/includes>\n           
 <outputDirectory>datax<\/outputDirectory>\n        <\/fileSet>\n    
<\/fileSets>/g"  $DATAX_PACKAGE
+    fi
 else
     echo "doriswriter module exists in $DATAX_PACKAGE"  
 fi
 
 if [ `grep -c "4.5.13" $DATAX_CORE_POM` -eq 0 ]; then
     echo "No httpclient 4.5.13 in $DATAX_CORE_POM, add it"
-    cp $DATAX_CORE_POM ${DATAX_CORE_POM}.orig
-    sed -i ":a;N;s/<artifactId>httpclient<\/artifactId>\n            
<version>4.5<\/version>/<artifactId>httpclient<\/artifactId>\n            
<version>4.5.13<\/version>/g" $DATAX_CORE_POM
+    if [[ USE_MACOS -eq 0 ]];then
+        cp $DATAX_CORE_POM ${DATAX_CORE_POM}.orig
+        sed -i ":a;N;s/<artifactId>httpclient<\/artifactId>\n            
<version>4.5<\/version>/<artifactId>httpclient<\/artifactId>\n            
<version>4.5.13<\/version>/g" $DATAX_CORE_POM
+    else
+        sed -i '.orig' -e "N" -e "s/<artifactId>httpclient<\/artifactId>\n     
       <version>4.5<\/version>/<artifactId>httpclient<\/artifactId>\n           
 <version>4.5.13<\/version>/g" $DATAX_CORE_POM
+    fi
+    
 else
     echo "httpclient 4.5.13 exists in $DATAX_CORE_POM"  
 fi

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

Reply via email to