From 9b0b544bcd6d111f39769720c029e695e8f041b9 Mon Sep 17 00:00:00 2001
From: Yi WU <dataroaring@gmail.com>
Date: Sun, 6 Feb 2022 23:14:53 +0800
Subject: [PATCH] teach build.sh --clean work correctly

CMAKE_BUILD_DIR is set while building be. "build.sh --clean" just
cleans and exits, however clean_be does not works without
CMAKE_BUILD_DIR set. This patch set CMAKE_BUILD_DIR in clean_be
to teach build.sh --clean work correctly.
---
 build.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/build.sh b/build.sh
index ad1399186bb6ef..ab4c8098708a32 100755
--- a/build.sh
+++ b/build.sh
@@ -76,6 +76,12 @@ clean_gensrc() {
 
 clean_be() {
     pushd ${DORIS_HOME}
+
+    # "build.sh --clean" just cleans and exits, however CMAKE_BUILD_DIR is set
+    # while building be.
+    CMAKE_BUILD_TYPE=${BUILD_TYPE:-Release}
+    CMAKE_BUILD_DIR=${DORIS_HOME}/be/build_${CMAKE_BUILD_TYPE}
+
     rm -rf $CMAKE_BUILD_DIR
     rm -rf ${DORIS_HOME}/be/output/
     popd